wrap payload processor

Wrap payload processor

Version: 17.07

Supported Since: 17.07

What is a Wrap Payload processor?

A Wrap Payload processor is a processing element which accepts a message with an XML payload, wraps that XML with an element with the provided name (optionally with a namespace URI) and sets the resulting document as the current payload of the message.

In order to use this processing element, you must first select the Regular XML Processors dependency from the processor list when you are creating an empty Ultra project. If you have already created a project, you can add this dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Processors list, select the Regular XML Processors dependency.

wrap payload outports

Out Ports

Next

The message will be sent to this outport if the wrapping is executed successfully

On Exception

The message will be sent to this outport if the processing element failed to wrap the payload due to some reason

Parameters

Element name *

Basic

The qualified name of the element which will wrap the message payload. A custom prefix can be specified as myns:myqname.

Namespace URI

Basic

If it is required to add a custom namespace URI to the wrapping element, it can be specified as the value of this parameter

Sample Use Case

In the following use case, a message with an XML payload will be received from a source JMS queue and it should be delivered to a target system through SFTP. But the target system expects the root element to be always <content> irrespective of the child content. The requirement is to get the message from the source JMS queue, wrap the content with the <content> tag and then send it to the target SFTP location.

Prerequisites

In order to implement following use case following dependencies should be selected when an empty Ultra project is being created.

  • Spring JMS Connector

  • SFTP Connector

  • XML Processors

If the project is already created, above dependencies can be added via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Connectors list and Processors list, select above dependencies.

wrap payload flow

In this flow, a Spring JMS ingress connector is used to retrieve the message from the source queue and its "Processor" outport is connected to the inport of the Wrap Payload processor so that the XML message received by the connector is handed over to the processor next.

The Element name property of the processor is configured as content and as a result, the processing element will wrap the contents of the message under the tag <content>, set the wrapped content as the payload of the message and then handover it to the SFTP Egress Connector. It will upload the message to a configured remote server.

Example

For example, assume that the message contains the following XML payload.

<?xml version="1.0" encoding="UTF-8"?>
<person id="1">
    <name>Aladdin Strickland</name>
    <email>rhoncus@laciniaorciconsectetuer.ca</email>
    <company>At LLP</company>
    <country>Slovenia</country>
</person>

That will be wrapped with content root element as follows.

<?xml version="1.0" encoding="UTF-8"?>
<content>
    <person id="1">
        <name>Aladdin Strickland</name>
        <email>rhoncus@laciniaorciconsectetuer.ca</email>
        <company>At LLP</company>
        <country>Slovenia</country>
    </person>
</content>
Optionally a namespace URI can be added to the wrapping element by configuring the Namespace URI property of the processing element.
In this topic
In this topic
Contact Us