This topic explains how to deal with messages that belong to the MIME domain, and that are parsed by the MIME parser. Use this information in conjunction with the information in Manipulating message body content.
The logical tree can be manipulated using ESQL before the message is passed on to other nodes in the message flow. A message flow can also create a MIME domain tree using ESQL. When a MIME domain message reaches an output node, the MIME parser is called to rebuild the bit stream from the logical tree.
CREATE FIELD OutputRoot.MIME TYPE Name; DECLARE M REFERENCE TO OutputRoot.MIME; CREATE LASTCHILD OF M TYPE Name NAME 'Data';
DECLARE partData BLOB ASBITSTREAM(InputRoot.XML); CREATE LASTCHILD OF M.Data DOMAIN('BLOB') PARSE(partData);
DECLARE partData BLOB ASBITSTREAM(InputRoot.XML); CREATE LASTCHILD OF M.Data DOMAIN('BLOB') NAME 'BLOB'; CREATE LASTCHILD OF M.Data.BLOB NAME 'BLOB' VALUE partData;
Both of these approaches create the same tree structure. The first approach is recommended because explicit knowledge of the tree structure that the BLOB parser requires is not built into the flow.
DECLARE part1Data BLOB ASBITSTREAM(InputRoot.XML.part1); DECLARE part2Data BLOB ASBITSTREAM(InputRoot.XML.part2); SET OutputRoot.Properties.ContentType = 'multipart/related; boundary=myBoundary'; CREATE FIELD OutputRoot.MIME TYPE Name; DECLARE M REFERENCE TO OutputRoot.MIME; CREATE LASTCHILD OF M TYPE Name NAME 'Parts'; CREATE LASTCHILD OF M.Parts TYPE Name NAME 'Part'; DECLARE P1 REFERENCE TO M.Parts.Part[1]; CREATE FIELD P1."Content-Type" TYPE NameValue VALUE 'text/plain'; CREATE FIELD P1."Content-Id" TYPE NameValue VALUE 'part one'; CREATE LASTCHILD OF P1 TYPE Name NAME 'Data'; CREATE LASTCHILD OF P1.Data DOMAIN('BLOB') PARSE(part1Data); CREATE LASTCHILD OF M.Parts TYPE Name NAME 'Part'; DECLARE P2 REFERENCE TO M.Parts.Part[2]; CREATE FIELD P2."Content-Type" TYPE NameValue VALUE 'text/plain'; CREATE FIELD P2."Content-Id" TYPE NameValue VALUE 'part two'; CREATE LASTCHILD OF P2 TYPE Name NAME 'Data'; CREATE LASTCHILD OF P2.Data DOMAIN('BLOB') PARSE(part2Data);
SET OutputRoot = InputRoot; -- Check to see if the MIME message is multipart or not. IF LOWER(InputProperties.ContentType) LIKE 'multipart/%' THEN CREATE LASTCHILD OF OutputRoot.MIME.Parts NAME 'Part'; DECLARE P REFERENCE TO OutputRoot.MIME.Parts.[<]; CREATE FIELD P."Content-Type" TYPE NameValue VALUE 'text/xml'; CREATE FIELD P."Content-ID" TYPE NameValue VALUE 'new part'; CREATE LASTCHILD OF P TYPE Name NAME 'Data'; -- This is an artificial way of creating some BLOB data. DECLARE newBlob BLOB '4f6e652074776f2074687265650d0a'; CREATE LASTCHILD OF P.Data DOMAIN('BLOB') PARSE(newBlob); END IF;
SET OutputRoot.Properties.ContentType = 'text/plain';Do not set the Content-Type value directly in the MIME tree or HTTP trees. This can lead to the value being ignored or used inconsistently.
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
ac30000_ |