Writing SMTP-Based SOAP Messages in PHP
By Shane Caraveo, October 01, 2002
With the buzz around web services, most SOAP usage has focused around the HTTP protocol, but other protocols can be used as well. SMTP has advantages not found with HTTP, including SMTP's ability to store and forward messages, implement one-to-many broadcast messaging, and use attachments to embed extra data into a SOAP message.
October 2002/Writing SMTP-Based SOAP Messages in PHP
Listing 2: A SOAP envelope with an attachment using MIME encoding
Date: Tue, 14 May 2002 16:55:28 -0700
From: [email protected]
X-Mailer: PEAR-SOAP 0.6.1
MIME-Version: 1.0
Message-ID: [email protected]
To: [email protected]
Content-Type: multipart/related; type=text/xml;
boundary="=_238a971a3fff8497d1f974289a3f92b8"
Subject: SOAP Message
--=_238a971a3fff8497d1f974289a3f92b8
Content-Type: text/xml; charset="UTF-8"
Content-Transfer-Encoding: quoted/printable
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns4="http://soapinterop.org/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns4:echoAttachment>
<inputAttachment href="cid:5911e6c2af074e7f7251a71f1dc347f7"/>
</ns4:echoAttachment>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
--=_238a971a3fff8497d1f974289a3f92b8
Content-Disposition: attachment.zip
Content-Type: application/zip
Content-Transfer-Encoding: base64
Content-ID: <5911e6c2af074e7f7251a71f1dc347f7>
PD9waHANCnJlcXVpcmVfb25jZSgiU09BUC9DbGllbnQucGhwIik7DQpyZXF1aXJlX29uY2U
...
Pz4=
--=_238a971a3fff8497d1f974289a3f92b8--