Hi All,
I want to count particular xml node from web service output xml file in soap UI. I have used Assertion xPath match functionality, but still no luck. Web service output is like the below :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <doSelectResponse xmlns="http://www.ca.com/UnicenterServicePlus/ServiceDesk"> <doSelectReturn xmlns=""><![CDATA[<?xml version="1.0" encoding="UTF-8"?><UDSObjectList><UDSObject><Handle>chg:1509967</Handle><Attributes><Attribute DataType="2002"><AttrName>chg_ref_num</AttrName><AttrValue>Chg #1121138</AttrValue></Attribute></Attributes></UDSObject><UDSObject><Handle>chg:1509562</Handle><Attributes><Attribute DataType="2002"><AttrName>chg_ref_num</AttrName><AttrValue>Chg #1120733</AttrValue></Attribute></Attributes></UDSObject><UDSObject><Handle>chg:1509474</Handle><Attributes><Attribute DataType="2002"><AttrName>chg_ref_num</AttrName><AttrValue>Chg #1120645</AttrValue></Attribute></Attributes>
Can anybody please help me in this, need to count the number of occurrence for change order ids.
Use the variable transfer operation to:
* copy the CDATA section (which is an XML) to a local variable
* then apply an XPath expression to the variable to count the Handle node occurences.
Mandar...
Did the information that Cristi provide assist you?
If so, please mark the answer as correct so that this thread can be closed.
Hi Paul,
not actually worked on it yet, need to check how to transfer CDATA section to local variable, will update you once it gets resolved
If its just a count that you are looking for, how about using a doQuery to get a list length? listLength then contains the array list that you can parse later on if need by, but the value is the count in a way.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ca.com/UnicenterServicePlus/ServiceDesk"> <soapenv:Header/> <soapenv:Body> <ser:doQuery> <sid>965528694</sid> <objectType>cnt</objectType> <whereClause></whereClause> </ser:doQuery> </soapenv:Body></soapenv:Envelope>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <doQueryResponse xmlns="http://www.ca.com/UnicenterServicePlus/ServiceDesk"> <doQueryReturn xmlns=""> <listHandle>839984633</listHandle> <listLength>781</listLength> </doQueryReturn> </doQueryResponse> </soapenv:Body></soapenv:Envelope>
_R
this worked for me,
thank you :-)