wso2 esb 4.8.1 callout mediator和multipart / form-data bug?

时间:2016-03-09 21:29:21

标签: wso2 wso2esb

我们遇到了callout和multipart / form-data的问题 我们的api用于上传文件 我们已经配置了这个构建器和格式化器

<messageBuilder contentType="multipart/form-data" class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
<messageFormatter contentType="multipart/form-data" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>

但是在执行中我们看到使用了org.wso2.carbon.relay.BinaryRelayBuilder,但是当我们使用callout mediator调用端点时 执行的消息格式化程序是MultipartFormDataBuilder而不是ExpandingMessageFormatter,这使得附件不会到达端点(我们认为这是一个错误)

<api xmlns="http://ws.apache.org/ns/synapse" name="CloneTest" context="/cloneTest">
   <resource methods="POST" uri-template="/test6">
      <inSequence>
         <sequence key="Clone3Sequence"></sequence>
         <log level="full">
            <property name="***** IN Estoy en el GET /cloneTest/test5 sequence11- $.clave = " expression="json-eval($.clave)"></property>
         </log>
         <drop></drop>
      </inSequence>

<sequence xmlns="http://ws.apache.org/ns/synapse" name="Clone3Sequence" trace="disable">
   <property name="HTTP_METHOD" value="POST" scope="axis2"></property>
   <callout serviceURL="http://localhost:1234/ProyectoWebMultipartForm/UploadServlet/recurso1">
      <source type="envelope"></source>
      <target key="RESPUESTA"></target>
   </callout>
   <property xmlns:ns="http://org.apache.synapse/xsd" name="RESPUESTAAAAAAAA" expression="get-property('RESPUESTA')"></property>
</sequence>   

请求到达esb

POST /cloneTest/test6 HTTP/1.1
Host: 127.0.0.1:1234
Connection: keep-alive
Content-Length: 300
Cache-Control: no-cache
Origin: chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop
apikey: b7608e32c2bb4aaa85c47584bf1b5508
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryNuCtYYL1ByZXkmrY
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36
Postman-Token: 218244a6-8fc3-1911-b2db-22ff2bf93bd1
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: es-ES,es;q=0.8

------WebKitFormBoundaryNuCtYYL1ByZXkmrY
Content-Disposition: form-data; name="payload"

{"a","b"}
------WebKitFormBoundaryNuCtYYL1ByZXkmrY
Content-Disposition: form-data; name="file"; filename="prueba.txt"
Content-Type: text/plain

pruebaaaaaaaa
------WebKitFormBoundaryNuCtYYL1ByZXkmrY--

请求到达端点

POST /ProyectoWebMultipartForm/UploadServlet/recurso1/test6 HTTP/1.1
Content-Type: multipart/form-data; charset=UTF-8; boundary=MIMEBoundary_02d66e5320a1bf4a46f61b9faa892f7837ffed6e9ee5e74d
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: es-ES,es;q=0.8
apikey: b7608e32c2bb4aaa85c47584bf1b5508
Cache-Control: no-cache
Origin: chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop
Postman-Token: 218244a6-8fc3-1911-b2db-22ff2bf93bd1
User-Agent: Axis2
Host: 127.0.0.1:1234
Transfer-Encoding: chunked

0

我们认为这是WSO2 4.8.1版本中的错误,有人可以向我们确认吗?

提前致谢

1 个答案:

答案 0 :(得分:1)

您是否检查了ESB_HOME / repository / conf / axis2 / axis2_blocking_client.xml中已定义的消息格式化程序和构建器,以获取特定的contentType(multipart / form-data),因为callout介体用于以阻塞方式发送请求。所以它在内部使用axis2_blocking_client.xml