Search code examples
mulemule-studiomule-componentanypoint-studiomule-esb

Mule - Anypoint studio freezes on http response returning a pdf


I'm new to Mule and Anypoint studio.

I'm integrating docusign in mulesoft. I'm having a weird issue.

One of the api of docusingn '/v2/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}' will return a pdf doucment as the response.

However Mulesoft hangs and doesnt respond properly. The same command when run using curl command it works fine. Any help here pls

curl -i -H 'X-DocuSign-Authentication: { "Username":"[email protected]", "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

Above command works fine. But not this one

 <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>

I added Object to Byte-Array transformer too. Same result.

enter image description here

Any help pls

Thanks in advance

UPDATE

I found out the freeze issue. logging was root cause for the freeze.

So i disabled all the logs. now its not freezing, however the result is not obtained. Any help here ..

The HTTP response will be some thing like this (obtained from 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).

However i'm having an error.

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) )

I tried to add Object to ByteArray transformer after HTTP. But it didnt work .

I want the below command to work the way it works for docusign

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

Thanks in advance


Solution

  • Got it working.

    It turned out to be RAML issue. The RAML file what i had was having this

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

    where as the correct is

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

    didnt imagine that Mule is so dependent of RAML file