title: WSO2 ESB 7.1.0 Binary response is truncated to 375B
body: <p>I have problem with binary response in WSO2 ESB 7.1.0 - it looks like the answer is truncated to 375B (body part - binary data).</p>
  <p>This is fragment of my sequence - response build:</p>
  <pre><code>&lt;payloadFactory description=&quot;Build Payload Response&quot; media-type=&quot;xml&quot;&gt;
    &lt;format&gt;
      &lt;ns:binary xmlns:ns=&quot;http://ws.apache.org/commons/ns/payload&quot;&gt;BASE64_FILE_CONTENT&lt;/ns:binary&gt;
    &lt;/format&gt;
    &lt;args/&gt;
  &lt;/payloadFactory&gt;
  &lt;script language=&quot;js&quot;&gt;&lt;![CDATA[var binaryNode = mc.getEnvelope().getBody().getFirstElement().getFirstOMChild();  
    binaryNode.setBinary(true);]]&gt;&lt;/script&gt;
  &lt;propertyGroup description=&quot;Set Content-Type&quot;&gt;
    &lt;property action=&quot;remove&quot; name=&quot;TRANSPORT_HEADERS&quot; scope=&quot;axis2&quot;/&gt;
    &lt;property name=&quot;DISABLE_CHUNKING&quot; scope=&quot;axis2&quot; type=&quot;STRING&quot; value=&quot;true&quot;/&gt;
    &lt;property name=&quot;messageType&quot; scope=&quot;axis2&quot; type=&quot;STRING&quot; value=&quot;application/octet-stream&quot;/&gt;
    &lt;property name=&quot;ContentType&quot; scope=&quot;axis2&quot; type=&quot;STRING&quot; value=&quot;application/pdf&quot;/&gt;
  &lt;/propertyGroup&gt;
  &lt;header description=&quot;Set Content-Disposition&quot; name=&quot;Content-Disposition&quot; scope=&quot;transport&quot; value=&quot;attachment; filename=&amp;quot;raport.pdf&amp;quot;&quot;/&gt;
  </code></pre>
  <p>Of course in place BASE64_FILE_CONTENT I put real file content encoded in BASE64.
  Mesasge formatter configuration (I use application/octeat-stream or application/pdf -&gt; org.wso2.carbon.relay.ExpandingMessageFormatter with the same result):</p>
  <pre><code>&lt;messageFormatters&gt;
    &lt;messageFormatter contentType=&quot;application/x-www-form-urlencoded&quot; class=&quot;org.apache.synapse.commons.formatters.XFormURLEncodedFormatter&quot;/&gt;
    &lt;messageFormatter contentType=&quot;multipart/form-data&quot; class=&quot;org.apache.axis2.transport.http.MultipartFormDataFormatter&quot;/&gt;
    &lt;messageFormatter contentType=&quot;application/xml&quot; class=&quot;org.apache.axis2.transport.http.ApplicationXMLFormatter&quot;/&gt;
    &lt;messageFormatter contentType=&quot;text/xml&quot; class=&quot;org.apache.axis2.transport.http.SOAPMessageFormatter&quot;/&gt;
    &lt;messageFormatter contentType=&quot;application/soap+xml&quot; class=&quot;org.apache.axis2.transport.http.SOAPMessageFormatter&quot;/&gt;
    &lt;messageFormatter contentType=&quot;text/plain&quot; class=&quot;org.apache.axis2.format.PlainTextFormatter&quot;/&gt;
    &lt;messageFormatter contentType=&quot;application/json&quot; class=&quot;org.wso2.micro.integrator.core.json.JsonStreamFormatter&quot;/&gt;
    &lt;messageFormatter contentType=&quot;application/json/badgerfish&quot; class=&quot;org.apache.axis2.json.JSONBadgerfishMessageFormatter&quot;/&gt;
    &lt;messageFormatter contentType=&quot;text/javascript&quot; class=&quot;org.apache.axis2.json.JSONMessageFormatter&quot;/&gt;
    &lt;messageFormatter contentType=&quot;application/octet-stream&quot; class=&quot;org.wso2.carbon.relay.ExpandingMessageFormatter&quot;/&gt;
    &lt;messageFormatter contentType=&quot;application/binary&quot; class=&quot;org.apache.axis2.format.BinaryFormatter&quot;/&gt;
    &lt;messageFormatter contentType=&quot;application/pdf&quot; class=&quot;org.wso2.carbon.relay.ExpandingMessageFormatter&quot;/&gt;
  &lt;/messageFormatters&gt;
  </code></pre>
  <p>I tryied with a few sample files and result was always the same - headers and the beggining of binary data looks good, but data is truncated on 375B:</p>
  <p><a href="https://i.stack.imgur.com/t2Etw.png" rel="nofollow noreferrer">Postman screenshot - 375B for body</a></p>
  <p>Does this value (375B) come from any parameter? Can anyone suggest how to correctly return a file in WSO2 (as binary data in the response)?</p>
  <p>Best regards</p>
  <p>Marcin Orliński</p>