You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by hwaastad <he...@waastad.org> on 2014/02/19 18:49:52 UTC
tomee, rest wadl generation
Hi,
I've got a quiestion regarding wadl generation in tomee/cxf/rest
I'm not quite sure if this is a tomee issue, but maybe someone has seen this
before.
A simple rest method:
@POST
@Consumes("application/json")
@Produces("application/json")
public Response putJson(User user) {
return Response.ok().build();
}
The user is just a plain pojo annotated with @xmlrootelement
the wadl (resource/?_wadl) produces:
<application xmlns="http://wadl.dev.java.net/2009/02"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<grammars>
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="user" type="user"/>
<xs:complexType name="user">
<xs:sequence>
<xs:element minOccurs="0" name="age" type="xs:int"/>
<xs:element minOccurs="0" name="name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</grammars>
<resources base="http://localhost:8080/GlassfishRest/webresources/">
<resource path="/generic">
<method name="POST">
<request>
<representation mediaType="application/json"/>
</request>
<response>
<representation mediaType="application/json"/>
</response>
</method>
</resource>
</resources>
</application>
In jersey :
<grammars>
<include href="application.wadl/xsd0.xsd">
<doc title="Generated" xml:lang="en"/>
</include>
</grammars>
<resources base="http://localhost:8080/GlassfishRest/webresources/">
<resource path="generic">
<method id="putJson" name="POST">
<request>
<ns2:representation element="user" mediaType="application/json"
xmlns:ns2="http://wadl.dev.java.net/2009/02" xmlns=""/>
</request>
<response>
<representation mediaType="application/json"/>
</response>
</method>
</resources>
Until now I have'nt been able to produce the <element="user">
description in the method.
Is there a missing cxf configuration to make apache cxf produce this?
best regards,
hw
--
View this message in context: http://openejb.979440.n4.nabble.com/tomee-rest-wadl-generation-tp4667900.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: tomee, rest wadl generation
Posted by Romain Manni-Bucau <rm...@gmail.com>.
I don't think so, seems just the standard wadl:
http://cxf.apache.org/docs/jaxrs-services-description.html
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau
2014-02-20 10:36 GMT+01:00 hwaastad <he...@waastad.org>:
> Ok,
> so what you're saying is that it's probably not been fixed in current cxf?
>
> br hw
>
>
>
> --
> View this message in context: http://openejb.979440.n4.nabble.com/tomee-rest-wadl-generation-tp4667900p4667921.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: tomee, rest wadl generation
Posted by hwaastad <he...@waastad.org>.
Ok,
so what you're saying is that it's probably not been fixed in current cxf?
br hw
--
View this message in context: http://openejb.979440.n4.nabble.com/tomee-rest-wadl-generation-tp4667900p4667921.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: tomee, rest wadl generation
Posted by Andy <ag...@tomitribe.com>.
Jersey added specific extensions to the wadl generation that cxf does not currently support - I don't think I've even seen this in the latest cxf 3.x source.
Andy.
Re: tomee, rest wadl generation
Posted by hwaastad <he...@waastad.org>.
Thx for input,
still it does'nt change anything.
The only thing I found out is that I also need namespace for the
xmlrootelement for element in xml aswell.
I guess I'll have to check the cxf pages.
Thanks again,
hw
--
View this message in context: http://openejb.979440.n4.nabble.com/tomee-rest-wadl-generation-tp4667900p4667914.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: tomee, rest wadl generation
Posted by Romain Manni-Bucau <rm...@gmail.com>.
maybe try putting in conf/system.properties
(src/main/tomee/conf/system.properties):
openejb.cxf-rs.wadl-generator.ignoreMessageWriters = false (test true
maybe but it should be false)
if it doesn't work maybe open a cxf issue
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau
2014-02-19 20:26 GMT+01:00 hwaastad <he...@waastad.org>:
> Hi Romain,
> you are correct about the json issue.
> If i accept/produce both xnl and json:
>
> <resource path="/generic">
> <method name="POST">
> <request>
> <representation mediaType="application/xml" element="prefix1:user"/>
> <representation mediaType="application/json"/>
> </request>
> <response>
> <representation mediaType="application/xml"/>
> <representation mediaType="application/json"/>
> </response>
> </method>
> </resource>
>
> I'm running 1.6.1-SNAPSHOT using tomee-maven-plugin but there is not
> difference from 1.6.0.
> (or did y mean the cxf core librabries?)
>
> br hw
>
>
>
> --
> View this message in context: http://openejb.979440.n4.nabble.com/tomee-rest-wadl-generation-tp4667900p4667906.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: tomee, rest wadl generation
Posted by hwaastad <he...@waastad.org>.
Hi Romain,
you are correct about the json issue.
If i accept/produce both xnl and json:
<resource path="/generic">
<method name="POST">
<request>
<representation mediaType="application/xml" element="prefix1:user"/>
<representation mediaType="application/json"/>
</request>
<response>
<representation mediaType="application/xml"/>
<representation mediaType="application/json"/>
</response>
</method>
</resource>
I'm running 1.6.1-SNAPSHOT using tomee-maven-plugin but there is not
difference from 1.6.0.
(or did y mean the cxf core librabries?)
br hw
--
View this message in context: http://openejb.979440.n4.nabble.com/tomee-rest-wadl-generation-tp4667900p4667906.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: tomee, rest wadl generation
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi
This is a cxf issue if an issue since we do nothing on this side.
Btw did you test with xml? I know cxf got issue with wadl and json, this
should be fixed now (maybe try trunk too)
Le 19 févr. 2014 18:50, "hwaastad" <he...@waastad.org> a écrit :
> Hi,
> I've got a quiestion regarding wadl generation in tomee/cxf/rest
>
> I'm not quite sure if this is a tomee issue, but maybe someone has seen
> this
> before.
>
> A simple rest method:
>
> @POST
> @Consumes("application/json")
> @Produces("application/json")
> public Response putJson(User user) {
> return Response.ok().build();
> }
>
> The user is just a plain pojo annotated with @xmlrootelement
>
>
> the wadl (resource/?_wadl) produces:
>
> <application xmlns="http://wadl.dev.java.net/2009/02"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <grammars>
> <xs:schema attributeFormDefault="unqualified"
> elementFormDefault="unqualified"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:element name="user" type="user"/>
> <xs:complexType name="user">
> <xs:sequence>
> <xs:element minOccurs="0" name="age" type="xs:int"/>
> <xs:element minOccurs="0" name="name" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
> </grammars>
> <resources base="http://localhost:8080/GlassfishRest/webresources/">
> <resource path="/generic">
> <method name="POST">
> <request>
> <representation mediaType="application/json"/>
> </request>
> <response>
> <representation mediaType="application/json"/>
> </response>
> </method>
> </resource>
> </resources>
> </application>
>
> In jersey :
>
> <grammars>
> <include href="application.wadl/xsd0.xsd">
> <doc title="Generated" xml:lang="en"/>
> </include>
> </grammars>
> <resources base="http://localhost:8080/GlassfishRest/webresources/">
> <resource path="generic">
> <method id="putJson" name="POST">
> <request>
> <ns2:representation element="user" mediaType="application/json"
> xmlns:ns2="http://wadl.dev.java.net/2009/02" xmlns=""/>
> </request>
> <response>
> <representation mediaType="application/json"/>
> </response>
> </method>
> </resources>
>
> Until now I have'nt been able to produce the <element="user">
> description in the method.
> Is there a missing cxf configuration to make apache cxf produce this?
>
> best regards,
> hw
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/tomee-rest-wadl-generation-tp4667900.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>