WSDL message to XML document conversion
The Document Literal and RPC Encoded styles define two different mechanisms for constructing the XML document that makes up the body of a SOAP Envelope.
When the Document Literal style is used, the XML document that is created is in a tree structure that resembles a common XML document. The RPC Encoded style creates a flat XML document with cross-references from an element to its children.
The Document-Literal and RPC-Encoded message formatters handle the two styles within HCL OneTest™ API. During the message compilation process that occurs during publishing, these formatters take the HCL OneTest™ API messages that are created by using the WSDL schemas. The format is specified in section 6.1, and is used to create the required XML document structure. During the de-compilation process that occurs within a subscriber, they take the received XML Document and create a HCL OneTest™ API message structure that adheres to the formats specified in section 6.1.
Document literal message to XML conversion
The Document-Literal formatter takes a WSDL-based HCL OneTest™ API Message and creates an XML Document that represents a SOAP Envelope that is based on the HCL OneTest™ API message. The root message represents the SOAP Envelope. The formatter creates an envelope element that contains all of the instance-specific namespaces as well as the standard SOAP namespace definitions (see SOAP Envelope namespace attributes). A SOAP Body element is created as a child of the SOAP Envelope. Within the output XML, the SOAP Body contains the XML data that is to be sent.
The only child message of the root represents the contents of the SOAP Body element. This message and all of its children are converted to XML in the same manner as XML is created within the XML Text Message Formatter. The XML generated for this message is added as the child of the SOAP Body.
The following is the XML output that is generated by the Document Literal formatter for the example message that is provided in the previous topic.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/
xmlns:xsd=http://www.w3.org/2001/XMLSchema
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xmlns:tns="http://www.4d.com/namespace/default">
<soapenv:Body>
<tns:LOTTO_NumCheck_SingleSet_Hist xsi:type="xsd:any">
<tns:inN1 xsi:type="xsd:int">4</tns:inN1>
<tns:inN2 xsi:type="xsd:int">6</tns:inN2>
<tns:inN3 xsi:type="xsd:int">13</tns:inN3>
<tns:inN4 xsi:type="xsd:int">23</tns:inN4>
<tns:inN5 xsi:type="xsd:int">34</tns:inN5>
<tns:inN6 xsi:type="xsd:int">45</tns:inN6>
<tns:inHistoric xsi:type="xsd:boolean">
true
</tns:inHistoric>
</tns:LOTTO_NumCheck_SingleSet_Hist>
</soapenv:Body>
</soapenv:Envelope>
RPC Encoded message to XML conversion
The RPC-Encoded Formatter takes a WSDL-based HCL OneTest™ API message and creates an XML Document that represents a SOAP Envelope that is based on the HCL OneTest™ API message. The first few levels of the XML are created in the same style as the Document-Literal Formatter. The root message represents the SOAP Envelope. The formatter creates an envelope element that contains all of the instance-specific namespaces as well as the standard SOAP namespace definitions (see SOAP Envelope namespace attributes). A SOAP Body element is created as a child of the SOAP Envelope. Within the output XML, the SOAP Body contains the XML data that is to be sent.
The only child message (data root) of the root represents the contents of the SOAP Body. Unlike the Document literal style, where the XML document is created in a tree structure, the RPC Encoded style creates XML that is in a flat structure, with elements that contain references to their children.
The data root has an element that is created as a child of the SOAP Body element that contains the name of the data root. For each child of the data root, a child element is added to the data root element that has the name of the child node and an href attribute that contains a reference id. For each of the child messages a multiref element is also created that is added as a child of the SOAP Body element. This multiref element has an id attribute that is used for linking an element to its children. This multiref element can then either contain textual content or child elements with href attributes that link the multiref element to its child elements. Namespace information and other encoding information are also added to each multiref element.
The following is the XML output that is generated by the RPC Encoded formatter for the example message that is provided in the previous topic.
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ns0="urn:xmethods-CurrencyExchange">
<soapenv:Body>
<ns0:getRate
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<country2 href="#id0"/>
<country1 href="#id1"/>
</ns0:getRate>
<multiRef id="id0" soapenc:root="0"
soapenv:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/
xsi:type="xsd:string"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
united kingdom
</multiRef>
<multiRef id="id1" soapenc:root="0"
soapenv:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/
xsi:type="xsd:string"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
united states
</multiRef>
</soapenv:Body>
</soapenv:Envelope>