Mule - 文件和https端点冲突

时间:2015-07-07 16:10:16

标签: https mule

我在骡子遇到以下问题。这是我的流程定义:

<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>

我在某个网址上读取了请求,我想将该消息记录到文件系统上的Requests文件夹中。 我使用2-WAY SSL将消息发送到HTTPS端点。 然后我得到响应并将其记录到文件系统上的Responses文件夹中。

如果删除以下行,一切正常:

<file:outbound-endpoint path="${hip.home.dir}/online/Requests" responseTimeout="10000"/>

然后,有效负载仅用于发送到https出站端点。

当指定文件outbound-endpoint组件时,会记录请求文件,但在日志中遇到以下异常:

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)

有没有办法让这成为可能?要一起使用文件:outbound-endpoint和https:outbound-endpoint?

1 个答案:

答案 0 :(得分:1)

我认为问题来自file:outbound-endpoint消耗servlet:inbound-endpoint产生的输入,从而阻止https:outbound-endpoint读取流。

添加:

<object-to-string-transformer />

servlet:inbound-endpoint之后将输入流反序列化为字符串,以便filehttp出站端点都可以使用消息有效负载。