[ 
https://issues.apache.org/jira/browse/CAMEL-12149?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16328417#comment-16328417
 ] 

ASF GitHub Bot commented on CAMEL-12149:
----------------------------------------

davsclaus commented on issue #2179: fix CAMEL-12149 ensure the CONTENT_TYPE 
header can be retrieved
URL: https://github.com/apache/camel/pull/2179#issuecomment-358226089
 
 
   Yeah ObjectHelper.isEmpty would also check for an empty string, however not 
sure if you would have a Content-Type header that would be a `""`. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Failed to invoke camel cxfrs client due to Content-Type header couldn't be 
> retrieved and passed
> -----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-12149
>                 URL: https://issues.apache.org/jira/browse/CAMEL-12149
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-cxfrs
>    Affects Versions: 2.19.4, 2.20.1
>            Reporter: Xilai Dai
>            Priority: Major
>
> As of Camel 2.19.x, async support is added by default in the CxfRsProducer. 
> Considering this simple rsClient:
> {code:java}
> <camel-cxf:rsClient id="restClient"
>         address="http://localhost:8040/services/eventlogging/events"; 
> serviceClass="org.talend.esb.eventlogging.sender.rest.EventLogging"
>         loggingFeatureEnabled="true">
>     <camel-cxf:providers>
>         <ref component-id="jsonProvider" />
>     </camel-cxf:providers>
>     <camel-cxf:headers>
>          <entry key="Content-Encoding" value="UTF-8" />
>          <entry key="Content-Type" value="application/json" />
>     </camel-cxf:headers>
> </camel-cxf:rsClient>
> <camel:camelContext>
>     <camel:route>
>         <camel:from uri="timer://foo?repeatCount=1" />
>         <camel:process ref="marshallingPreparationProcessor" />
>         <camel:to uri="cxfrs://bean://restClient" />
>     </camel:route>
> </camel:camelContext>{code}
> It works well with the right Content-Type setting in Camel 
> 2.17.x/Camel.2.18.x, but the Content-Type will be wildcard and "No message 
> body writer has been found ..." will be thrown when invoke the restClient in 
> Camel 2.19.x/2.20.x.
> {code:java}
> ----------------------------
> ID: 1
> Address: http://localhost:8040/services/eventlogging/events
> Http-Method: POST
> Content-Type: */*
> Headers: {Content-Encoding=[UTF-8], Content-Type=[*/*], 
> Content-Language=[en_US], Accept=[*/*]}
> --------------------------------------
> [mel-1) thread #0 - timer://foo] CxfRsProducer                  ERROR Failed 
> request
> javax.ws.rs.ProcessingException: No message body writer has been found for 
> class org.talend.esb.eventlogging.sender.rest.EventList
> , ContentType: */*
>         at 
> org.apache.cxf.jaxrs.client.AbstractClient.reportMessageHandlerProblem(AbstractClient.java:810)
>         at 
> org.apache.cxf.jaxrs.client.AbstractClient.writeBody(AbstractClient.java:497)
>         at 
> org.apache.cxf.jaxrs.client.WebClient$BodyWriter.doWriteBody(WebClient.java:1178)
>         at 
> org.apache.cxf.jaxrs.client.AbstractClient$AbstractBodyWriter.handleMessage(AbstractClient.java:1174)
>         at 
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
>         at 
> org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:677)
>         at 
> org.apache.cxf.jaxrs.client.WebClient.doInvokeAsync(WebClient.java:952)
>         at 
> org.apache.cxf.jaxrs.client.WebClient.doInvokeAsyncCallback(WebClient.java:915)
>         at 
> org.apache.cxf.jaxrs.client.WebClient$AsyncInvokerImpl.method(WebClient.java:1440)
>         at 
> org.apache.camel.component.cxf.jaxrs.CxfRsProducer.invokeAsyncHttpClient(CxfRsProducer.java:175)
>         at 
> org.apache.camel.component.cxf.jaxrs.CxfRsProducer.process(CxfRsProducer.java:116){code}
> ([https://github.com/xldai/test/tree/master/test-cxfrs] is created for easily 
> reproduce this issue)
> A PR is created for fixing this issue.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to