I have a CXF service (2.5.2) which consumes JSON object and produces JSON object like below
@POST
@Produces({"application/json"})
@Consumes({"application/json"})
public AResponseObject register(@PathParam("param1") String param1, User user) {
//
}
WADL generated by CXF for above service is as following:
<application xmlns="http://wadl.dev.java.net/2009/02" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<script id="tinyhippos-injected"/>
<grammars/>
<resources base="http://host/...">
<resource path="/register/{param1}">
<param name="param1" style="template" type="xs:string"/>
<method name="POST" id="register">
<request>
<representation mediaType="application/json"/>
</request>
<response>
<representation mediaType="application/json"/>
</response>
</method>
</resource>
</resources>
</application>
Above WADL file:-
doesn't give any details for what User object is in grammars section
resource doesn't specify that method requires a User object in request payload
How do I add these missing things to the WADL file?
Thanks.
You need to add the cxf WadlGenerator as a provider in your Blueprint file:
<bean id="wadlGenerator" class="org.apache.cxf.jaxrs.model.wadl.WadlGenerator">
<property name="linkJsonToXmlSchema" value="true" />
</bean>
<jaxrs:server id="someRestService" address="/my/endpoint">
<jaxrs:serviceBeans>
<ref component-id="someRestServiceBean" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref component-id="wadlGenerator" />
<ref component-id="jsonProvider" />
</jaxrs:providers>
</jaxrs:server>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.