My Desktop flow starts off with me invoking a SOAP web service to obtain a Error Code and Caller Token which will be used in a further web service to go on to update a workers details in a system. I first need this Error Code to do a validation whether the web method was successful or not and then obtain the Caller Token if it is.
The SOAP web service has been successful where I get the correct response code which is the following:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><AuthenticateCallerResponse xmlns="http://NHSP.StaffBankInterface"><AuthenticateCallerResult xmlns:a="http://schemas.datacontract.org/2004/07/BbyB.StaffBank_NHSP.StaffBankInterface" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:ErrorCode>0</a:ErrorCode><a:ErrorDescription i:nil="true"/><a:ResponseId>1</a:ResponseId><a:CallerToken>xVLwjsgwtYwejWDSAVOoq60VM94gMb4pxp
oqmTfLwjt3HesWm6QG7mXtxb8a1MpzWkzEzcGL7MKbWfObr%2fpjNNapC1GzGBsj0b56%2bMa8FkVMe26Uf1Pq%2bQ%3d%3d</a:CallerToken><a:ExpiresOn>2022-09-06T09:54:40.555625+01:00</a:ExpiresOn></AuthenticateCallerResult></AuthenticateCallerResponse></s:Body></s:Envelope>
As you can see the response code includes the Error Code and Caller Token, so therefore I need to pull the Error Code from this response to check the numeric value.
As this response is in a text format and I need it to be in XML to be able to use the Xpath expression. I wrote the response code into an XML file using the correct encoding. Then after reading the XML file and storing as a variable this is what the structure of the response code looks like now:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<AuthenticateCallerResponse xmlns="http://NHSP.StaffBankInterface">
<AuthenticateCallerResult xmlns:a="http://schemas.datacontract.org/2004/07/BbyB.StaffBank_NHSP.StaffBankInterface" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:ErrorCode>0</a:ErrorCode>
<a:ErrorDescription i:nil="true" />
<a:ResponseId>1</a:ResponseId>
<a:CallerToken>xVLwjsgwtYwejWDSAVOoq60VM94gMb4pxpoqmTfLwjt3HesWm6QG7mXtxb8a1MpzWkzEzcGL7MKbWfObr%2fpjNNapC1GzGBsj0b56%2bMa8FkVMe26Uf1Pq%2bQ%3d%3d</a:CallerToken>
<a:ExpiresOn>2022-09-06T09:54:40.555625+01:00</a:ExpiresOn>
</AuthenticateCallerResult>
</AuthenticateCallerResponse>
</s:Body>
</s:Envelope>
Then using the "Get XML element value" I enter the variable for the XML document as shown above and use the Xpath query "/s:Envelope/s:Body/AuthenticateCallerResponse/AuthenticateCallerResult/a:ErrorCode" to get the output variable as a numeric value.
The error message I receive from this action is the following:
"Invalid XPath expression provided"
"Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function."
I've tried many different type of XPath expressions but it still come back as invalid and so far the only expression that has worked is "//*" where it returned all of the element values in one string which is not helpful in my case.
Any assistance would be appreciated. I can supply more detail if required.

Report
All responses (
Answers (