title: jQuery ajax SOAP multipart response pdf
body: <p>I am sending a jQuery ajax request with <code>data:xml</code>and<code>Content-Type:text/xml</code> and getting following response:</p>
  
  <pre><code>--MIME_boundary
  Content-Type: text/xml; charset=utf-8
  Content-Transfer-Encoding: binary
  Content-ID: &lt;SOAP-ENV:Envelope&gt;
  
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;SOAP-ENV:Envelope&gt; .............&lt;/SOAP-ENV:Envelope&gt;
  --MIME_boundary
  Content-Type: application/pdf
  Content-Transfer-Encoding: binary
  
  .... pdf binary data .....
  </code></pre>
  
  <p>As i understand the reponse is a multipart with an attachment ... but how can i extract the soap part and the pdf raw data part individually and use the binary data to build this pdf? Thanx for any help.</p>
  
  <p>keeping in view also this: <a href="http://www.w3.org/TR/SOAP-attachments#SOAPReferenceToAttachements" rel="nofollow">http://www.w3.org/TR/SOAP-attachments#SOAPReferenceToAttachements</a></p>
  
  <p>UPDATE:
  after a bit of research, summing up of lots of different responses there are the following issues and questions that arise for me:</p>
  
  <ul>
  <li>Ajax - jquery .ajax() function- handles only text/xml response, thats why it does not handle binary data (read it somewhere). But if i am getting multipart with -> Content-Type: application/pdf -> I AM getting the binary data in it. </li>
  <li>The binary data could be converted to base64 and then use the html5 data: -> but that has complex issues where every browser behaves differently with it.</li>
  </ul>
  
  <p>Now, my conclusion would be: </p>
  
  <ul>
  <li>Just make an ajax request, get the URL path and download the file directly from the server by using window.location.href</li>
  </ul>
  
  <p>Correct if i am wrong here: jQuery Ajax cannot handle multipart MIME reponses??</p>