我目前正在发送SOAP XML请求并接收来自第三方API的响应。我希望检索在响应中返回的特定值,并将其传递给返回相同API的后续请求。
但是,当我尝试传递response变量时,我使用XPath提取器来实现这一点,该变量返回为
<?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>我尝试传递的字段是使用XPath提取器响应/c: referenceNumber的referenceNumber和backgroundCode,但是我收到了错误
Assertion error: false
Assertion failure: true
Assertion failure message: Prefix must resolve to a namespace: c
See log file for further details.任何建议都将不胜感激。如果你需要更多的信息,请让我知道。
发布于 2017-09-08 20:15:09
首先:我强烈建议你不要使用XPath extractor。它通常很难使用,性能也很差。请参阅this article或this article
您对此任务的选择:

\<c:referenceNumber\>(.*)\<\/c:referenceNumber\> 
,
//soap:Envelope/soap:Body/*[local-name()='replyMessage']/*[local-name()='referenceNumber']。不要忘记选中Use Namespaces 
https://stackoverflow.com/questions/46114318
复制相似问题