users@jersey.java.net

Re: [Jersey] FW: xml schema in request and response (wadl)

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 05 Nov 2009 12:02:49 +0100

On Nov 5, 2009, at 11:55 AM, gerard davison wrote:

>
>
> Paul,
>
> Is there an issue for this?

No, would you like to log an enhancement?


> Presumably it should be possible to work out the bean types
> automatically without having to use the javadoc tags.
>

Yes that should be possible, i recall now we had a quick discussion on
this. Ideally we should have something that can work with say XmlBeans
too. Which makes me think the right place to define this would be for
a message body reader/writer to implement a known interface.

There is one issue with responses, the return type may be of the type
Response. So it might be necessary in some cases to declare something
using an annotation instead.


> (This is work I am interested in doing at some point)
>

OK!

Paul.

> Gerard
>
>
> On 05/11/2009 08:55, Paul Sandoz wrote:
>> On Nov 4, 2009, at 7:28 PM, Suchitha Koneru (sukoneru) wrote:
>>
>>> Thanks Paul for the response.
>>> I haven't included javadoc tags as we do not have much java
>>> documentation added to the methods. Is java doc necessary for
>>> generating
>>> xsd references in the wadl's requests and responses ?
>>
>> Yes. That is currently the only way to associate xsd references
>> with entities of resource methods.
>>
>>
>>> Is there any
>>> tutorial which gives instructions on adding jersey specific java
>>> doc ?
>>
>> See the previous link i sent and also look at the JavaDoc of the
>> extended-wadl sample and the pom file.
>>
>> Paul.
>>
>>>
>>> -----Original Message-----
>>> From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
>>> Sent: Wednesday, November 04, 2009 1:21 AM
>>> To: users_at_jersey.dev.java.net
>>> Subject: Re: [Jersey] FW: xml schema in request and response (wadl)
>>>
>>> Hi Suchitha,
>>>
>>> Did you include javadoc tags such as:
>>>
>>> * @response.representation.200.qname {http://
>>> www.example.com}item
>>>
>>> * @request.representation.qname {http://www.example.com}item
>>>
>>> on the resource methods?
>>>
>>> http://wikis.sun.com/display/Jersey/SupportedJavadocTagsForExtendedWADL
>>>
>>> Paul.
>>>
>>> On Nov 4, 2009, at 8:02 AM, Suchitha Koneru (sukoneru) wrote:
>>>
>>>>
>>>> Xml schemas are attached for reference.
>>>> From: Suchitha Koneru (sukoneru)
>>>> Sent: Tuesday, November 03, 2009 9:55 PM
>>>> To: users_at_jersey.dev.java.net
>>>> Subject: xml schema in request and response (wadl)
>>>>
>>>> Hello Jersey Users ,
>>>> I have looked into extended-wadl sample application. I
>>>> was able to generate the extended-wadl which has a href to the xml
>>>> schema. However, In the restful service methods , the xsd for the
>>>> request and response is not specified. It looks like specifying
>>>> mediaType alone will not suffice, we would also need the related
>>>> xsd.
>>>>
>>>> For instance consider a snippet of the extended wadl
>>>> generated(also attached ). The consumer of the wadl will not be
>>>> aware of xml payload structure in requests/responses.
>>>>
>>>>
>>>> <resource path="Users">
>>>> <method name="GET" id="getAllUsers">
>>>> <response>
>>>> <representation mediaType="application/xml"/>
>>>> <representation mediaType="application/json"/>
>>>> </response>
>>>> </method>
>>>> <method name="PUT" id="updateUser">
>>>> <request>
>>>> <representation mediaType="application/xml"/>
>>>> </request>
>>>> <response>
>>>> <representation mediaType="*/*"/>
>>>> </response>
>>>> </method>
>>>> <method name="POST" id="createUser">
>>>> <request>
>>>> <representation mediaType="application/xml"/>
>>>> </request>
>>>> <response>
>>>> <representation mediaType="*/*"/>
>>>> </response>
>>>> </method>
>>>> <resource path="del/{userID}">
>>>> <param xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>>> type="xs:string" style="template" name="userID"/>
>>>> <method name="DELETE" id="deleteUser"/>
>>>> </resource>
>>>> <resource path="{userID}/">
>>>> <param xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>>> type="xs:string" style="template" name="userID"/>
>>>> <method name="GET" id="getUser">
>>>> <response>
>>>> <representation mediaType="application/xml"/>
>>>> </response>
>>>> </method>
>>>> </resource>
>>>>
>>>> The src code for customized wadl generator is
>>>>
>>>> public class SampleWadlConfigurator extends WadlGeneratorConfig {
>>>>
>>>> @Override
>>>> public List<WadlGeneratorDescription> configure() {
>>>> return generator( WadlGeneratorApplicationDoc.class )
>>>> .prop( "applicationDocsStream", "application-doc.xml" )
>>>> .generator( WadlGeneratorGrammarsSupport.class )
>>>> .prop( "grammarsStream", "application-grammars.xml" )
>>>> .descriptions();
>>>> }
>>>>
>>>>
>>>> Could you please let me know, if we can include xsd references in
>>>> request and response elements of the wadl(similar to a wsdl) .
>>>>
>>>> Thank you,
>>>> Suchitha.
>>>>
>>>> <application.wadl><schema1.xsd><schema2.xsd>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
> --
> Gerard Davison | Senior Principal Software Engineer | +44 118 924 5095
> Oracle JDeveloper Web Service Tooling Development
> Oracle Corporation UK Ltd is a company incorporated in England &
> Wales.
> Company Reg. No. 1782505.
> Reg. office: Oracle Parkway, Thames Valley Park, Reading RG6 1RA.
>
> Blog http://kingsfleet.blogspot.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>