Post file from mule to API - mule

I am submitting a file to a third party api. I can make the request using postman, and the third party accepts the response:
my mule flow starts with a http request, and I am able to send the file in the message.inboundAttachments dictionary, but I am not sure how to build the request to the third party in a mule flow. When I try to set the message.InboundAttachment['Contract'] item into the payload, I just get a generic message:
"Error sending HTTP request. Message payload is of type: DataHandler"
I am not sure what is failing.
update below is a screenshot of the part of the flow I attempted with using the attachment component:
the attachment component looks like the following:
<set-attachment attachmentName="#[message.inboundAttachments.Contract.dataSource.part.fileName]" value="#[message.inboundAttachments['Contract'].getInputStream()]" contentType="multipart/form-data" doc:name="Attaching Contract"/>
I am getting the following error though when I attempt to send this:
> ERROR 2016-05-03 11:26:45,597
> [[pan.internal.api].api-httpListenerConfig.worker.01]
> org.mule.exception.DefaultMessagingExceptionStrategy:
> ******************************************************************************** Message : Error sending HTTP request. Message payload is
> of type: NullPayload Type :
> org.mule.api.MessagingException Code : MULE_ERROR--2
> JavaDoc :
> http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html
> Payload : {NullPayload}
> ******************************************************************************** Exception stack is:
> 1. Remotely closed (java.io.IOException)
> 2. java.io.IOException: Remotely closed (java.util.concurrent.ExecutionException)
> org.glassfish.grizzly.impl.SafeFutureImpl$Sync:349 (null)
> 3. java.util.concurrent.ExecutionException: java.io.IOException: Remotely closed (java.io.IOException)
> org.mule.module.http.internal.request.grizzly.GrizzlyHttpClient:245
> (null)
> 4. Error sending HTTP request. Message payload is of type: NullPayload (org.mule.api.MessagingException)
> org.mule.module.http.internal.request.DefaultHttpRequester:287
> (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
> ******************************************************************************** Root Exception stack trace: java.io.IOException: Remotely closed
>
> ********************************************************************************
I have also tried to clear the Attachment Content Type field, but it seems to be required, and raises an error as well. Any ideas?

You don't need to add the attachment as payload for the request, what you need to do is move it from InboundAttachments to OutboundAttachments. The requester component will detect there are OutboundAttachments present and perform a multipart/form-data request with them.
HTH
update
the copy-attachments will correctly set the content-length and pass through the contents, rather than setting the attachment:
<copy-attachments attachmentName="Contract" doc:name="Attaching Contract" />

Related

OAUth2.0: WSO2 Identity server as a key manager in wso2 API Manager

I am using WSO2 Identity server as a key manager in WSO2 API manager. I am creating sample playground app with OAuth2.0 flow with WSO2 API manager.I have added new app in API store and generated consumer key and consumer secret.
steps:
Run Sample playground app -localhost:8080/playground2
Playground app home page
Click on Image we will go to oauth2.jsp page
here we have to fill:
response_type = code
client_id = VALUE_OF_CONSUMER_KEY
redirect_uri = REDIRECT_URL_OF_THE_APPLICATION
scope = SCOPE_OF_THE_ACCESS_REQUEST
Authorize
On Clicking Authorize button The application (client) requests an authorization code from the authorization server(WSO2 identity server) by sending a HTTP GET request with the following query parameters.
response_type = code
client_id = VALUE_OF_CONSUMER_KEY
redirect_uri = REDIRECT_URL_OF_THE_APPLICATION
scope = SCOPE_OF_THE_ACCESS_REQUEST
and it displays consent page
Consent page
when we click approve it redirects to wso2 login page
Login page
After entering credentials it gives following error: AfterLogin Error
HTTP Status 500 - org.apache.cxf.interceptor.Fault
type Exception report
message org.apache.cxf.interceptor.Fault
description The server encountered an internal error that prevented it from fulfilling this request.
exception
java.lang.RuntimeException: org.apache.cxf.interceptor.Fault
org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:116)
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:336)
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249)
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209)
javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:120)
root cause
org.apache.cxf.interceptor.Fault
org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:170)
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:136)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101)
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249)
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209)
javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:120)
root cause
java.lang.NullPointerException
org.wso2.carbon.identity.oauth.endpoint.authz.OAuth2AuthzEndpoint.authorize(OAuth2AuthzEndpoint.java:251)
org.wso2.carbon.identity.oauth.endpoint.authz.OAuth2AuthzEndpoint.sendRequestToFramework(OAuth2AuthzEndpoint.java:1163)
org.wso2.carbon.identity.oauth.endpoint.authz.OAuth2AuthzEndpoint.authorize(OAuth2AuthzEndpoint.java:135)
org.wso2.carbon.identity.oauth.endpoint.authz.OAuth2AuthzEndpoint.authorizePost(OAuth2AuthzEndpoint.java:574)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:188)
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204)
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101)
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249)
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209)
javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:120)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.73 logs.
Apache Tomcat/7.0.73
In API Manager console it is giving following error:
I.
ERROR - AMDefaultKeyManagerImpl Can not retrieve OAuth application for the given consumer key : PBMTE1piS4sKNdn2HdsJAbMeCQga
org.apache.axis2.AxisFault: Access Denied. Authentication failed - System error occurred. Please check server logs for more details.
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
II.
[2017-03-10 11:48:21,226] ERROR - item-info:jag org.wso2.carbon.apimgt.api.APIManagementException: Can not retrieve OAuth application for the given consumer key : PBMTE1piS4sKNdn2HdsJAbMeCQga
[2017-03-10 11:48:49,063] WARN - APIAuthenticationHandler API authentication failure due to Unclassified Authentication Failure
[2017-03-10 11:49:02,990] INFO - TimeoutHandler This engine will expire all callbacks after GLOBAL_TIMEOUT: 120 seconds, irrespective of the timeout action, after the specified or optional timeout
[2017-03-10 11:49:30,889] INFO - DependencyTracker Local entry : gov:/apimgt/statistics/ga-config.xml was added to the Synapse configuration successfully
[2017-03-10 11:49:31,028] INFO - JMSConnectionFactory JMS ConnectionFactory : jmsEventPublisher initialized
[2017-03-10 11:49:32,336] INFO - AMQConnection Unable to connect to broker at tcp://localhost:5672
org.wso2.andes.transport.TransportException: Could not open connection
at org.wso2.andes.transport.network.mina.MinaNetworkTransport$IoConnectorCreator.connect(MinaNetworkTransport.java:216)
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.connect(MinaNetworkTransport.java:74)
at org.wso2.andes.client.AMQConnectionDelegate_8_0.makeBrokerConnection(AMQConnectionDelegate_8_0.java:130)
at org.wso2.andes.client.AMQConnection$2.run(AMQConnection.java:631)
at org.wso2.andes.client.AMQConnection$2.run(AMQConnection.java:628)
at java.security.AccessController.doPrivileged(Native Method)
at org.wso2.andes.client.AMQConnection.makeBrokerConnection(AMQConnection.java:628)
at org.wso2.andes.client.AMQConnection.<init>(AMQConnection.java:409)
at org.wso2.andes.client.AMQConnectionFactory.createConnection(AMQConnectionFactory.java:351)
III.
org.wso2.andes.AMQConnectionFailureException: Could not open connection
at org.wso2.andes.client.AMQConnection.<init>(AMQConnection.java:486)
at org.wso2.andes.client.AMQConnectionFactory.createConnection(AMQConnectionFactory.java:351)
IV.
Caused by: org.wso2.andes.transport.TransportException: Could not open connection
at org.wso2.andes.transport.network.mina.MinaNetworkTransport$IoConnectorCreator.connect(MinaNetworkTransport.java:216)
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.connect(MinaNetworkTransport.java:74)
V.
[2017-03-10 11:49:32,345] ERROR - JMSConnectionFactory Error acquiring a Connection from the JMS CF : jmsEventPublisher using properties : {transport.jms.ConcurrentPublishers=allow, java.naming.provider.url=repository/conf/jndi.properties, java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory, transport.jms.DestinationType=topic, transport.jms.ConnectionFactoryJNDIName=TopicConnectionFactory, transport.jms.Destination=throttleData}
javax.jms.JMSException: Error creating connection: Could not open connection
at org.wso2.andes.client.AMQConnectionFactory.createConnection(AMQConnectionFactory.java:361)
at org.wso2.andes.client.AMQConnectionFactory.createConnection(AMQConnectionFactory.java:40)
VI.
[2017-03-10 11:49:32,350] ERROR - JMSConnectionFactory Error acquiring a Connection from the JMS CF : jmsEventPublisher using properties : {transport.jms.ConcurrentPublishers=allow, java.naming.provider.url=repository/conf/jndi.properties, java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory, transport.jms.DestinationType=topic, transport.jms.ConnectionFactoryJNDIName=TopicConnectionFactory, transport.jms.Destination=throttleData}
org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterRuntimeException: Error acquiring a Connection from the JMS CF : jmsEventPublisher using properties : {transport.jms.ConcurrentPublishers=allow, java.naming.provider.url=repository/conf/jndi.properties, java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory, transport.jms.DestinationType=topic, transport.jms.ConnectionFactoryJNDIName=TopicConnectionFactory, transport.jms.Destination=throttleData}
at org.wso2.carbon.event.output.adapter.jms.internal.util.JMSConnectionFactory.handleException(JMSConnectionFactory.java:197)
Please help me to solve this issue.

"Remotely closed" when I try to send REST with HTTPS in Mule

I have a simple REST HTTPS GET, the uri of it is like that:
https://mytest.test:443/nccpointshop/REST/giftcard/giftcards/list/currency/SEK
which works perfectly to run in a browser, Postman, etc. With Mule 3.8 HTTP I select the uri from the RAML generataed specification, set uri-param and still I am getting an exception :
DEBUG 2016-06-28 16:38:35,321 [[svc0014_loyalty].http.requester.ODP_Request_Configuration(1) SelectorRunner] com.ning.http.client.providers.grizzly.AsyncHttpClientFilter: REQUEST: HttpRequestPacket (
method=GET
url=/nccpointshop/REST/giftcard/giftcards/list/currency/SEK
query=null
protocol=HTTP/1.1
content-length=-1
headers=[
Host=correct.host:443
User-Agent=AHC/1.0
Connection=keep-alive
Accept=*/*]
)
DEBUG 2016-06-28 16:38:35,322 [[svc0014_loyalty].http.requester.ODP_Request_Configuration(1) SelectorRunner] org.mule.module.http.internal.HttpMessageLogger: REQUESTER
GET /nccpointshop/REST/giftcard/giftcards/list/currency/SEK HTTP/1.1
Host: correct.host:443
User-Agent: AHC/1.0
Connection: keep-alive
Accept: */*
DEBUG 2016-06-28 16:38:35,498 [[svc0014_loyalty].http.requester.ODP_Request_Configuration.worker(8)] com.ning.http.client.AsyncCompletionHandlerBase: Remotely closed
java.io.IOException: Remotely closed
DEBUG 2016-06-28 16:38:35,520 [[svc0014_loyalty].svc0014_loyalty-httpListenerConfig.worker.02] com.mulesoft.mule.debugger.server.DebuggerMuleNotificationHandlerImpl: MESSAGE_PROCESSOR_POST_INVOKE -> Path /get:\/giftcards:svc0014_loyalty-config/processors/2
DEBUG 2016-06-28 16:38:37,327 [[svc0014_loyalty].Mule.01] com.mulesoft.mule.debugger.server.DebuggerMuleNotificationHandlerImpl: Notification 2001 was received ef4625b0-3d3d-11e6-998f-448500a727fa
ERROR 2016-06-28 16:38:37,329 [[svc0014_loyalty].svc0014_loyalty-httpListenerConfig.worker.02] org.mule.module.apikit.MappingExceptionListener:
********************************************************************************
Message : Error sending HTTP request. Message payload is of type: NullPayload
Type : org.mule.api.MessagingException
Code : MULE_ERROR-29999
Payload : {NullPayload}
JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html
********************************************************************************
Exception stack is:
1. Remotely closed (java.io.IOException)
2. java.io.IOException: Remotely closed (java.util.concurrent.ExecutionException)
org.glassfish.grizzly.impl.SafeFutureImpl$Sync:349 (null)
3. java.util.concurrent.ExecutionException: java.io.IOException: Remotely closed (java.io.IOException)
org.mule.module.http.internal.request.grizzly.GrizzlyHttpClient:245 (null)
4. Error sending HTTP request. Message payload is of type: NullPayload (org.mule.api.MessagingException)
org.mule.module.http.internal.request.DefaultHttpRequester:287 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
********************************************************************************
Root Exception stack trace:
java.io.IOException: Remotely closed
********************************************************************************
I am attaching a picture of how my configuration looks like
The thing with Mule HTTP connector is that it adds host and port from the associated configuration always as a header:
headers=[
Host=correct.host:443
Some systems do not allow that, they do not accept adding the port (in our case the port is dynamically allocated in the backend system).
So, this request: https://correct.host:443/nccpointshop/REST/giftcard/giftcards/list/currency/SEK
is invalid, but this one is valid:
https://correct.host/nccpointshop/REST/giftcard/giftcards/list/currency/SEK
This is hard to notice and catch, as Postman and Chrome will both send correct requests. I recommend using some other tool like SoapUI (I noticed it with it).
However, there is a way to overwrite the value for the "Host" in the headers like this:
<http:request config-ref="HTTP_Request_Configuration1" path="/nccpointshop/REST/giftcard/giftcards/list/currency/SEK" method="GET" doc:name="Copy_of_HTTP">
<http:request-builder>
<http:header headerName="Host" value="correct.host"/>
</http:request-builder>
</http:request>

mule ce 3.7.0 Exception when sending http-request - Timeout exceeded (java.util.concurrent.TimeoutException)

I'm trying to send a http request from my jax-ws client to my own jaw-ws service. I've generated classes from wsdl and sending an ArrayList of objects with 60 items in it. But i'm getting exception.
Exception stack is:
1. Timeout exceeded (java.util.concurrent.TimeoutException)
com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider:426 (null)
2. Error sending HTTP request. Message payload is of type: byte[] (org.mule.api.MessagingException)
org.mule.module.http.internal.request.DefaultHttpRequester:287 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule
/api/MessagingException.html)
Root Exception stack trace:
java.util.concurrent.TimeoutException: Timeout exceeded
at com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider.timeout(GrizzlyAsyncHttpProvider.java:426)
at com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider$3.onTimeout(GrizzlyAsyncHttpProvider.java:274)
at org.glassfish.grizzly.utils.IdleTimeoutFilter$DefaultWorker.doWork(IdleTimeoutFilter.java:398)
at org.glassfish.grizzly.utils.IdleTimeoutFilter$DefaultWorker.doWork(IdleTimeoutFilter.java:377)
at org.glassfish.grizzly.utils.DelayedExecutor$DelayedRunnable.run(DelayedExecutor.java:158)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Anyone has a solution for this?
I had the same problem and I solved using the parameter responseTimeout in the HTTP-Request configuration:
<http:request-config responseTimeout="30000" {more parameters...} />
Set the value (in ms) to the time that you think best.

Message Processor unable to send message from message store to endpoint in wso2 esb

I am getting the following error while my message processor trying to send the message from the message store.
content type used in proxy:
<property name="CONTENT_TYPE" value="appliaction/soap+xml" scope="axis2" />
error in esb log:
ERROR {org.apache.synapse.message.processor.impl.forwarder.ForwardingService} - BlockingMessageSender of message processor [My_Processor] failed to send message to the endpoint {org.apache.synapse.message.processor.impl.forwarder.ForwardingService}
WARN {org.apache.synapse.message.processor.impl.forwarder.ForwardingService} - Failed to send the message through the fault sequence, Sequence name null does not Exist. {org.apache.synapse.message.processor.impl.forwarder.ForwardingService}
I have changed my content type but now getting another error. Find the error log :
ERROR {org.apache.synapse.message.senders.blocking.BlockingMsgSender} - Error sending Message to url : http://localhost:9000/services/SimpleStockQuoteService {org.apache.synapse.message.senders.blocking.BlockingMsgSender}
org.apache.axis2.AxisFault: Read timed out
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:451)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:278)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.synapse.message.senders.blocking.BlockingMsgSender.sendRobust(BlockingMsgSender.java:198)
at org.apache.synapse.message.senders.blocking.BlockingMsgSender.send(BlockingMsgSender.java:144)
at org.apache.synapse.message.processor.impl.forwarder.ForwardingService.dispatch(ForwardingService.java:288)
at org.apache.synapse.message.processor.impl.forwarder.ForwardingService.execute(ForwardingService.java:128)
at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)
at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)
at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1413)
at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)
at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:622)
at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
... 12 more

Carriage return "%0A" in ActiveMQ/Camel message raise an exception

I'm working on an API for my website, using ActiveMQ and Camel in order iPhones to connect via Stomp protocol.
The body of the message is a JSON with different parameters that I will then pass to a PHP web app, for example Post data, and so on.
We got a form on the iphone, with a "textarea". If I submit a simple line, without carriage returns, ActiveMQ and Camel handle it, pass it to my PHP app which save it in DB, and everything is fine.
But when there is a carriage return in the textarea value, encoded as "%0A", ActiveMQ raises an exception, and the PHP app is not called.
In my apache error log, I only have this line :
[Mon May 14 16:08:54 2012] [error] [client 127.0.0.1] An URL must be provided
In my ActiveMQ log I have (I havent pasted all of it, only the first raise) :
2012-05-14 16:42:22,038 | DEBUG | Caused by: [org.apache.camel.RuntimeCamelException - org.apache.camel.component.http.HttpOperationFailedException: HTTP operation failed invoking http//localapi:80/api_dev.php/dispatcher with statusCode: 500] | org.apache.camel.component.jms.EndpointMessageListener | Camel (camel) thread #0 - JmsConsumer[query]
org.apache.camel.RuntimeCamelException: org.apache.camel.component.http.HttpOperationFailedException: HTTP operation failed invoking http//localapi:80/api_dev.php/dispatcher with statusCode: 500
at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1139)
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:115)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:560)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:498)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1056)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1048)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)
Caused by: org.apache.camel.component.http.HttpOperationFailedException: HTTP operation failed invoking http//localapi:80/api_dev.php/dispatcher with statusCode: 500
at org.apache.camel.component.jetty.DefaultJettyHttpBinding.populateHttpOperationFailedException(DefaultJettyHttpBinding.java:143)
at org.apache.camel.component.jetty.DefaultJettyHttpBinding.populateResponse(DefaultJettyHttpBinding.java:61)
at org.apache.camel.component.jetty.JettyContentExchange.doTaskCompleted(JettyContentExchange.java:149)
at org.apache.camel.component.jetty.JettyContentExchange.onResponseComplete(JettyContentExchange.java:86)
at org.eclipse.jetty.client.HttpExchange$Listener.onResponseComplete(HttpExchange.java:887)
at org.eclipse.jetty.client.HttpExchange.setStatus(HttpExchange.java:258)
at org.eclipse.jetty.client.HttpConnection$Handler.messageComplete(HttpConnection.java:580)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:314)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:211)
at org.eclipse.jetty.client.HttpConnection.handle(HttpConnection.java:254)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:506)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
... 1 more
The message's body looks like :
Message:
body={
"session_id":"XXXX",
"method":"post",
"params":{
"post":{
"form_name":{
"field_name":"foo%0Abar"
}
}
},
"url":"/my_object/update",
"query_id":"XXX"
}
My ActiveMQ conf is made with Spring, as I'm not too much (at all) into Java
Thank you for any clue