XML-binary Optimized Packaging
XML-binary Optimized Packaging (XOP) is a W3C recommended convention, defined for efficient serialization of XML Information Sets that have a mix of binary and textual data, and, more generally for storing binary data in XML tags. XOP defines an XOP Infoset, which becomes the container for the mixed XML document. When an XML document is encapsulated in an XOP Infoset, all chunks of binary data are separated from the XML document and stored separately. In the XML document, an xop:Include element is added which references the new location of the binary data. When reading the original document back from the XOP Infoset, the XOP processor replaces the xop:Include tags with the actual binary data they reference.
Usually both the basic SOAP XML and the binary data are stored as MIME parts, with the binary being base64 encoded. For example
MIME-Version: 1.0
Content-Type: Multipart/Related;boundary=MIME_boundary;
...
--MIME_boundary
Content-Type: application/xop+xml;
...
<soap:Envelope ...
<soap:Body>...
<m:photo xmlmime:contentType='image/png'>
<xop:Include xmlns:xop='http://www.w3.org/2004/08/xop/include'
href='cid:http://example.org/me.png'/></m:photo>
...
--MIME_boundary
Content-Type: image/png
Content-Transfer-Encoding: binary
Content-ID: <http://example.org/me.png>
// binary octets for png