SOAPUI Property Transfer XPATH
I am new to SOAPUI and have a simple question about Property Transfer. The Response I want to transfer is:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<AddResponse xmlns="http://tempuri.org/">
<AddResult>11</AddResult>
</AddResponse>
</soap:Body>
</soap:Envelope>
The Request I want to transfer to is:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:Subtract>
<tem:intA>5</tem:intA>
<tem:intB>2</tem:intB>
</tem:Subtract>
</soapenv:Body>
</soapenv:Envelope>
The Property Transfer Source is (using XPath language):
declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/';
declare namespace ns1='http://tempuri.org/';
//ns1:AddResponse[1]/ns1:AddResult[1]
The Property Transfer Target is (using XPath language):
declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/';
declare namespace ns1='http://tempuri.org/';
//ns1:tem:Subtract[1]/ns1:tem:intA[1]
The error I get is:
[net.sf.saxon.trans.XPathException: XPath syntax error at char 19 on line 2 in {\n//ns1:tem:Subtract/tem:intA}: Invalid QName local part {tem:Subtract}]
I have tried many different combinations of the Target XPath but get the same error. Note that the Source XPath is valid when I use it in an assertion on the Source alone.
Can someone tell me what I am doing wrong.
In your request, you are calling the 'http://tempuri.org/' namespace with the tem prefix. When you declare the name spaces for your Property Transfer, it has automatically prefixed that same namespace as ns1. So you need to change the declaration, or change your path.
declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/'; declare namespace ns1='http://tempuri.org/'; //ns1:Subtract[1]/ns1:intA[1]
or
declare namespace soap='http://schemas.xmlsoap.org/soap/envelope/'; declare namespace tem='http://tempuri.org/'; //tem:Subtract[1]/tem:intA[1]