title: Content type for multi-part request in soap web services
body: <p>I am writing a Java client to call a SOAP web service.It accepts a file as an attachment so in java, I need to declare the content type as multipart.I am using <code>apache http</code> library to write Java client.</p>
  
  <p>I specified it i Java as below </p>
  
  <blockquote>
    <p>httppost.setHeader( "Content-Type", "multipart/related" );</p>
  </blockquote>
  
  <p>but I got the below error</p>
  
  <pre><code>Couldn't create SOAP message due to exception: javax.xml.ws.WebServiceException: MIME boundary parameter not foundmultipart/related
  </code></pre>
  
  <p>Please let me know how to resolve this error. What should be the content type to be specified in Java.</p>
  
  <p>When I specified it as </p>
  
  <pre><code>httppost.setHeader( "Content-Type", "text/xml; charset=utf-8" ); 
  </code></pre>
  
  <p>Again, i got the below exception</p>
  
  <pre><code> Caused by: com.sun.xml.ws.streaming.XMLStreamReaderException: XML reader error: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '-' (code 45) in prolog; expected '&lt;'
  </code></pre>
  
  <p>Which one should i go ahead with and how to resolve the respective exception?</p>