CA Service Management

  • 1.  XML node counting in soap ui output

    Posted Jan 23, 2018 01:03 AM

    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.



  • 2.  Re: XML node counting in soap ui output
    Best Answer

    Posted Jan 23, 2018 08:06 AM

    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.



  • 3.  Re: XML node counting in soap ui output

    Broadcom Employee
    Posted Jan 26, 2018 08:46 AM

    Mandar...

     

    Did the information that Cristi provide assist you?

     

    If so, please mark the answer as correct so that this thread can be closed.



  • 4.  Re: XML node counting in soap ui output

    Posted Jan 29, 2018 02:01 AM

    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



  • 5.  Re: XML node counting in soap ui output

    Broadcom Employee
    Posted Jan 29, 2018 05:35 PM

    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



  • 6.  Re: XML node counting in soap ui output

    Posted Feb 06, 2018 05:31 AM

    this worked for me,

    thank you :-)