Databases Reference
In-Depth Information
The issue here is that there is no guarantee that the same prefix will always be used,
which could cause our condition to be incorrectly evaluated.
Getting the qualified fault name
To ensure that our test condition is correctly evaluated, we need to fully resolve the
QName . We can do this by using the XQuery function resolve-QName . This takes two
parameters. The first contains the QName that we wish to resolve (that is faultcode ),
the second contains an element in which the namespace prefix is defined (that is
soap:Fault ). This gives us a function call that looks likes the following:
fn:resolve-QName($body/soap:Fault/faultcode,$body/soap:Fault)
As we will need to test this value multiple times, rather than embed this within
our if condition, we can use an Assign action to assign it to a variable (for example,
$faultcode ).
Our modified condition to test for a fault of type mcd:declined would now look like
the following:
$faultcode='{http://xmlns.packtpub.com/MasterCard}declined'
We can now define an 'If… Then…' action, with one branch for each fault we want
to test for, plus an else branch to cover any unexpected faults.
Creating a SOAP Fault
Once we know the fault returned by the external service, we can generate the
appropriate fault to be returned by the proxy service and assign this to the
$body variable.
The simplest way to do this is by creating an Assign action, and for the XQuery Text ,
we directly specify the actual SOAP Fault to be returned, as shown in the
next screenshot:
 
Search WWH ::




Custom Search