Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-3617

Automatic Type Converters for Restful Clients

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • JAX-RS
    • None
    • Moderate

    Description

      Given the following interface:

      @POST
      @Path( "execute" )
      @Produces( "application/json" )
      MyObject execute( MyObject myObject );
      

      One must provide MessageBodyReader\Writer or face the following exception:

      Exception in thread "main" org.apache.cxf.interceptor.Fault: .No message body writer found for class : class com.company.datatype.normal.MyObject.
          at org.apache.cxf.jaxrs.client.ClientProxyImpl$BodyWriter.handleMessage(ClientProxyImpl.java:523)
          at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
          at org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:438)
          at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:177)
          at $Proxy13.execute(Unknown Source)
          at com.company.JaxTestClient.main(JaxTestClient.java:26)
      

      Other competing libraries (such as Restlet) support automatic type mapping out of the box via XStream and Jackson. Given CXF's compliance to JAX-RS it would be helpful if this boilerplate type code were given out of the box too.

      See here for more information:
      http://stackoverflow.com/questions/6312030/cxf-no-message-body-writer-found-for-class-automatically-mapping-non-simple-re

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            selliott Shaun Elliott
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: