camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bijoy <bijoy.chaudh...@gmail.com>
Subject Re: Issues with cxfrs using json
Date Fri, 28 Mar 2014 14:38:01 GMT
Yes Sergey, what you pointed is right.

I was trying to parse the CxfXmlMessage object which resides in the header
and that itself was null. So, the problem is with service definition
signature.

Can you please suggest how to pass the input json to request body?

Thanks a lot!

Regards,
Bijoy


On Fri, Mar 28, 2014 at 7:51 PM, Sergey Beryozkin-3 [via Camel] <
ml-node+s465427n5749504h54@n5.nabble.com> wrote:

> 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.
> >
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/Issues-with-cxfrs-using-json-tp5749474p5749504.html
>  To unsubscribe from Issues with cxfrs using json, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5749474&code=Ymlqb3kuY2hhdWRodXJ5QGdtYWlsLmNvbXw1NzQ5NDc0fC0xODQ1MjQzMTU1>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/Issues-with-cxfrs-using-json-tp5749474p5749506.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message