Create and link XSD to a WADL Create and link XSD to a WADL json json

Create and link XSD to a WADL


It is possible to link an XSD file into a WADL file and then to reference an XML element in the representation for requests and responses. However, as it is XML schema it doesn't apply to JSON representations.

To link an XSD into a WADL file, create a grammars element at the top of the file before the main resources element.

<grammars>    <include href="myapp.xsd"/></grammars>

Then add a reference to an XML element as follows (using a modified version of your example):

<resource path="/oneParam">   <method name="POST">      <request>            <representation mediaType="application/xml" element="myapp:oneParamRequest" />      </request>      <response>             <representation mediaType="application/xml" element="myapp:oneParamResponse" />       </response>   </method></resource>

The prefix myapp is defined in the XSD and can be used in the WADL file as well.

I don't know to to configure CXF to do this automatically. My experience with Jersey is similar and we use the generated WADL as a starting point for hand-editing later.