Hi again.
Finally, I'm trying to generate my Wadl using pieces and bits of Jersey,
basically like this:
WadlBuilder builder = new WadlBuilder(new WadlGeneratorImpl());
Application application = builder.generate(abstractResource);
Then I just serialize this "application" object using XStream. However
the results are strange. This is what I got for a very simple resource:
OPTIONS /FileUpload/test
<application>
<doc>
<doc>
<otherAttributes>
<entry>
<javax.xml.namespace.QName>
<namespaceURI>
http://jersey.dev.java.net/</namespaceURI>
<localPart>generatedBy</localPart>
<prefix>jersey</prefix>
</javax.xml.namespace.QName>
<string>Jersey: 1.1.0-ea 04/30/2009 05:54
PM</string>
</entry>
</otherAttributes>
</doc>
</doc>
<resources>
<resource>
<resource>
<path>/FileUpload/FileUpload/test</path>
<otherAttributes/>
</resource>
</resource>
<otherAttributes/>
</resources>
</application>
If I try to validate against
https://wadl.dev.java.net/wadl20061109.xsd
I got this errors:
Location: 6:14
Description: cvc-complex-type.2.4.a: Invalid content was found starting
with element 'doc'. One of
'{WC[##other:"
http://research.sun.com/wadl/2006/10"]}' is expected.
Location: 7:18
Description: cvc-complex-type.2.4.a: Invalid content was found starting
with element 'otherAttributes'. One of
'{WC[##other:"
http://research.sun.com/wadl/2006/10"]}' is expected.
Location: 22:22
Description: cvc-complex-type.2.4.a: Invalid content was found starting
with element 'path'. One of
'{"
http://research.sun.com/wadl/2006/10":doc,
"
http://research.sun.com/wadl/2006/10":param,
"
http://research.sun.com/wadl/2006/10":method,
"
http://research.sun.com/wadl/2006/10":resource,
WC[##other:"
http://research.sun.com/wadl/2006/10"]}' is expected.
Location: 26:14
Description: cvc-complex-type.2.4.a: Invalid content was found starting
with element 'otherAttributes'. One of
'{"
http://research.sun.com/wadl/2006/10":resource,
WC[##other:"
http://research.sun.com/wadl/2006/10"]}' is expected.
If the example is a little more complicated, there are more errors and
strange things, like for instance to access a Method I have this XPath:
/application[1]/resources[1]/resource[1]/resource[1]/methodOrResource[1]/resource[1]/methodOrResource[1]/method[1]
Can someone point to me to what I'm doing wrong?
Cheers.
António Mota wrote:
> Hi all.
>
> I've searched the archive and other places but what I found is not
> applicable for my use case, so....
>
> As I said in another post, I'm using only parts of Jersey in my app,
> basically because we have to support protocols other than HTTP, so
> basically I'm doing things within my own code that otherwise is done
> already by Jersey.
>
> So my problem now is that I have a bunch of Resources annotated with
> Jersey/Jax-rs annotations, and now I want to generate a WADL for those
> resources when they are invoked with a OPTIONS method.
>
> Basically, I want to introspect the resource class and return
> everithing that is Jersey/Jax-rs annotated. And only those, as I'm not
> using JAXB in my project.
>
> Is there something already in place for this?
>
> I'm sorry if this is a obvious question and I didn't search well enough
>