Skip to main content
Skip table of contents

MIME Multipart

The adapter allows you to read and generate MIME multipart documents – primarily for HTTP communication (e.g. ReSTful webservices). The adapter can also be used for email communication and for the handling of email attachments.

The adapter supports you when working with MIME multipart documents. It converts MIME documents to an XML representation and the XML representation into MIME documents.


Properties

Operation

Defines the operation executed by the function adapter

Possible values:

  • FromBytesWithHeaders: create a MIME XML document from a MIME document

  • FromRestMetaXml : create a corresponding MIME XML document from a ReST input XML

  • ModifyRestMetaXml : create a modified ReST input XML from a ReST input XML

  • ToRestMetaXml : create a ReST output XML with HTTP status code 200 from a MIME XML document.

  • ToBytesWithHeaders : create a MIME document from a MIME XML document

  • FromBytesWithBoundaryFromFirstLine : create a MIME XML document from a MIME body

  • ToBytesWithBoundaryInFirstLine :  create a MIME body from a MIME XML document without preamble and without epilogue

  • FlattenXml : create a flat MIME XML document from a MIME XML document (if necessary multipart tree is serialized as single part)

  • PartFromX4Document: convert any incoming X4 document into a part in the Mime XML structure

Parameters

Adapter

Main adapter class (Do not change!)

Possible values: de.softproject.integration.adapter.mimemultipart.Adapter: Main class (default)


Status values

1The operation has been completed successfully.
0

The operation has been completed successfully but has no result.

-1The operation failed due to a technical error.

Operation FromBytesWithHeaders

The FromBytesWithHeaders adapter operation can be used to process the components of a MIME document (e.g. an email in EML format), e.g. the attachments of the email.

Input: Example of a MIME XML document

TEXT
From: John Doe <example@example.com>
MIME-Version: 1.0
Content-Type: multipart/mixed;
        boundary="XXXXboundary text"

This is a multipart message in MIME format.

--XXXXboundary text 
Content-Type: text/plain

this is the body text

--XXXXboundary text 
Content-Type: text/plain;
Content-Disposition: attachment;
        filename="test.txt"

this is the attachment text

--XXXXboundary text--

Output: Example of a generated MIME XML document

XML
<Multipart>
    <Header>
        <Name>from</Name>
        <Value>John Doe &lt;example@example.com&gt;</Value>
    </Header>
    <Header>
        <Name>mime-version</Name>
        <Value>1.0</Value>
    </Header>
    <Header>
        <Name>content-type</Name>
        <Value>multipart/mixed; boundary="XXXXboundary text"</Value>
        <Type>multipart/mixed</Type>
        <Parameter>
            <Name>boundary</Name>
            <Value>XXXXboundary text</Value>
        </Parameter>
    </Header>
    <Prolog>VGhpcyBpcyBhIG11bHRpcGFydCBtZXNzYWdlIGluIE1JTUUgZm9ybWF0Lg0K</Prolog>
    <Part>
        <Header>
            <Name>content-type</Name>
            <Value>text/plain</Value>
            <Type>text/plain</Type>
        </Header>
        <Content encoding="base64">dGhpcyBpcyB0aGUgYm9keSB0ZXh0DQo=</Content>
    </Part>
    <Part>
        <Header>
            <Name>content-type</Name>
            <Value>text/plain;</Value>
            <Type>text/plain</Type>
        </Header>
        <Header>
            <Name>content-disposition</Name>
            <Value>attachment; filename="test.txt"</Value>
            <Disposition>attachment</Disposition>
            <Parameter>
                <Name>filename</Name>
                <Value>test.txt</Value>
            </Parameter>
        </Header>
        <Content encoding="base64">dGhpcyBpcyB0aGUgYXR0YWNobWVudCB0ZXh0DQo=</Content>
    </Part>
    <Epilog />
</Multipart>

If the input document contains only a MIME document, only the corresponding part in a root <part/> element is output in the output XML document.

Operation FromRestMetaXml

The FromRestMetaXml adapter operation can be used to process XML documents in MetaXml format and output them as MIME XML. This input XML format is generated if an X4 process was called via the X4 ReST Starter and this process uses the HTTP-MetaXml input handler.

Examples of use:

  • File upload using an HTML form: if data with the multipart/form-data content type is to be processed.
  • Web services communication where all (meta) data of the HTTP request is relevant for processing.

Input: Example of an X4 ReST input document

XML
<Request>
    <Path>
        <Method>POST</Method>
        <FullPath>http://localhost:8080/X4/httpstarter/ReST/httpService/simple</FullPath>
        <Server>http://localhost:8080/</Server>
        <RequestPath>/X4/httpstarter/ReST/httpService/simple</RequestPath>
        <ContextPrefix>/X4/httpstarter/ReST</ContextPrefix>
        <PathInfo>/httpService/simple</PathInfo>
        <Parts>
            <Constant name="httpService" />
            <Constant name="simple" />
        </Parts>
    </Path>
    <Connection>
        <Scheme>http</Scheme>
        <Remote>
            <Address>0:0:0:0:0:0:0:1</Address>
            <Port>51181</Port>
        </Remote>
        <Local>
            <Address>0:0:0:0:0:0:0:1</Address>
            <Port>8080</Port>
        </Local>
        <Server>
            <Name>localhost</Name>
            <Port>8080</Port>
        </Server>
    </Connection>
    <Headers>
        <Header>
            <Name>accept</Name>
            <Value>text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</Value>
        </Header>
        <Header>
            <Name>user-agent</Name>
            <Value>Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0
			</Value>
        </Header>
        <Header>
            <Name>connection</Name>
            <Value>keep-alive</Value>
        </Header>
        <Header>
            <Name>host</Name>
            <Value>localhost:8080</Value>
        </Header>
        <Header>
            <Name>accept-language</Name>
            <Value>de,en-US;q=0.7,en;q=0.3</Value>
        </Header>
        <Header>
            <Name>accept-encoding</Name>
            <Value>gzip, deflate</Value>
        </Header>
        <Header>
            <Name>content-length</Name>
            <Value>546</Value>
        </Header>
        <Header>
            <Name>content-type</Name>
            <Value>multipart/form-data; boundary=---------------------------2109532091963
			</Value>
        </Header>
    </Headers>
    <Query />
    <Security />
    <Body encoding="base64">
        LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0yMTA5NTMyMDkxOTYzDQpDb250ZW50LURpc3Bv
        c2l0aW9uOiBmb3JtLWRhdGE7IG5hbWU9IkZlbGQxIg0KDQplcnN0ZXMgRmVsZA0KLS0tLS0tLS0t
        LS0tLS0tLS0tLS0tLS0tLS0tLS0yMTA5NTMyMDkxOTYzDQpDb250ZW50LURpc3Bvc2l0aW9uOiBm
        b3JtLWRhdGE7IG5hbWU9IkZlbGQyIg0KDQp6d2VpdGVzIEZlbGQNCi0tLS0tLS0tLS0tLS0tLS0t
        LS0tLS0tLS0tLS0tMjEwOTUzMjA5MTk2Mw0KQ29udGVudC1EaXNwb3NpdGlvbjogZm9ybS1kYXRh
        OyBuYW1lPSJhcmVhIg0KDQpEaWUgR3Jv32UgRmzkY2hlDQoNCmJsdWINCg0KLS0tLQ0KDQptb3Jl
        IGJsdWINCg0KDQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLTIxMDk1MzIwOTE5NjMNCkNv
        bnRlbnQtRGlzcG9zaXRpb246IGZvcm0tZGF0YTsgbmFtZT0iRGF0ZWkiOyBmaWxlbmFtZT0iIg0K
        Q29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0NCg0KDQotLS0tLS0tLS0tLS0t
        LS0tLS0tLS0tLS0tLS0tLTIxMDk1MzIwOTE5NjMtLQ0K
    </Body>
</Request>

Output: Example of a generated MIME (multipart) XML document.

XML
<Multipart>
    <Header>
        <Name>accept</Name>
        <Value>text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</Value>
    </Header>
    <Header>
        <Name>user-agent</Name>
        <Value>Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0</Value>
    </Header>
    <Header>
        <Name>connection</Name>
        <Value>keep-alive</Value>
    </Header>
    <Header>
        <Name>host</Name>
        <Value>localhost:8080</Value>
    </Header>
    <Header>
        <Name>accept-language</Name>
        <Value>de,en-US;q=0.7,en;q=0.3</Value>
    </Header>
    <Header>
        <Name>accept-encoding</Name>
        <Value>gzip, deflate</Value>
    </Header>
    <Header>
        <Name>content-length</Name>
        <Value>546</Value>
    </Header>
    <Header>
        <Name>content-type</Name>
        <Value>multipart/form-data; boundary=---------------------------2109532091963</Value>
        <Type>multipart/form-data</Type>
        <Parameter>
            <Name>boundary</Name>
            <Value>---------------------------2109532091963</Value>
        </Parameter>
    </Header>
    <Prolog />
    <Part>
        <Header>
            <Name>content-disposition</Name>
            <Value>form-data; name="Feld1"</Value>
            <Disposition>form-data</Disposition>
            <Parameter>
                <Name>name</Name>
                <Value>Feld1</Value>
            </Parameter>
        </Header>
        <Content encoding="base64">ZXJzdGVzIEZlbGQ=</Content>
    </Part>
    <Part>
        <Header>
            <Name>content-disposition</Name>
            <Value>form-data; name="Feld2"</Value>
            <Disposition>form-data</Disposition>
            <Parameter>
                <Name>name</Name>
                <Value>Feld2</Value>
            </Parameter>
        </Header>
        <Content encoding="base64">endlaXRlcyBGZWxk</Content>
    </Part>
    <Part>
        <Header>
            <Name>content-disposition</Name>
            <Value>form-data; name="area"</Value>
            <Disposition>form-data</Disposition>
            <Parameter>
                <Name>name</Name>
                <Value>area</Value>
            </Parameter>
        </Header>
        <Content encoding="base64">	
			RGllIEdyb99lIEZs5GNoZQ0KDQpibHViDQoNCi0tLS0NCg0KbW9yZSBibHViDQoNCg==
		</Content>
    </Part>
    <Part>
        <Header>
            <Name>content-disposition</Name>
            <Value>form-data; name="Datei"; filename=""</Value>
            <Disposition>form-data</Disposition>
            <Parameter>
                <Name>name</Name>
                <Value>Datei</Value>
            </Parameter>
            <Parameter>
                <Name>filename</Name>
                <Value />
            </Parameter>
        </Header>
        <Header>
            <Name>content-type</Name>
            <Value>application/octet-stream</Value>
            <Type>application/octet-stream</Type>
        </Header>
        <Content encoding="base64" />
    </Part>
    <Epilog />
</Multipart>

Operation ModifyRestMetaXml

The ModifyRestMetaXml adapter operation can be used to process MetaXml documents generated by the X4 ReST Starter in the same way as the FromRestMetaXml operation, but the output document has a modified structure:

  • The header area (/Request/Headers) is removed.
  • The body element (/Request/Body) is replaced by the MIME XML structure.

Input: Rest input XML document, see Input for FromRestMetaXml operation).

Output: Example of a modified X4 ReST input document

XML
<Request>
    <Path>
        <Method>POST</Method>
        <FullPath>http://localhost:8080/X4/httpstarter/ReST/httpService/simple</FullPath>
        <Server>http://localhost:8080/</Server>
        <RequestPath>/X4/httpstarter/ReST/httpService/simple</RequestPath>
        <ContextPrefix>/X4/httpstarter/ReST</ContextPrefix>
        <PathInfo>/httpService/simple</PathInfo>
        <Parts>
            <Constant name="httpService" />
            <Constant name="simple" />
        </Parts>
    </Path>
    <Connection>
        <Scheme>http</Scheme>
        <Remote>
            <Address>0:0:0:0:0:0:0:1</Address>
            <Port>51181</Port>
        </Remote>
        <Local>
            <Address>0:0:0:0:0:0:0:1</Address>
            <Port>8080</Port>
        </Local>
        <Server>
            <Name>localhost</Name>
            <Port>8080</Port>
        </Server>
    </Connection>
    <Query />
    <Security />
    <Multipart>
        <Header>
            <Name>accept</Name>
            <Value>text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</Value>
        </Header>
        <Header>
            <Name>user-agent</Name>
            <Value>Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0
			</Value>
        </Header>
        <Header>
            <Name>connection</Name>
            <Value>keep-alive</Value>
        </Header>
        <Header>
            <Name>host</Name>
            <Value>localhost:8080</Value>
        </Header>
        <Header>
            <Name>accept-language</Name>
            <Value>de,en-US;q=0.7,en;q=0.3</Value>
        </Header>
        <Header>
            <Name>accept-encoding</Name>
            <Value>gzip, deflate</Value>
        </Header>
        <Header>
            <Name>content-length</Name>
            <Value>546</Value>
        </Header>
        <Header>
            <Name>content-type</Name>
            <Value>multipart/form-data; boundary=---------------------------2109532091963
			</Value>
            <Type>multipart/form-data</Type>
            <Parameter>
                <Name>boundary</Name>
                <Value>---------------------------2109532091963</Value>
            </Parameter>
        </Header>
        <Prolog />
        <Part>
            <Header>
                <Name>content-disposition</Name>
                <Value>form-data; name="Feld1"</Value>
                <Disposition>form-data</Disposition>
                <Parameter>
                    <Name>name</Name>
                    <Value>Feld1</Value>
                </Parameter>
            </Header>
            <Content encoding="base64">ZXJzdGVzIEZlbGQ=</Content>
        </Part>
        <Part>
            <Header>
                <Name>content-disposition</Name>
                <Value>form-data; name="Feld2"</Value>
                <Disposition>form-data</Disposition>
                <Parameter>
                    <Name>name</Name>
                    <Value>Feld2</Value>
                </Parameter>
            </Header>
            <Content encoding="base64">endlaXRlcyBGZWxk</Content>
        </Part>
        <Part>
            <Header>
                <Name>content-disposition</Name>
                <Value>form-data; name="area"</Value>
                <Disposition>form-data</Disposition>
                <Parameter>
                    <Name>name</Name>
                    <Value>area</Value>
                </Parameter>
            </Header>
            <Content encoding="base64">
				RGllIEdyb99lIEZs5GNoZQ0KDQpibHViDQoNCi0tLS0NCg0KbW9yZSBibHViDQoNCg==
			</Content>
        </Part>
        <Part>
            <Header>
                <Name>content-disposition</Name>
                <Value>form-data; name="Datei"; filename=""</Value>
                <Disposition>form-data</Disposition>
                <Parameter>
                    <Name>name</Name>
                    <Value>Datei</Value>
                </Parameter>
                <Parameter>
                    <Name>filename</Name>
                    <Value />
                </Parameter>
            </Header>
            <Header>
                <Name>content-type</Name>
                <Value>application/octet-stream</Value>
                <Type>application/octet-stream</Type>
            </Header>
            <Content encoding="base64" />
        </Part>
        <Epilog />
    </Multipart>
</Request>

Operation ToRestMetaXml

The ToRestMetaXml adapter operation can be used to read a MIME XML document and generate it in MetaXML format. This XML format is typically output as the result of an X4 process called via the X4 ReST Starter if it uses the HTTP-MetaXml output handler.

Input: Example of an X4 ReST input document

XML
<Multipart>
	<Header>
		<Name>content-transfer-encoding</Name>
		<Value>binary</Value>
	</Header>
	<Header>
		<Name>content-type</Name>
		<Value>multipart/related; type="application/xop+xml";
			start="&lt;0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d&gt;";
			start-info="text/xml"</Value>
		<Type>multipart/related</Type>
		<Parameter>
			<Name>type</Name>
			<Value>application/xop+xml</Value>
		</Parameter>
		<Parameter>
			<Name>start</Name>
			<Value>&lt;0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d&gt;</Value>
		</Parameter>
		<Parameter>
			<Name>start-info</Name>
			<Value>text/xml</Value>
		</Parameter>			
	</Header>
	<Part>
		<Header>
			<Name>content-type</Name>
			<Value>application/xop+xml; charset=UTF-8; type="text/xml"</Value>
			<Type>application/xop+xml</Type>
			<Parameter>
				<Name>charset</Name>
				<Value>UTF-8</Value>
			</Parameter>
			<Parameter>
				<Name>type</Name>
				<Value>text/xml</Value>
			</Parameter>
		</Header>
		<Header>
			<Name>content-transfer-encoding</Name>
			<Value>binary</Value>
		</Header>
		<Header>
			<Name>content-id</Name>
			<Value>&lt;0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d&gt;</Value>
			<Id asUrl="cid:0@4cd748bf-d5ea-4d2f ...</Id>
		</Header>
		<Content encoding="base64">PD94bWwg ...</Content>
	</Part>
</Multipart>

Output: Example of a generated X4 ReST output document.

XML
<Response>
	<Status code="200"/>
	<Headers>
		<Header>
			<Name>content-transfer-encoding</Name><Value>binary</Value>
		</Header>
		<Header>
			<Name>content-type</Name>
			<Value>multipart/related; type="application/xop+xml"; 
					start="&lt;0@4cd748bf-d5ea-4d2f ... &gt;"; start-info="text/xml"; 
				boundary=37aa08a1-cbc3-4143-b565-aae4ff9007d8</Value>
		</Header>
	</Headers>
	<Content encoding="base64">LS0zN2FhM ... </Content>
</Response>

Operation ToBytesWithHeaders

The adapter operation ToBytesWithHeaders can be used to create a MIME document with all required header information, i.e. all headers must be created by the user.

If the Content element has the attribute encoding="base64" set, the attachment must be Base64 encoded twice.

Use case: Creating an HTML email with embedded images

Input: Example of a MIME XML document

XML
<Multipart>
	<Header>
		<Name>content-transfer-encoding</Name>
		<Value>binary</Value>
	</Header>
	<Header>
		<Name>content-type</Name>
		<Value>multipart/related; type="application/xop+xml";
			start="&lt;0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d&gt;";
			start-info="text/xml"</Value>
		<Type>multipart/related</Type>
		<Parameter>
			<Name>type</Name>
			<Value>application/xop+xml</Value>
		</Parameter>
		<Parameter>
			<Name>start</Name>
			<Value>&lt;0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d&gt;</Value>
		</Parameter>
		<Parameter>
			<Name>start-info</Name>
			<Value>text/xml</Value>
		</Parameter>			
	</Header>
	<Part>
		<Header>
			<Name>content-type</Name>
			<Value>application/xop+xml; charset=UTF-8; type="text/xml"</Value>
			<Type>application/xop+xml</Type>
			<Parameter>
				<Name>charset</Name>
				<Value>UTF-8</Value>
			</Parameter>
			<Parameter>
				<Name>type</Name>
				<Value>text/xml</Value>
			</Parameter>
		</Header>
		<Header>
			<Name>content-transfer-encoding</Name>
			<Value>binary</Value>
		</Header>
		<Header>
			<Name>content-id</Name>
			<Value>&lt;0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d&gt;</Value>
			<Id asUrl="cid:0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d">
				0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d</Id>
		</Header>
		<Content encoding="base64">PD94bWwgd ... </Content>
	</Part>
</Multipart>

Output: Example of a generated MIME document

TEXT
content-transfer-encoding: binary
content-type: multipart/related; type="application/xop+xml"; start="<0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d>"; start-info="text/xml"; boundary=1e66b8da-5b2c-425e-b502-7ffdefbe4283

--1e66b8da-5b2c-425e-b502-7ffdefbe4283
content-type: application/xop+xml; charset=UTF-8; type="text/xml"
content-transfer-encoding: binary
content-id: <0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d>


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:stoc="http://example.com/stockquote.xsd">
	<soapenv:Header/>
	<soapenv:Body>
		<blub>SGFsbG8gSGFsbG8g ...</blub>
		<bla>SGFsbG8=</bla>
		<foo>SGFsbG8=</foo>
		<bar>SGFsbG8=</bar>
	</soapenv:Body>
</soapenv:Envelope>
--1e66b8da-5b2c-425e-b502-7ffdefbe4283--

Operation FromBytesWithBoundaryFromFirstLine

The FromBytesWithBoundaryFromFirstLine adapter operation can be used to process parts of a MIME document (e.g. an email in EML format) in an output XML document in the same way as the FromBytesWithHeaders adapter operation , but no header block is expected here and the MIME body is processed directly - provided it is a valid multipart boundary. Otherwise the input is output as a part without header in the generated XML document.

Use case: SOAP via JMS. Here, a byte message is used that contains a MIME body without a MIME header. To be able to use MTOM here as well, a MIME multipart body without preamble is used.

Input: Example of a MIME body

TEXT
--XXXXboundary text 
Content-Type: text/plain

this is the body text
--XXXXboundary text 
Content-Type: text/plain;
Content-Disposition: attachment;
        filename="test.txt"

this is the attachment text
--XXXXboundary text--

Output: Example of a generated MIME XML document

XML
<Multipart>
    <Prolog />
    <Part>
        <Header>
            <Name>content-type</Name>
            <Value>text/plain</Value>
            <Type>text/plain</Type>
        </Header>
        <Content encoding="base64">dGhpcyBpcyB0aGUgYm9keSB0ZXh0DQo=</Content>
    </Part>
    <Part>
        <Header>
            <Name>content-type</Name>
            <Value>text/plain;</Value>
            <Type>text/plain</Type>
        </Header>
        <Header>
            <Name>content-disposition</Name>
            <Value>attachment; filename="test.txt"</Value>
            <Disposition>attachment</Disposition>
            <Parameter>
                <Name>filename</Name>
                <Value>test.txt</Value>
            </Parameter>
        </Header>
        <Content encoding="base64">dGhpcyBpcyB0aGUgYXR0YWNobWVudCB0ZXh0DQo=</Content>
    </Part>
    <Epilog />
</Multipart>

Operation ToBytesWithBoundaryInFirstLine

The ToBytesWithBoundaryInFirstLine adapter operation can be used to create a MIME document without a header block and, in the case of multiparts, without a preamble and without an epilog.

Use case: SOAP via JMS (with MTOM)

Input: Example of a MIME XML document

XML
<Multipart>
	<Header>
		<Name>content-transfer-encoding</Name>
		<Value>binary</Value>
	</Header>
	<Header>
		<Name>content-type</Name>
		<Value>multipart/related; type="application/xop+xml";
			start="&lt;0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d&gt;";
			start-info="text/xml"</Value>
		<Type>multipart/related</Type>
		<Parameter>
			<Name>type</Name>
			<Value>application/xop+xml</Value>
		</Parameter>
		<Parameter>
			<Name>start</Name>
			<Value>&lt;0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d&gt;</Value>
		</Parameter>
		<Parameter>
			<Name>start-info</Name>
			<Value>text/xml</Value>
		</Parameter>			
	</Header>
	<Part>
		<Header>
			<Name>content-type</Name>
			<Value>application/xop+xml; charset=UTF-8; type="text/xml"</Value>
			<Type>application/xop+xml</Type>
			<Parameter>
				<Name>charset</Name>
				<Value>UTF-8</Value>
			</Parameter>
			<Parameter>
				<Name>type</Name>
				<Value>text/xml</Value>
			</Parameter>
		</Header>
		<Header>
			<Name>content-transfer-encoding</Name>
			<Value>binary</Value>
		</Header>
		<Header>
			<Name>content-id</Name>
			<Value>&lt;0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d&gt;</Value>
			<Id asUrl="cid:0@4cd748bf-d5ea ...">0@4cd748bf-d5ea ...</Id>
		</Header>
		<Content encoding="base64">PD94bWwgdmVyc2 ...</Content>
	</Part>
</Multipart>

Output: Example of a generated MIME body document.

TEXT
--7aed8c79-1491-41a3-9122-c82b15d88fd0
content-type: application/xop+xml; charset=UTF-8; type="text/xml"
content-transfer-encoding: binary
content-id: <0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d>


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:stoc="http://example.com/stockquote.xsd">
	<soapenv:Header/>
	<soapenv:Body>
		<blub>SGFsbG8gSGFsbG8g ... </blub>
		<bla>SGFsbG8=</bla>
		<foo>SGFsbG8=</foo>
		<bar>SGFsbG8=</bar>
	</soapenv:Body>
</soapenv:Envelope>
--7aed8c79-1491-41a3-9122-c82b15d88fd0--

Operation FlattenXml

The FlattenXml adapter operation can be used to create a MIME multipart XML document that is prepared for sending with an X4 BPMS managed file transfer adapter, such as the HTTP(S) Adapter.

The result XML document for this is structured as follows:

  • It contains a base64 encoded string as a MIME body.
  • The headers are available as XML structure to easily configure an X4 transfer adapter.
  • The generated document is in MIME XML format of type Part. Therefore, you can use it to create other multipart documents.

Use case: Web service calls that require multipart documents

Input: Example of a MIME XML document

XML
<Multipart>
	<Header>
		<Name>content-transfer-encoding</Name>
		<Value>binary</Value>
	</Header>
	<Header>
		<Name>content-type</Name>
		<Value>multipart/related; type="application/xop+xml";
			start="&lt;0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d&gt;";
			start-info="text/xml"</Value>
		<Type>multipart/related</Type>
		<Parameter>
			<Name>type</Name>
			<Value>application/xop+xml</Value>
		</Parameter>
		<Parameter>
			<Name>start</Name>
			<Value>&lt;0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d&gt;</Value>
		</Parameter>
		<Parameter>
			<Name>start-info</Name>
			<Value>text/xml</Value>
		</Parameter>			
	</Header>
	<Part>
		<Header>
			<Name>content-type</Name>
			<Value>application/xop+xml; charset=UTF-8; type="text/xml"</Value>
			<Type>application/xop+xml</Type>
			<Parameter>
				<Name>charset</Name>
				<Value>UTF-8</Value>
			</Parameter>
			<Parameter>
				<Name>type</Name>
				<Value>text/xml</Value>
			</Parameter>
		</Header>
		<Header>
			<Name>content-transfer-encoding</Name>
			<Value>binary</Value>
		</Header>
		<Header>
			<Name>content-id</Name>
			<Value>&lt;0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d&gt;</Value>
			<Id asUrl="cid:0@4cd748bf-d5ea ...">0@4cd748bf-d5ea ...</Id>
		</Header>
		<Content encoding="base64">PD94bWwgdmVyc2 ...</Content>
	</Part>
</Multipart>

Output: Example of a generated MIME XML document

XML
<Part>
	<Header>
		<Name>content-transfer-encoding</Name>
		<Value>binary</Value>
	</Header>
	<Header>
		<Name>content-type</Name>
		<Value>multipart/related; type="application/xop+xml"; 
		  start="&lt;0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d&gt;"; 
		  start-info="text/xml"; boundary=da9a6ade-4452-4546-851c-84da7b638c24</Value>
		<Type>multipart/related</Type>
		<Parameter>
			<Name>type</Name>
			<Value>application/xop+xml</Value>
		</Parameter>
		<Parameter>
			<Name>start</Name>
			<Value>&lt;0@4cd748bf-d5ea-4d2f-89cd-18eb54442e0d&gt;</Value>
		</Parameter>
		<Parameter>
			<Name>start-info</Name>
			<Value>text/xml</Value>
		</Parameter>
		<Parameter>
			<Name>boundary</Name>
			<Value>da9a6ade-4452-4546-851c-84da7b638c24</Value>
		</Parameter>
	</Header>
	<Content encoding="base64">LS1kYTlhNmFkZ ...</Content>
</Part>

Operation PartFromX4Document

The PartFromX4Document operation converts the adapter input as the body of a Mime document (in the XML format of this adapter). A Content-Type Header is created with the corresponding values from the X4 document (these values can be influenced with the Document Properties Changer).

Convert X4Document properties to the Content-Type Header

X4Document mimeType
X4Document encoding
resulting Content-Type header
emptyemptyno Header
emptysomeCharsetno Header
some/typeemptyContent-Type: some/type
some/typesomeCharset

Content-Type: some/type; charset=someCharset

This operation is similar to the following adapter sequence:

  1. Base64 (encode) - Wrap input as Base64 string
  2. ElementWrapper (wrap) - Wrap Base64 string into XML document
  3. XSL - Put XML document in the appropriate form (and create the headers)
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.