Forum Discussion

Jasper175's avatar
Jasper175
Frequent Contributor
13 years ago

[Response] Find Value in XML Code Block

Hello Groovy Friends,

I need to figure out a better way to pull a value from within a code block. The script I use in Groovy is working...sort of. I won't paste that in, but here is an example of a return of Phone Numbers (did) a customer can have. The 'didType' which has many... the below has PHYS and TEMP.

I need to be able to extract a list of phoneNumbers (did) that has the didType == "PHYS"
Reason I need to do it through Groovy is because there are many DIDTYPES, there can be more than one etc...


   <SOAP-ENV:Body>
<ns2:GetServiceDidMapResponse xmlns:ns2="http://cleveland.vonage.com/services/servicelayer" xmlns:ns3="http://cleveland.vonage.com/services/servicelayer/internal" xmlns:ns4="http://cleveland.vonage.com/services/servicelayer/legacy">
<ns2:serviceEntities>
<ns2:networkId>128982952</ns2:networkId>
<ns2:didTargets>
<ns2:did>17325659833</ns2:did>
<ns2:didType>PHYS</ns2:didType>
<ns2:startDate>2012-10-16</ns2:startDate>
</ns2:didTargets>
<ns2:didTargets>
<ns2:did>17322025696</ns2:did>
<ns2:didType>TEMP</ns2:didType>
<ns2:startDate>2012-10-16</ns2:startDate>
</ns2:didTargets>
<ns2:startDate>2012-10-16</ns2:startDate>
</ns2:serviceEntities>
</ns2:GetServiceDidMapResponse>
</SOAP-ENV:Body>


Thank you,
Rob Long (Jasper175)

12 Replies