soap to json transformer

SOAP to JSON Transformer

Version: 17.01

Supported Since: 17.01

What is an SOAP to JSON Transformer?

A SOAP to JSON Transformer is a processing element which transforms an SOAP message payload to a JSON payload. This is similar to the XML to JSON Transformer processing element, except this processing element transforms only the SOAP payload (i.e. the XML part within the soapenv:Body element) to JSON.

This transformation is done based on a generic set of rules and hence this processing element is most suitable for simple transformations. For complex transformations based on custom rules, Adroitlogic Data Mapping Tool is recommended.

Sample Use Case

In the following use case, the requirement is to read a message with an SOAP payload from a SFTP server, convert the message payload to JSON and then deliver it to another SFTP endpoint.

soap to json flow
soap to json config

In this flow, the "Processor" outport of SFTP ingress connector is connected to the inport of the SOAP to JSON Transformer so that the SFTP message received by the connector is handed over to the transformer next. If the processing element is able to transform the payload from SOAP to JSON successfully, the message with the transformed payload is handed over to the SFTP egress connector, as the "Next" outport of the SOAP to JSON Transformer is connected to it.

In the case of transformation failure, a log will be generated and then the message flow will complete in an exceptional state, as the "On Exception" outport of the SOAP to JSON Transformer is connected to a Logger processing element, followed by an Exceptional Flow End element.

Out Ports

Next

The message will be sent to this outport if the payload transformation is completed successfully

On Exception

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

Parameters

Starting element

Basic

An optional starting element name to begin transformation from. This must be an element within the SOAP payload. If this is specified, only the XML part within the specified element will be converted to JSON and set as the new payload of the message. If SOAP payload does not contain such element, the resulting payload will be empty.

This parameter can be specified in either of the following formats.

  • namespace_prefix:local_part

  • local_part

Retain namespace prefixes

Basic

Whether to retain namespace prefixes of SOAP tags in the JSON keys as well. By default this parameter is set to true.

Key for content

Basic

In case where an SOAP element has one or more attributes in addition to the textual content, the value of this parameter will be used as the JSON key for the textual content. This parameter is optional and defaults to "value".

For example refer the following sample SOAP content.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
         <request>
            <symbol id="1">ADRT</symbol>
         </request>
   </soapenv:Body>
</soapenv:Envelope>

Notice that in the following converted JSON output, textual content of symbol element is contained under the key "value", which is the value of this parameter.

{
    "request":{
        "symbol":{
            "id":"1",
            "value":"ADRT"
        }
    }
}
In this topic
In this topic
Contact Us