Reputation: 11
I am currently sending SOAP XML requests and receiving a response from a third party API. I am looking to retrieve a particular value that is returned in the response and pass this to a subsequent request that goes back to the same API.
I am using the XPath extractor to achieve this however when I am trying to pass the response variable on, which is returned as
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header><wsse:Security xmlns:wsse="http://docs.oasis-
open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
.....
</soap:Header>
<soap:Body>
<c:replyMessage xmlns:c="---------------------------">
<c:referenceNumber>84c74155-e260-46f9-98bf-5ba6ee6cbb20</c:referenceNumber>
<c:backgroundCode>5048657036666628204009</c:backgroundCode>
.....
</c:replyMessage>
</soap:Body>
</soap:Envelope>
The fields I am attempting to pass are referenceNumber and backgroundCode using the XPath extractor response/c:referenceNumber however I receive the error
Assertion error: false
Assertion failure: true
Assertion failure message: Prefix must resolve to a namespace: c
See log file for further details.
Any advise would be greatly appreciated. If you need any more info please let me know.
Upvotes: 1
Views: 407
Reputation: 463
First of all: I strongly recommend you NOT TO USE XPath extractor. It is usually difficult to use and its performance is very bad. See this article or this article
Your choices for this task:
\<c:referenceNumber\>(.*)\<\/c:referenceNumber\>
//soap:Envelope/soap:Body/*[local-name()='replyMessage']/*[local-name()='referenceNumber']
. Do not forget to check Use Namespaces Upvotes: 1