users@jersey.java.net

FW: xml schema in request and response (wadl)

From: Suchitha Koneru (sukoneru) <"Suchitha>
Date: Tue, 3 Nov 2009 23:02:13 -0800

 

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.