SDhwaj February 2016

Extracting Multiple Value from SOAP Response

I have an XML Response in SOAP which has the below format

<diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <NewDataSet xmlns="">
    <Status diffgr:id="Status12" msdata:rowOrder="11">
    <id>28</id>
    <name>Review</name>
    <categoryId>3</categoryId>
    <assignrule>P</assignrule>
    <ismoveAssign>0</ismoveAssign>
    <isActive>1</isActive>
    </Status>
    </NewDataSet>
</diffgr:diffgram>

The following XPath shown below if I execute the same in XPath Match configuration of SOAPUI please find the screen shot attached

//*[local-name() = 'NewDataSet']/*[local-name()='Status'][12]/*[local-name()='name']

But I have many such values which need to extracted by writing an XQuery.

enter image description here

<Result>
{
    for $x in //*[local-name() = 'NewDataSet']/*[local-name()='Status']/*    [local-name()='name']

    return <name> string ($x) </name>
}
</Result>

The above result gives Invalid XPath.

Can someone help me where I am going wrong? Would this information be sufficient?

Answers


albciff February 2016

The problem is probably that you're using an XPath Match assertion with a XQuery expression. If you check the SOAPUI execution log you will see:

22:19:20,008 ERROR [SoapUI] An error occurred [net.sf.saxon.trans.XPathException: XPath syntax error at char 0 in {<}
: Node constructor expressions are allowed only in XQuery, not in XPath].

There is a specific assertion of XQuery Math, use this instead:

enter image description here

Hope it helps,

Post Status

Asked in February 2016
Viewed 1,708 times
Voted 9
Answered 1 times

Search




Leave an answer