How can i iterate SOAP response array and make check on certain values(like USER ID) on selected property

how can we parse soap response message from service call out policy and check for the values within the response message.

suppose the USER ID might come in multiple times and in different xpath and i need to validate the USER ID present at all the places.how we can achieve that ?

Solved Solved
0 3 777
1 ACCEPTED SOLUTION

There are a couple ways I can think of to do it.

  1. Use an ExtractVariables with one or more XPath selectors, to set a variable. Then examine that variable for the content you seek.
  2. Use XMLToJSON and then process the resulting JSON with a JavaScript callout.

Depending on whether you and your team are more comfortable writing and maintaining XPath or JS, you could choose one or the other.

If you give me a specific example of the response SOAP message, I can show you a specific solution.

View solution in original post

3 REPLIES 3

There are a couple ways I can think of to do it.

  1. Use an ExtractVariables with one or more XPath selectors, to set a variable. Then examine that variable for the content you seek.
  2. Use XMLToJSON and then process the resulting JSON with a JavaScript callout.

Depending on whether you and your team are more comfortable writing and maintaining XPath or JS, you could choose one or the other.

If you give me a specific example of the response SOAP message, I can show you a specific solution.

Hi Dino,

Thanks for the response and concern.

Actually i needed to iterate the element in xml and compare with one particular value(stored in context variable). and i used the XSL transformation policy to achieve the same.

And very thankful to you, as your reply to the post https://community.apigee.com/questions/1860/how-should-the-the-optional-parameters-on-the-xsl.html helped me to use the context variables in XSL Transformation policy.

Right on, I'm glad to be able to help.