XML

Using MultiPart MIME

A BizTalk message can be constructed using the multipart MIME format defined in Request for Comment (RFC) 2387 (http://www.ietf.org/rfc/rfc2387.txt). To use the MIME format with an HTTP document, you need to take some special considerations. An example of a BizTalk Message in MIME format would look as shown in the code that follows.

  MIME-Version: 1.0
  Content-Type: Multipart/Related;
          boundary=biztalk_document_boundary;
          type=text/xml;
          start="<po.xml@Northwindtraders.com>"
  Content-Description: This is the optional message description.
  -- biztalk_document_boundary
  Content-Type: text/xml; charset=UTF-8
  Content-ID: <po.xml@Northwindtraders.com>
  <?xml version='1.0' ?>
  <SOAP-ENV:Envelope
     xmlns:xsi= "http://www.w3.org/1999/XMLSchema/instance"
     xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope"
     xsi:schemaLocation=
     "http://www.northwindtraders.com/schemas/NorthwindPOSchema.xsd">
     <SOAP-ENV:Header xsi:type="NorthwindHeader">
     <!--BizTags begin here -->
     <dlv:delivery SOAP-ENV:mustUnderstand="1"
        xmlns:dlv="http://schema.biztalk.org/btf-2-0/delivery"
        xmlns:agr="uri/of/agreement">
      <!-- Delivery and properties header entries omitted for
         brevity -->
   <fst:manifest xmlns:fst=
      "http://schema.biztalk.org/btf-2-0/manifest">
      <fst:reference fst:uri="#Purchase_Order">
         <fst:description>Ppurchase order for Northwind
         </fst:description>
      </fst:reference>
      <fst:reference fst:uri="CID:po.jpg@Northwindtraders.com">
         <fst:description>Scanned image of the contract
         </fst:description>
      </fst:reference>
   </fst:manifest>
     <!--BizTags end here -->
     </SOAP-ENV:Header>
     <SOAP-ENV:Body xsi:type="NorthwindBody">
        <m:UpdatePO xmlns:m=
        "http://www.northwindtraders.com/schemas/NPOSchema.xsd">
        <!-SOAP document containing PO enclosed ends here -->
     </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>
  -- biztalk_document_boundary
  Content-Type: image/jpeg
  Content-ID: <CID:po.jpg@Northwindtraders.com >
     ...JPEG image...
  --biztalk_document_boundary

The Content-Type tag identifies this document as a Multipart MIME document. The boundary parameter defines the boundaries between different documents in the MIME document. The start parameter is required for a BizTalk message and refers to the document that will be processed first. For a BizTalk message, the start parameter will always refer to the SOAP document. The value for the start parameter should always be equal to the Content-ID tag's value for the SOAP element. The Content-ID tags are used to identify the different sections of the document and are therefore required for every section. The manifest element's child element reference uses a URI to identify the non-SOAP elements of the document. The Content-ID for these non-SOAP elements must be equal to these URIs. The SOAP document must be included in the root of the MultiPart MIME document. MIME documents can have a charset parameter, but this parameter should not be used for BizTalk messages.