让mule调用需要多部分/表单数据的http进程

让mule调用需要多部分/表单数据的http进程,mule,Mule,我有一个需要多部分/表单数据的后端进程。我想让mule调用它并返回结果。这是一个我设计的简单流程。但是,出站端点不会将消息转换为多部分/表单数据。后端进程只获取最初发布的主体 我做错了什么 <flow name="testFlow"> <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" mimeType="text/plain" contentTy

我有一个需要多部分/表单数据的后端进程。我想让mule调用它并返回结果。这是一个我设计的简单流程。但是,出站端点不会将消息转换为多部分/表单数据。后端进程只获取最初发布的主体

我做错了什么

<flow name="testFlow">
    <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" mimeType="text/plain" contentType="text/plain" />
    <message-properties-transformer>
        <add-message-property key="f" value="#[payload:java.lang.String]"/>
    </message-properties-transformer>
    <http:outbound-endpoint exchange-pattern="request-response" host="x12backend" port="9877" path="dummy.php" contentType="multipart/form-data"/>
</flow>

只有带有附件的邮件才会自动转换为多部分请求实体,因此您最好:

  • 将消息有效负载移动到出站附件:附件名称将用于部件名称。使用
    设置附件
    设置有效负载
    消息处理器或Groovy transformer
  • 将消息payload设置为org.mule.transport.NullPayload(使用
    Set payload
    #[null]
    表达式,否则它将在名为“payload”的部分中再次发布

谢谢,如果Mule ESB有更标准的方法来实现这一点,有什么想法吗?是的,我回顾了我的答案,建议使用标准消息处理器而不是Groovy。