Set message formats

The format indicates the type of message protocol used for the payload of messages.

  • For inbound messages, the format defines how the payload format is converted to the format used by OSV.

  • For outbound messages, the format defines, in which format the payload is sent.

The following chapters contain an overview on all possible format types.

As of Tricentis Tosca 11.1, setting message formats is no longer required. OSV will detect the message format automatically.

For information on how to specify the format in the service port, see chapter "Create and edit service ports".

OSV offers the following format types:

Auto

Auto allows the system to automatically select the format. The Payload of the message defines the format.

Tricentis recommends selecting format Auto.

None

Select None if a message has no payload.

Json

Select Json to convert messages from and into JSON format.

URL Encoded

Select URL Encoded to convert messages from and into url-encoded key-value pairs.

The key-value pairs are separated by an ampersand (&). The keys and their values are separated by an equals sign (=).

customerId=D200906&shopId=A1&paymentType=CCARD&amount=349.00

Xml

Select xml to convert messages from and into the XML format.

To define XML namespaces, set the technical parameter NamespaceURI and define the value of the NamespaceURI parameter for the respective ModuleAttribute.

You can also define explicit namespace prefixes in the Scenario.

Explicit prefixes require that you specify the prefix and the namespace of the message element. You can define it for either the message element or its superordinate message element.

If you modify the value of a prefix declaration, you have to modify the DefaultValue in the Module as well.

Xml CDATA

Strings and XML tags are interpreted as text in CDATA sections of a message.

For inbound messages, which include a CDATA element along with an XML root element, the Xml CDATA format will remove the <![CDATA[]]> tag.

Example: The following expression of the inbound message

<hi>

<![CDATA[<content>hello world!</content>]]>

</hi>

is converted as follows:

<hi>

<content>hello world!</content>

</hi>

For outbound messages, the system adds the <![CDATA[]]> tag to the parameter CdataPath on the basis of the XPath.

Parameter CdataPath

When you import recorded messages into Tosca Commander, the system creates the technical ID parameter CdataPath.

The value is a simplified XPath to the element, which was part of the CDATA section prior to transformation.

In the example shown above this is CdataPath/hi.

The XPath must point to a valid node in the XML document. The first node beneath is assigned with a <![CDATA[]]> tag.

CdataPath parameter

Example: a node is assigned with the <![CDATA[]]> tag on the basis of the CdataPath. The following expression

<books>

<book>

<title>XY</title>

<author>WZ</author>

</book>

</books>

is converted into:

<books>

<book>

<![CDATA[<title>XY</title>]]>

<author>WZ</author>

</book>

</books>

Parameter CdataXmlDefinition

When you import recorded messages into Tosca Commander, the system creates the technical ID parameter CdataXmlDefinition.

The value is an XML declaration if an XML declaration exists.

Example: The following expression

<hi>

<![CDATA[<?xml version="1.0" encoding="utf-8"?><content>hello world!</content>]]>

</hi>

is converted as follows:

<hi>

<content>hello world!</content>

</hi>

The parameter CdataXmlDefinition includes the value <?xml version="1.0" encoding="utf-8"?>.