I tried the following and I still do not see the type attribute referring
to my JAXB class.  Am I missing something??  Here is skeleton of my files:

//spring deployment file
<!-- WadlGenerator configuraiton -->
<bean id="wadlGenerator"
class="org.apache.cxf.jaxrs.model.wadl.WadlGenerator">
<property name="linkJsonToXmlSchema" value="true" />
</bean>

<!-- Start of Jackson configuration -->
<bean id="jacksonAnnotationInspector"
class="com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector"
/>

<bean id="jaxbAnnotationInspector"
class="com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector" />

<bean id="annotationIntrospector"
class="com.fasterxml.jackson.databind.AnnotationIntrospector.Pair">
<constructor-arg ref="jaxbAnnotationInspector" />
<constructor-arg ref="jacksonAnnotationInspector" />
</bean>

<bean id="jacksonObjectMapper"
class="com.fasterxml.jackson.databind.ObjectMapper">
<property name="annotationIntrospector" ref="annotationIntrospector" />
</bean>

<bean id="jsonProvider"
class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider">
<constructor-arg ref="jacksonObjectMapper" />
</bean>
<!-- End of Jackson configuration -->

<jaxrs:server id="EchoApi" address="/">
<jaxrs:serviceBeans>
<ref bean="echoService" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="wadlGenerator" />
<ref bean="jsonProvider" />
<ref bean="marshallingExceptionMapper" />
</jaxrs:providers>
</jaxrs:server>


//echoService

@Path("echo")
@POST
@Consumes({ APPLICATION_JSON })
@Produces({ APPLICATION_JSON })
@ElementClass(response = Echo.class)
public Response echo(@Context final MessageContext context, final Echo
echo) {
           //some code...
         }

//Echo class
@XmlRootElement(name = "echo")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder = { "...", "...", "..."" }) //the ... are actual values
in my real code
public class Echo {
   //some code...
}


On Wed, Oct 17, 2012 at 4:23 AM, Sergey Beryozkin <[email protected]>wrote:

> Hi
>
> On 16/10/12 21:18, Leith Shabbot wrote:
>
>> Hi:
>>
>> I am currently using Apache CXF 2.6.1.  I have a few POJO annotated with
>> JAXB. Currently just targeting JSON as the format for my REST service. I
>> am
>> looking at the WADL that gets generated and see the grammars section and
>> the resources section.  Everything looks good, with the exception that the
>> type attribute does not refer to one of my types defined in the grammar
>> section.  For my class that services the request, the operation returns a
>> Response object and this operation uses the
>> @ElementClass(response=Echo.**class), in which JAXB annotated Echo class
>> makes up the body of the the response.
>>
>>
> WADLGenerator has a property "linkJsonToXmlSchema", so if you explicitly
> register it in jaxrs:providers with this property enabled then it should
> get json representations linked to the schema.
>
> By the way, if you can get a chance, try experimenting with returning a
> generated WADL in JSON format,
>
> Cheers, Sergey
>
>
>> Thanks,
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>

Reply via email to