title: Unable to Send PDF attachment through Mule HTTPEndPoint
body: <p>I have a requirement wherein i will submit data from an html form to Mule flow and Mule should return me an PDF file. I have created a following flow.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;mule xmlns:http="http://www.mulesoft.org/schema/mule/http"
      xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
      xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.1"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
  http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
  http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd"&gt;
      &lt;flow name="SampleMuleFlow1" doc:name="SampleMuleFlow1"&gt;
          &lt;http:inbound-endpoint exchange-pattern="request-response"
              host="localhost" port="8081" path="test" doc:name="HTTP" contentType="application/pdf"
              mimeType="application/pdf"&gt;
          &lt;/http:inbound-endpoint&gt;
          &lt;custom-transformer returnClass="org.mule.api.MuleMessage"
              mimeType="application/pdf"
              class="com.tcs.pdfgen.GenerateGFEService_GenerateGFEServiceImplPort_Client"
              doc:name="Java" /&gt;
  
      &lt;/flow&gt;
  &lt;/mule&gt;
  
  I attach the PDF file through the api   message.addOutboundAttachment().Please check the Custom Tranformer file i have written.
  
  package com.tcs.pdfgen;
  
  /**
   * Please modify this class to meet your needs
   * This class is not complete
   */
  import java.io.ByteArrayOutputStream;
  import java.io.FileOutputStream;
  import java.io.InputStream;
  import java.net.URL;
  
  import javax.xml.namespace.QName;
  
  import org.apache.cxf.attachment.LazyDataSource;
  import org.mule.api.MuleMessage;
  import org.mule.api.transformer.TransformerException;
  import org.mule.transformer.AbstractMessageTransformer;
  
  
  
      @Override
      public Object transformMessage(MuleMessage message, String outputEncoding)
              throws TransformerException {
          try {
              GenerateGFEService_GenerateGFEServiceImplPort_Client client = new GenerateGFEService_GenerateGFEServiceImplPort_Client();
  
  /*client.genGFE(message, "GeneratedSamplePDF.pdf") method return a byte array of the PDF file.*/
  
              message.addOutboundAttachment("GFEFile",
                      client.genGFE(message, "GeneratedSamplePDF.pdf"),
                      "application/pdf");
  
              System.out.println("Attachment Names&gt;&gt;&gt;&gt;"
                      + message.getOutboundAttachmentNames());
  
              System.out.println("ApplicationHome settings&gt;&gt;&gt;"
                      + message.getOutboundProperty("ApplicationHome"));
  
              return message;
          } catch (Exception ioe) {
              System.out.println("exception 1111");
              System.out.println("Exception Message&gt;&gt;&gt;&gt;&gt;&gt;" + ioe.getMessage());
              throw new TransformerException(this, ioe);
          } catch (Throwable t) {
              System.out.println("exception?&gt;&gt;&gt;" + t.getMessage());
          } finally {
              try {
  
              } catch (Throwable t) {
              }
          }
          return message;
      }
  
  }
  </code></pre>
  
  <p>But on the browser , i get an error the PDF not starting with "%PDF".I believe the PDF attachment is not sent through the HTTP Response Object.Please let me know, If i'm missing something.</p>