XFA Specification
Chapter 11, Forms That Initiate Interactions with Servers
Using Web Services
339
xmlns="http://schemas.xmlsoap.org/soap/envelope/"]
[dataGroup (tns:TradePriceRequest)
xmlns="http://example.com/stockquote.wsdl"]
[dataValue (tns:tickerSymbol) = "stockTickerSymbol"
xmlns="http://example.com/stockquote.wsdl"]
This is exactly equivalent to the input message shown above. The mapping between XML and objects in
the Connection Data DOM is the same as the default mapping rules used in the regular Data DOM, as
described in
“Default Data Mapping Rules” on page 121.
Replying to the Web Server and Error Responses
After the
preExecute
event finishes, the input message in the Connection Data DOM is converted to
XML and sent to the web server. The web server replies with the output message, also in XML.
In the example, if the query succeeds, the output message contains the share price for the requested
stock. This data is wrapped inside a SOAP envelope. In addition, when the query fails, the element
soap:Fault
is returned. As described in [SOAP1.1], the
soap:Fault
element is a child of the
soap:Body
element.
soap:Fault
contains a fault code and a human-readable (but not localized) fault
string. When the query succeeds, the message does not contain a
soap:Fault
element.
If there is a communication error or an error reported by the HTTP protocol, the XFA client is unable to
receive the output message. In this case the client generates an error message, clears the Connection Data
DOM, and terminates the transaction.
Upon receipt of the output message, the client XFA processor parses it and adds its content to the
Connection Data DOM. Nodes that are already present (as parts of the input message) are retained. If a
particular node corresponds to content in both the input and output messages, its value is updated in
place.
After the output message is added to the Connection Data DOM, the client XFA processor triggers a
postExecute
event. In preparation for the
postExecute
event it copies the fault code and fault string
into
$event.soapFaultCode
and
$event.soapFaultString
, respectively. If the query succeeds,
these elements are not present in the output message, and the values of
$event.soapFaultCode
and
$event.soapFaultString
are both empty strings (“”). Note that the event properties
$event.soapFaultCode
and
$event.soapFaultString
are only available for the duration of the
postExecute
event, hence only to scripts activated by the
postExecute
event. The following fragment
illustrates how a script can check for the failure of the query:
<event activity="postExecute"
ref="$connectionSet.TickerPriceWS">
<script>
if ($event.soapFaultCode == "")
{
// No fault code. Check for the header:
// connectionData.TickerPriceWS.Header
if (connectionData.nodes.namedItem("Header") != null)
{
// Header exists - do something with it...
}
}
else
{
// display $event.soapFaultString...
}
Home Index Bookmark Pages
Pages: Home Index All Pages