问题描述
我有一个可运行的Web服务,该服务允许我上传文件.我想将Mule 3放在它的前面,但未能成功传递它的MIME类型为"multipart/form-data"的有效载荷.
I have a working Web service that allows me to upload a file. I'd like to put Mule 3 in front of it but I have not been successful in getting it to pass along payloads whose MIME type is "multipart/form-data".
尝试这样做会产生400错误:客户端发送的请求在语法上是错误的(错误请求)."
Attempts to do so produce a 400 error: "The request sent by the client was syntactically incorrect (Bad Request)."
下面的流程(不能实现我的目的,但可以作为测试)可以正常工作,并传递我发布的所有文本.
The following flow (which doesn't accomplish my purpose but serves as a test) works fine, passing along whatever text I POSTed.
<flow name="Flow1" doc:name="Flow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="test/rule_file" mimeType="text/plain" doc:name="HTTP"/>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8080" path="test/rule_file" mimeType="text/plain" doc:name="HTTP"/>
</flow>
但是,当我从文本/纯文本"切换到多部分/表单数据"时,会产生上面列出的错误.
However, when I switch from "text/plain" to "multipart/form-data", it produces the error listed above.
<flow name="Flow1" doc:name="Flow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="test/rule_file" mimeType="multipart/form-data" doc:name="HTTP"/>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8080" path="test/rule_file" mimeType="multipart/form-data" doc:name="HTTP"/>
</flow>
有人可以指出我该如何工作吗?
Can someone point out how I might get this working?
推荐答案
似乎您正在尝试构建HTTP代理:要使其正常工作,您将必须在流程的请求和响应阶段复制属性,并且还必须传播可能在入站HTTP端点上使用的路径扩展.
It seems you're attempting to build an HTTP proxy: to make it work you would have to copy properties in both request and response phases of the flow and also propagate the path extension that could have been used on the inbound HTTP endpoint.
这是手工可行的,但是为此使用现成的模式会更好:
This is feasible by hand but it's much better to use the ready-made pattern for this:
<pattern:http-proxy name="patternProxy"
inboundAddress="http://localhost:8081/test/rule_file"
outboundAddress="http://localhost:8080/test/rule_file" />
这篇关于Mule ESB和"multipart/form-data"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!