Mule 4接收multipart/mixed payload为空及边界缺失问题排查
问题:Mule 4接收multipart/mixed请求时Payload为空且报边界缺失错误
背景
我需要向外部API发送multipart/mixed请求,因此搭建了一个Mule 4流,配置端点接收对应格式的Payload(匹配Postman中的请求内容),但遇到Payload为空和边界缺失的错误。使用的Mule runtime版本为4.4.0-20211227。
Mule流XML代码
<?xml version="1.0" encoding="UTF-8"?> <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd"> <http:listener-config name="HTTP_Listener_config" doc:name="HTTP_Listener_config" doc:id="d8e92a34-d34d-4e1a-abec-7405b9010241"> <http:listener-connection host="0.0.0.0" port="8081" /> </http:listener-config> <flow name="testmultipart-flow" doc:id="d8e92a34-d34d-4e1a-bce3-7405b9010241"> <http:listener doc:name="Listener" doc:id="88476dbb-04af-429d-83f3-20714be8d406" config-ref="HTTP_Listener_config" path="/multi" outputMimeType="multipart/mixed; boundary=batch" /> <logger level="INFO" doc:name="Logger" doc:id="ccde0f6d-cc70-4b05-a68c-60f644381b1e" message="Payload: #[payload]" /> <ee:transform doc:name="Multipart payload" doc:id="bfeeab27-6f01-4ea1-a46a-1a65c5aa0021"> <ee:message> <ee:set-payload><![CDATA[%dw 2.0 output application/json --- payload]]></ee:set-payload> </ee:message> </ee:transform> </flow> </mule>
发起请求的Curl命令
curl --location 'http://0.0.0.0:8081/multi/' \ --header 'Content-Type: multipart/mixed; boundary=batch' \ --header 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \ --data '--batch Content-Type: application/http Content-Transfer-Encoding: binary GET TDTREESET?$filter=(Field1%20eq%20'\''213123'\'')&format=xml HTTP/1.1 --batch-'
问题现象
- 请求发起后,Mule流接收的Payload为空,调试模式中无Payload内容
- 调试信息:
payload = ^mediaType = multipart/mixed; charset=UTF-8; boundary=batch
- 流执行结束时的错误:
"javax.mail.internet.ParseException - Missing start boundary javax.mail.internet.ParseException: Missing start boundary...
疑问
- 如何在Mule流中获取请求发送的原始文本Payload?
- 已在Listener中设置边界为
batch,为何仍会出现边界缺失的错误?
内容的提问来源于stack exchange,提问作者Dan
相关产品推荐
相关产品推荐

