Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | Managing MIME messages | Extracting Data from MIME and S/MIME Messages | Extracting the Payload from a MIME Message | Example—Extracting One Part from a Multipart MIME Message
 
Example—Extracting One Part from a Multipart MIME Message
The following flow service shows how you would extract the content from the second body part in a three-part MIME message. In this example, the message contains an XML document that is extracted, parsed, and put in the pipeline.
Flow service that extracts content from a single part
Note:
This example is only for those messages that are within the threshold value specified by the watt.server.mime.largeDataThreshold configuration parameter.
Step
Description
1
This step acquires a MIME message. This example calls a helper service that puts a three-part test message in the pipeline as an InputStream. In a production solution, it is more likely that a MIME message would be passed into the pipeline by a content handler or a back-end system.
2
This step takes the MIME message and creates a MIME object (mimeData) containing the message’s headers and content. If you view the pipeline, you will note that the InputStream produced by step 1 is linked to this step’s input variable.
3
This step extracts the payload from the second body part in mimeData. In this example, the index parameter is set to 1 to select the second body part.
This step returns the payload (in this case an XML document) as an InputStream named content.
4
This step converts the XML document in content to a String.
5
This step takes the String containing the XML document and parses it, producing an XML node containing the XML document.
6
This step produces a document (IData object) containing the XML document’s elements and values.