Mule - Anypoint studio 在返回 pdf 的 http 响应上冻结

Mule - Anypoint studio freezes on http response returning a pdf

我是 Mule 和 Anypoint 工作室的新手。

我正在将 docusign 集成到 mulesoft 中。我有一个奇怪的问题。

docusingn '/v2/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}' 的 api 之一将 return 一个 pdf 文档作为响应.

但是 Mulesoft 挂起并且没有正确响应。当 运行 使用 curl 命令时,相同的命令工作正常。任何帮助请

curl -i -H 'X-DocuSign-Authentication: { "Username":"asdf@asdf.com.au", "Password": "asdf@123", "IntegratorKey":"a59asdfssadfdsc0af6237a37f"}' https://demo.docusign.net/restapi/v2/accounts/c62afb10-455a-4f48-87cd-eb0f0949c9bd/envelopes/c8ed9a1d-dbb6-458f-b674-b8ecff9824b5/documents/combined > /data/t.pdf

以上命令工作正常。但不是这个

 <flow name="docusignGet">
         <flow-ref name="docusignInit" doc:name="docusignInit"/>
         <flow-ref name="docusignCredentials" doc:name="docusignCredentials"/>
         <http:request config-ref="Docusign_HTTP_Request_Configuration" path="/v2/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}" method="GET" doc:name="HTTP">
             <http:request-builder>
                 <http:uri-param paramName="accountId" value="#[sessionVars.docuSignAccountId]"/>
                 <http:uri-param paramName="envelopeId" value="7cadba0e-5fc6-4858-b0ea-c6eb13847a22"/>
                 <http:uri-param paramName="documentId" value="0"/>
             </http:request-builder>
         </http:request>
     </flow>

我也将对象添加到字节数组转换器。相同的结果。

任何帮助请

提前致谢

更新

我发现了冻结问题。日志记录是冻结的根本原因。

所以我禁用了所有日志。现在它不冻结,但是没有获得结果。这里有任何帮助..

HTTP 响应将是这样的(从 curl 获得)

 < HTTP/1.1 200 OK
 < Cache-Control: no-cache
 < Content-Length: 175512
 < Content-Type: application/pdf
 < X-RateLimit-Reset: 1527051600
 < X-RateLimit-Limit: 1000
 < X-RateLimit-Remaining: 1000
 < X-DocuSign-TraceToken: f0bfe1b3-674d-42f0-a410-1641e6f7cdc7
 < Content-Disposition: file; filename="Testing-_Please_sign_and_report.pdf"; documentid="combined"; filename*=UTF-8''Testing-_Please_sign_and_report.pdf
 < Date: Wed, 23 May 2018 04:04:54 GMT
 < Strict-Transport-Security: max-age=31536000; includeSubDomains
 <
 { [16384 bytes data]
   9  171k    9 16384    0     0   8192      0  0:00:21  0:00:02  0:00:19  6097* schannel: client wants to read 102400 bytes
 * schannel: encrypted data buffer: offset 1360 length 103424
 * schannel: encrypted data got 46871
 * schannel: encrypted data buffer: offset 48231 length 103424
 * schannel: decrypted data length: 409
either its returning a file by parts. What i want is this HTTP connector to act as proxy and return the same payload back to the caller after streaming all the bytes. Let the caller then do what ever it wants (in my case its a Django server).

但是我遇到了一个错误。

No serializer found for class org.glassfish.grizzly.utils.BufferInputStream and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) )

我尝试在 HTTP 之后将对象添加到 ByteArray 转换器。但是没用。

我希望下面的命令能够像在 docusign 中一样工作

 curl -i -v -X GET http://localhost:8081/api/docusign_get > tt.pdf

提前致谢

检查您的 HTTP Request/Response 是否正确生成。

在您的 log4j2.xml 文件中,将 HttpMessageLogger 更改为 DEBUG 级别

<!-- Http Logger shows wire traffic on DEBUG -->
<AsyncLogger name="org.mule.module.http.internal.HttpMessageLogger" level="DEBUG"/>

你应该能够在控制台输出中看到request/response,将其与curl会话进行比较,在curl命令中添加-v以获得请求和响应。

注意我更喜欢为此使用 Fiddler,除此之外,它更擅长处理二进制数据。

成功了。

原来是RAML问题。我拥有的 RAML 文件有这个

    /docusign_get:
  get:
    queryParameters: 
    responses: 
      200:
        body: 
          application/json:

正确的是

    /docusign_get:
  get:
    queryParameters: 
    responses: 
      200:
        body: 
          application/pdf:

没想到Mule如此依赖RAML文件