Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Yes, you can build the MIME component of the message using something like <a href="http://php.net/manual/en/function.imap-mail-compose.php" rel="nofollow">imap_mail_compose</a>.</p> <p>You'll need to construct a multipart message as they do in the first example, putting the XML from the <code>$request</code> parameter, from an overridden <code>SoapClient::__doRequest</code> method, into the first part of the MIME message.</p> <p>Then you can do as others have shown in the first <code>imap_mail_compose</code> example to add one or more messages parts with attachments. These attachements can, but do not have to be base64 encoded, they can just as well be binary. The encoding for each part is specified by part-specific headers.</p> <p>You'll also need to cook up an appropriate set of HTTP headers, per the <a href="http://www.w3.org/TR/SOAP-attachments" rel="nofollow">SwA Document</a> @Baba linked to earlier.</p> <p>Once it's all said and done, you should have something looking like the examples from that document:</p> <pre><code>MIME-Version: 1.0 Content-Type: Multipart/Related; boundary=MIME_boundary; type=text/xml; start="&lt;claim061400a.xml@claiming-it.com&gt;" Content-Description: This is the optional message description. --MIME_boundary Content-Type: text/xml; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-ID: &lt;claim061400a.xml@claiming-it.com&gt; &lt;?xml version='1.0' ?&gt; &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;SOAP-ENV:Body&gt; .. &lt;theSignedForm href="cid:claim061400a.tiff@claiming-it.com"/&gt; .. &lt;/SOAP-ENV:Body&gt; &lt;/SOAP-ENV:Envelope&gt; --MIME_boundary Content-Type: image/tiff Content-Transfer-Encoding: binary Content-ID: &lt;claim061400a.tiff@claiming-it.com&gt; ...binary TIFF image... --MIME_boundary-- </code></pre> <p>And you can send that across the wire with the aforementioned overridden <code>SoapClient::__doRequest</code> method. Things I have noticed in trying to implement it myself thus far:</p> <ul> <li>You may need to create an <em>href</em> URI reference from each SOAP node to the corresponding attachment, something like <code>href="cid:claim061400a.tiff@claiming-it.com"</code> above</li> <li>You will need to extract the <em>boundary</em> component from the MIME content returned by <code>imap_mail_compose</code> for use in an HTTP <em>Content-Type</em> header</li> <li>Don't forget the <em>start</em> component of the <em>Content-Type</em> header either, it should look something like this:</li> <li><code>imap_mail_compose</code> appears fairly minimal (but low hanging fruit), if it proves insufficient, consider <a href="http://pear.php.net/package/Mail_Mime/redirected" rel="nofollow">Mail_Mime</a> instead</li> </ul> <blockquote> <p>Content-Type: Multipart/Related; boundary=MIME_boundary; type=text/xml; start=""</p> </blockquote> <p>Lastly, I'm not sure how evenly the various implementations of <em>SwA</em> are out there on the Internet... Suffice it to say, I've not been able to get an upload to a remote service with a crude implementation of what I've described above yet. It does seem like <em>SwA</em> is the typical SOAP attachment paradigm of choice though, from what I gather reading around on the net.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload