DML functions: Message Attachments

Message Attachment Functions

addAttachment

countAttachments

getAttachmentContentId

getAttachmentContentType

getAttachmentData

selectAllAttachments

selectAllAttachmentsForOutput

selectAttachment

selectAttachmentsForOutput

unselectAllAttachments

unselectAllAttachmentsForOutput

unselectAttachment

unselectAttachmentForOutput

Message Attachment functions (for SwA)

SOAP with Attachments (SwA) is a W3C Note that defines a means of carrying attachments with SOAP messages.

SOAP attachments, like email attachments, are small to medium sized supplemental objects that are sent with a main message but that are not part of it. Like email, SwA uses MIME (Multipurpose Internet Mail Extensions) to carry the SOAP envelope with the attachments.

Use SwA

Unlike most other Web Service standards, SwA is not driven by WS-Policy but is a pure SOAP feature. The Map Engine provides dedicated DML functions that enable you to manipulate the attachments linked to messages in the current message flow.

There is no functional distinction between attachment handling in consumer and provider modes of Web Service. The DML functions described in this topic operate directly on the Integration-Process data flow.

Soap message attachments are linked to the data flow but must be selected (via the DML functions described in this topic) to be part of the effective SOAP exchanges.

Function descriptions

The following functions are available for SwA:

addAttachment

addAttachment Comment

Description

addAttachment adds an attachment to the SOAP message flow.

Syntax

addAttachment(ContentType, Data)

addAttachment(ContentId, ContentType, Data)

Returns

Does not return a value.

Parameters

ContentId (String): The MIME identifier of the attachment.

ContentType: MIME type of the attachments (for example, "image/Jpeg" or "application/bit-stream").

Data (Very Large Object): Refers to the Business Document element that represents the data in the message.

Examples

addAttachment(jpeg, in:photo)

Attaches the photo element of the DML Block input Business Document.

countAttachments

countAttachments Comment

Description

countAttachments returns the number of attachments that are associated with the flow.

Syntax

countAttachments()

Returns

Number of attachments associated with the flow (Integer).

Parameters

None

Example

countAttachments() returns the number of attachments associated with the current message in the message flow.

getAttachmentContentId

getAttachmentContentId Comment

Description

getAttachmentContentId returns the ContentId of a given attachment selected by index.

Syntax

getAttachmentContentId(Index)

Returns

String

Parameters

index (Integer):

The index position of the element in the MIME container.

getAttachmentContentType

getAttachmentContentType Comment

Description

getAttachmentContentType returns the MIME type of a given attachment selected by index or identifier.

Syntax

getAttachmentContentType(ContentId)

getAttachmentContentType(Index)

Returns

String

Parameters

ContentId (String): The MIME identifier of the attachment.

Index (Integer): The index position of the element in the MIME container.

Example

getAttachmentContentType("uuid:18B9C499B9E8E225E7115978613677210@example.org")

This example shows the use of a hypothetical Contentid in the function.

getAttachmentData

getAttachmentData Comment

Description

getAttachmentData returns the content of a given attachment selected by index or identifier.

Syntax

getAttachmentData(ContentId)

getAttachmentData(Index)

Returns

Very Large Object

Parameters

ContentId (String): The MIME identifier of the attachment.

Index (Integer): The index position of the element in the MIME container.

Example

getAttachmentData(2)

The function returns the content of the attachment with the index "2".

selectAllAttachments

selectAllAttachments Comment

Description

selectAllAttachments attaches all attachments of the current message context to the next consumer request or provider response.

Syntax

selectAllAttachments()

Return

Does not return a value.

Parameter

None

Examples

selectAllAttachments()

selectAllAttachmentsForOutput

selectAllAttachmentsForOutput Comment

Description

selectAllAttachmentsForOutput attaches all attachments in the current message context to the next consumer request or provider response for the given output of the DML Block.

Syntax

selectAllAttachmentsForOutput(OutputName)

Returns

Does not return a value.

Parameters

OutputName (String): Name of the DML Block output.

Examples

selectAllAttachmentsForOutput(MainOutput)

Specifies the DML Block output with the name "MainOutput" as the target of all attachments in the current message.

selectAttachment

selectAttachment Comment

Description

selectAttachmentattaches specified attachments of the current message context to the next consumer request or provider response.

Syntax

selectAttachment()

selectAttachment()

Returns

Does not return a value.

Parameters

ContentId (String): The MIME identifier of the attachment.

Index (Mapping Services):

The index position of the element in the MIME container.

Examples

selectAttachment(3)

selectAttachment(3)

Selects attachments with the index "3".

selectAttachmentsForOutput

selectAttachmentsForOutput Comment

Description

selectAttachmentsForOutput attaches specified attachments of the current message context to the next consumer request or provider response for the given output of the DML Block.

Syntax

selectAttachmentsForOutput(ContentId,OutputName)

selectAttachmentsForOutput(Index,OutputName)

Returns

Does not return a value.

Parameters

ContentId (String): The MIME identifier of the attachment.

Index (Integer): The index position of the element in the MIME container.

OutputName (String): Name of the DML Block output.

Example

selectAttachmentsForOutput ("uuid:18B9C499B9E8E225E7115978613677210@example.org","MainOutput")

This example shows the use of a hypothetical contentId in the function. The function links the attachment specified by the contentId to the DML Block output with the name "MainOutput".

unselectAllAttachments

unselectAllAttachments Comment

Description

unselectAllAttachments removes all attachments from the next consumer request or provider response.

Syntax

unselectAllAttachments()

Returns

Does not return a value.

Parameters

None

Example

unselectAllAttachments()

unselectAllAttachmentsForOutput

unselectAllAttachmentsForOutput Comment

Description

unselectAllAttachmentsForOutput removes all attachments from the next consumer request or provider response belonging to the specified DML Block output.

Syntax

unselectAllAttachmentsForOutput(OutputName)

Returns

Does not return a value.

Parameters

OutputName: Name of the DML Block output which will not contain attachments.

Example

unselectAllAttachmentsForOutput("MainOutput")

This example removes all attachments from the next consumer request or provider response that transits on the DML Block output named "MainOutput".

unselectAttachment

unselectAttachment Comment

Description

unselectAttachment removes specified attachments from the next consumer request or provider response.

Syntax

unselectAttachment(ContentId)

unselectAttachment(Index)

Returns

Does not return a value.

Parameters

ContentId (String): The MIME identifier of the attachment.

Index (Integer): The index position of the element in the MIME container.

Example

unselectAttachment(2)

Removes the attachment with Index number 2 from the next consumer request or provider response.

unselectAttachmentForOutput

unselectAttachmentForOutput Comment

Description

unselectAttachmentForOutput removes specified attachments from the next consumer request or provider response belonging to the specified DML Block output.

Syntax

unselectAttachmentForOutput(ContentId,OutputName)

unselectAttachmentForOutput(Index,OutputName)

Returns

Does not return a value.

Parameters

ContentId (String): The MIME identifier of the attachment.

Index (Integer): The index position of the element in the MIME container.

OutputName(String): Name of the DML Block output.

Example

unselectAttachmentForOutput ("uuid:18B9C499B9E8E225E7115978613677210@example.org","MainOutput")

This example shows the use of a hypothetical contentId in the function. The function removes the attachment specified by the contentId from messages that transit on the DML Block output with the name "MainOutput".

Related Links