Property transfer from response of one request to another request
Hi
Am new to Soap UI, Please help me in this.
I have to transfer response value of my response XML to another request XML.
Source response XML :
<ReceiptId idOwner="ABC">
<IdValue name="ReceiptID">154068</IdValue>
</ReceiptId>
Target Request XML :
<ReceiptId idOwner="ABC">
<IdValue name="ReceiptID">154068</IdValue>
</ReceiptId>
for which i am using property transfer but getting error.
RecieptID [net.sf.saxon.trans.XPathException: XPath syntax error at char 11 on line 2 in {\n//IdValue name=}:
Unexpected token name "name" beyond end of expression]
Waiting for early response.
Thanks,
Oct21
Thank you Oct21 for the response.
First <CDATA> part needs to be extracted and then extract the value that is needed.
Use below Script Assertion for the first soap request itself and no extra groovy script required.
/** * Script Assertion for the first request * Extracts the required id value * and saves at test case level custom properties * which can be used later steps * where required **/ assert context.response def getData = { data, element -> new XmlSlurper().parseText(data).'**'.find {it.name() == element} } def inXmlStr = getData(context.response, 'TA_RegisterCandidateForAssessmentResult').text() def receiptId = getData(inXmlStr, 'ReceiptId') context.testCase.setPropertyValue('ID', receiptId.IdValue.toString())
In the next request, use ${#TestCase#ID} where the value is needed.