Hi

Right I've just spotted it,

@Path("/orders/{orderId}")
public class RestServices {
    @POST
    @Consumes("application/json")
    @Produces("application/json")
    @Path("/delta")
    public Response createDelta() {
           return null;
    }
}

You don't have a parameter representing the request body, so what exactly the runtime can set as the exchange body in this case ?

The input stream representing the JSON sequence should be accessible though, can you access InputStream or if no actual read has occurred then InputStream is supposed to represent the body ?

Thanks, Sergey

On 28/03/14 12:13, bijoy wrote:
Sergey,

Thanks for your assistance!

I have added jettison dependency but still the same exception was being
thrown. The I made following changes to configuration file which did not
throw any startup errors.

*camel-config.xml*
<cxf:rsServer id="restServer" address=""

serviceClass="com.ericsson.bss.edm.rerating.stub.ReratingServices"
                loggingFeatureEnabled="true" />
<import resource="classpath:META-INF/cxf/cxf.xml" />












This configuration works but still input json is not mapped to exchange
body, though output pojo to json mapping is working and being sent to client
properly. Following is message history...


Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId              ProcessorId          Processor
Elapsed (ms)
[httpRequest       ] [httpRequest       ]
[cxfrs://bean://restServer?bindingStyle=SimpleConsumer
] [        62]
[httpRequest       ] [to1               ] [log:?showAll=true
] [         6]
[httpRequest       ] [process3          ] [ref:processRequest
] [         6]

Exchange
---------------------------------------------------------------------------------------------------------------------------------------
Exchange[
         Id                  ID-PG85238-43050-1395997134260-0-2
         ExchangePattern     InOut
         Headers
{breadcrumbId=ID-PG85238-43050-1395997134260-0-1,
CamelAcceptContentType=*/*,
CamelCxfMessage=org.apache.cxf.message.XMLMessage@84f9cd67,
CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@5ce5ef67],
CamelCxfRsResponseClass=class javax.ws.rs.core.Response,
CamelCxfRsResponseGenericType=class javax.ws.rs.core.Response,
CamelHttpCharacterEncoding=ISO-8859-1, CamelHttpMethod=POST,
CamelHttpPath=/orders/4001/delta, CamelHttpUri=/orders/4001/delta,
CamelRedelivered=false, CamelRedeliveryCounter=0, connection=keep-alive,
Content-Length=100, content-type=application/json, Host=localhost:42107,
operationName=createDelta, orderId=4001}
         BodyType            org.apache.cxf.message.MessageContentsList
         Body                []
]

Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
java.lang.NullPointerException: null



Not sure why input json in not being mapped to pojo. One thing,
CamelCxfMessage is referring to XMLMessage even though the content-type is
application/json. Not sure if this should help in tracing the problem.





--
View this message in context: 
http://camel.465427.n5.nabble.com/Issues-with-cxfrs-using-json-tp5749474p5749498.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Reply via email to