Reputation: 23
I have a soap response containing transaction ID (TranId).
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m0="http://schemas.blablabla.com/two/1.0/filter.xsd" xmlns:m="http://schemas.blablabla.com/two/1.0/filter.wsdl">
<SOAP-ENV:Body>
<m:AcctDebitRp xmlns:m="http://schemas.blablabla.com/two/1.0/filter.xsd">
<Response Response="1" TranId="**30538801**" Ver="14.3" Product="filter">
<m0:ApprovalCode>557885</m0:ApprovalCode>
</Response>
</m:AcctDebitRp>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
How can I retrieve transaction id value ?
I am using the below code in SoapUI property transfer step to retrieve the value of ApprovalCode:
declare namespace ns1='http://schemas.blablabla.com/two/1.0/filter.xsd';
//ns1:ApprovalCode
Is it possible to get the TranId value using XQuery in property transfer step or using groovy script step?
Upvotes: 1
Views: 581
Reputation: 38722
You can query for attributes using an @attributename
child step. In the example you provided, the <Response/>
element has no namespace attached, thus the query for the attribute is a simple
//*:Response/@TranId
If you only want the attribute value, consider applying the data(...)
function:
data(//*:Response/@TranId)
Upvotes: 1