Hi,
Can you place a log endpoint with the showAll option set to true just
after
this line?
<log message="**************** Got Body 555 : ${body}" />
e.g. <to uri="log:TEST?showAll=true" />.
I want to see exactly what the route returns to the CXF stack.
Thanks,
*Raúl Kripalani*
Enterprise Architect, Open Source Integration specialist, Program
Manager | Apache
Camel Committer
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk
On Fri, Jul 5, 2013 at 5:18 PM, ajaysam <[hidden
email]<http://user/SendEmail.jtp?type=node&node=5735205&i=0>>
wrote:
Attached are two projects - both are maven projects
One is camel project that makes a call to a service which is another
project
The servvice that Camel calls is a stubbed version of real service.
The url to invoke the camel project is
Testing through Curl : C:\curl-7.30.0-ssl-sspi-zlib-static-bin-w32>curl
-HAccept:application/json
http://localhost:8080/CamelCXFREST-0.0.1-SNAPSHOT/webservices/Hello/States
And the output is XML - but we were expecting json.
Any help or tips or lead to debug this problem will be help us a lot.
I am trying to push Camel in my organization and these small issues
become
a show stopper for us.
As of now the way we got it working - temporary soln - is we added a
marshal step after response processor that uses json library to convert
to
JSON- this is explicit step done by camel - which we dont want to- we
wanted Camel taking CXF help / configuration to understand that it needs
json output and convert it - rather than Camel bypassing CXF. Anyway we
did
that on our project - you will not see that last step in this project
Thanks
Ajay
On Tue, Jul 2, 2013 at 3:37 PM, Christian Mueller [via Camel] <
[hidden email] <http://user/SendEmail.jtp?type=node&node=5735205&i=1>>
wrote:
Sure, this will help to digging into the issue.
Best,
Christian
Sent from a mobile device
Am 02.07.2013 20:19 schrieb "ajaysam" <[hidden email]<
http://user/SendEmail.jtp?type=node&node=5735092&i=0>>:
Can i send you my maven projects ?
you can take a look at it high level and see if i m really missing
something basic
On Mon, Jul 1, 2013 at 4:00 PM, Sergey Beryozkin-3 [via Camel] <
[hidden email] <http://user/SendEmail.jtp?type=node&node=5735092&i=1>>
> > wrote:
This is bizarre...Can you please double check the custom code you
may
have and see if "application/xml" is 'hiding somewhere' ? Can you
do
a
sanity check and confirm it is this endpoint which is being
invoked
after all ?
Any chance you can attach a working route (test) to JIRA ?
Cheers, Sergey
On 01/07/13 17:19, ajaysam wrote:
application/xml always works..
even if i am saying Produces json i still get output as xml
On Mon, Jul 1, 2013 at 12:01 PM, Sergey Beryozkin-3 [via Camel]
<
[hidden email] <
http://user/SendEmail.jtp?type=node&node=5735057&i=0>>
> > wrote:
So, if you replace all of @Produces("application/json") with
@Produces("application/xml")
and do
curl -HAccept:application/xml ...
then it works ?
Sergey
On 01/07/13 16:40, ajaysam wrote:
I am sending the request through curl - it is setting Accept
header
as
shown
below
curl -HAccept:application/json
http://pocman2.nsp.stf.bms.com:8080/CXF_REST-0.0.1-SNAPSHOT/webservices/Hello/SilpaY
Hello is the path to refer to resource class
We are stuck in this project and any help will be appreciated.
At high level this is what the project is about
1. Camel exposes a REST endpoint thru CXFRS - this part works
2. We get the request data in POJO format - camel makes SOAP
call
to
another
web service passing this POJO
3. We get the response back from that service
4. Response POJO needs to be converted to JSON
As of now as a workaround in last step - we are using marshal
step
of
camel
to explicitly convert from POJO to JSON - and that works - but
we
dont
want
to do it that way
We thought just doing return Response.ok(resp).build(); from
Processor
should work
We did all the configuration required as explained in article
Our resource class says @Produces MediaType.Application_JSON
Also provided the json provider to cxfrs configuration
Now what else needs to be done?
Can i send the application-context.xml file and Resource file
to
you
somehow..maybe i m missing something fundamental
attached is the xml section
- <util:list id="jsonTypes">
<value>application/json</value>
</util:list>
- <bean id="cxfJaxrsJsonProvider"
class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
<property name="namespaceMap" ref="jsonNamespaceMap" />
<property name="produceMediaTypes" ref="jsonTypes" />
</bean>
<bean id="restResource" class="com.bms.web.HelloResource"
/>
- <jaxrs:server id="restService"
staticSubresourceResolution="true">
- <jaxrs:serviceBeans>
<ref bean="restResource" />
</jaxrs:serviceBeans>
- <jaxrs:providers>
<ref bean="cxfJaxrsJsonProvider" />
<bean
class="org.apache.cxf.jaxrs.provider.JAXBElementProvider"
/>
</jaxrs:providers>
</jaxrs:server>
<bean id="restRespProcessor"
class="com.bms.web.RESTResponseProcessor"
/>
<cxf:rsServer id="HelloRsServer"
serviceClass="com.bms.web.HelloResource"
loggingFeatureEnabled="true" />
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route id="restToSoap" streamCache="true">
<from
uri="cxfrs://bean://HelloRsServer?bindingStyle=SimpleConsumer"
/>
<log message="**************** Got ${headers}" />
<log message="**************** Got Body 111 : ${body}"
/>
<to uri="bean:reqProcessor" />
<log message="**************** Got Headers 222 :
${headers}"
/>
<log message="**************** Got Body 333 : ${body}"
/>
<to uri="cxf:bean:target_hello"/>
<log message="**************** Got Body 444 : ${body}"
/>
<to uri="bean:restRespProcessor" />
<log message="**************** Got Body 555 : ${body}"
/>
</route>
</camelContext>
the the response processor does this
MessageContentsList msgList =
(MessageContentsList)exchg.getIn().getBody();
GetReferenceDataResponse resp = (GetReferenceDataResponse)
msgList.get(0);
exchg.getOut().setBody(Response.ok(resp).build());
Resource File is
@Path("/Hello")
@Produces({"application/json"})
public class HelloResource {
public HelloResource() {}
@GET
@Path("/{referenceTypeName}")
//@Produces({MediaType.APPLICATION_XML,
MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public Response getMessage(
@PathParam("referenceTypeName") String name, @QueryParam("")
ReferenceDataRequest query) {
System.out.println("Hello, i am here !!! In HelloResource
.......
updated
7.1.13");
return null;
}
}
--
View this message in context:
http://camel.465427.n5.nabble.com/Camel-CXFRS-endpoint-unable-to-produce-JSON-tp5734967p5735046.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/Camel-CXFRS-endpoint-unable-to-produce-JSON-tp5734967p5735049.html
To unsubscribe from Camel CXFRS endpoint unable to produce
JSON,
click
here<
.
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/Camel-CXFRS-endpoint-unable-to-produce-JSON-tp5734967p5735050.html
Sent from the Camel - Users mailing list archive at Nabble.com.
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com
------------------------------
If you reply to this email, your message will be added to the
discussion
below:
http://camel.465427.n5.nabble.com/Camel-CXFRS-endpoint-unable-to-produce-JSON-tp5734967p5735057.html
To unsubscribe from Camel CXFRS endpoint unable to produce JSON,
click
here<
.
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/Camel-CXFRS-endpoint-unable-to-produce-JSON-tp5734967p5735089.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/Camel-CXFRS-endpoint-unable-to-produce-JSON-tp5734967p5735092.html
To unsubscribe from Camel CXFRS endpoint unable to produce JSON,
click
here<
.
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
CamelCXFREST.zip (609K) <
http://camel.465427.n5.nabble.com/attachment/5735203/0/CamelCXFREST.zip>
RDMReferenceDataService.zip (604K) <
http://camel.465427.n5.nabble.com/attachment/5735203/1/RDMReferenceDataService.zip
--
View this message in context:
http://camel.465427.n5.nabble.com/Camel-CXFRS-endpoint-unable-to-produce-JSON-tp5734967p5735203.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/Camel-CXFRS-endpoint-unable-to-produce-JSON-tp5734967p5735205.html
To unsubscribe from Camel CXFRS endpoint unable to produce JSON, click
here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5734967&code=YWpheS5zYW1hbnRAZ21haWwuY29tfDU3MzQ5Njd8LTIxMTkyODAxMA==>
.
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>