Reputation: 5105
I'm encountering the following problem in mule. This is my flow definition:
<flow name="httpsTestConnection" processingStrategy="synchronous">
<servlet:inbound-endpoint path="/httpsTestConnection" responseTimeout="10000" />
<file:outbound-endpoint path="${hip.home.dir}/online/Requests" responseTimeout="10000"/>
<https:outbound-endpoint exchange-pattern="request-response" address="${test.connection.service.url}" http:contentType="text/xml" http:method="POST" connector-ref="httpsClientConnector"/>
<object-to-string-transformer />
<file:outbound-endpoint path="${hip.home.dir}/online/Responses" responseTimeout="10000"/>
</flow>
I read a request on a certain url, I want to log the message to the Requests folder on the file system. I send the message to an HTTPS endpoint using 2-WAY SSL. Afterwards I get the response and log it to the Responses folder on the file system.
Everything works fine if I remove the following line:
<file:outbound-endpoint path="${hip.home.dir}/online/Requests" responseTimeout="10000"/>
Then the payload is just used to send to the https outbound endpoint.
When the file outbound-endpoint component is specified, the request file is logged, but in the logs I encounter the following exception:
Caused by: java.lang.IllegalStateException: Content must be set before entity is written
at org.apache.commons.httpclient.methods.InputStreamRequestEntity.writeRequest(InputStreamRequestEntity.java:177)
at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
Is there a way to make this possible? To use the file:outbound-endpoint and the https:outbound-endpoint together?
Upvotes: 0
Views: 544
Reputation: 33413
I believe the issue comes from the fact the file:outbound-endpoint
consumes the input produced by the servlet:inbound-endpoint
, thus preventing the https:outbound-endpoint
to read the stream.
Add:
<object-to-string-transformer />
right after the servlet:inbound-endpoint
to deserialize the inputstream to a string so the message payload can be used by both the file
and http
outbound endpoints.
Upvotes: 1