Forum Discussion

guinea's avatar
guinea
New Contributor
13 years ago

how to extract value from response

Newbie here, need some help with extracting value in a previous response to send in the next request. Response is something like this, I need to extract the value in Property value "SubscriberId" to send in the next request. For eg, in the following response, I need to extract value "013cf2c300dddbf5" to use in my next request. Any idea how do I do it?

<ASBMessage version="2.0" id="8a09c768288b47ae967aa836e09b7426" timestamp="2013-02-27T18:03:38.913">
<Header>
<Context id="Response"/>
<Status id="OK"/>
<Correlation id="SEARCH-LINE-CCCCCC-DDDDDDDDDD-E7044858686"/>
<PropertyList id="asb">
<Property value="66502E4A-9F79-CD22-A5C0-CDA072637E79" id="thread"/>
</PropertyList>
</Header>
<Body items="1">
<ServiceProperties operation="QUERY" status="ok">
<ID value="D5D67598-0FB4-65F6-B181-410CB5C9335C" ns="DSB"/>
<AccountService>
<ID value="A73CF4F7-120D-4C0F-CA52-78A7FE6E0F1E" ns="DSB"/>
<Account>
<ID value="3D0E1B73-1D81-DC67-D911-F6A135BAC3A9" ns="DSB"/>
<ID value="0015ce1522d1" ns="ESB"/>
</Account>
</AccountService>
<AccountDevice>
<ID value="95EFFAB6-EB5E-15C2-5AD6-A2AC2A9F9C51" ns="DSB"/>
<Device>
<ID value="4D2F2B60-40C7-9DF9-8C10-7D20E2AF5EA1" ns="DSB"/>
</Device>
</AccountDevice>
<Properties>
<ID value="B9D62AA6-88AC-BE2D-F7A2-F144E8728612" ns="DSB"/>
<PropertiesType>
<ID value="881FBCAC-B7EC-329F-9AB0-85387B694D9B" ns="DSB"/>
</PropertiesType>
<Property>
<ID value="AC58665C-590C-1B0A-C131-34601AB0BCB7" ns="DSB"/>
<ID value="PhoneNumber" ns="BPS"/>
<Value value="7044858686"/>
</Property>
<Property>
<ID value="D18AFCBD-F6C5-5941-9CF3-6D5A10F659A4" ns="DSB"/>
<ID value="CNAM" ns="BPS"/>
<Value value="first line"/>
</Property>
<Property>
<ID value="97AF4309-AD42-F70E-89C5-D6BC0AE86BB4" ns="DSB"/>
<ID value="SubscriberId" ns="BPS"/>
<Value value="013cf2c300dddbf5"/>
</Property>
<Property>
<ID value="F6F720C9-EFD6-A0FC-5818-6379A5260F3D" ns="DSB"/>
<ID value="PublicUserId" ns="BPS"/>
<Value value="+17044858686"/>
</Property>
<Property>
<ID value="2256E264-BDE9-C11B-4882-A062E261C338" ns="DSB"/>
<ID value="PrivateUserId" ns="BPS"/>
<Value value="A5C1DA7E7332A7D7"/>
</Property>
</Properties>
<Audit timeCreated="130219090216895Z" timeModified="130227120953708Z" creator="BPS" modifier="RollbackProcessor"/>
</ServiceProperties>
</Body>
</ASBMessage>
  • Hi, I could give you the exact response but I don't know why pple hate to use the search functions on forum before asking something or even read the documentation, because if you read it you will find this : http://www.soapui.org/Functional-Testin ... alues.html

    I have nothing personal with you, just in general I seen that instead of searching and read to learn pple just ask every question.

    If you still have problems after reading the doc, let me know.
  • guinea's avatar
    guinea
    New Contributor
    I have actually already read those pages this morning. My problem is parsing the multiple "Property" fields, and I do not want to use a fixed index to pull the value for SubscriberId.
  • Well that's a different question "how to access a specific element from an xml", and for that you need to learn xpath here are some nice examples http://zvon.org/xxl/XPathTutorial/General/examples.html

    as for your particular case the need it xpath should be this: //Property[./ID/@value="SubscriberId"]/Value/@value

    Hope this helps you
  • guinea's avatar
    guinea
    New Contributor
    Thanks for your help and I appreciate the URL you gave, definitely helpful. At least now I feel "less dumb".