Forum Discussion

vignesh2006n's avatar
vignesh2006n
New Contributor
8 years ago

How do I search within the nested node value using SOAPUI request?

Hi,

 

The SOAP output has a nested node with a few sub nodes. I need to search for a particular sub node value using a SOAP request. Is that possible and if so, can you please assist me out.

My SOAP response is in the following format:

<ns0:testResponse>

  <ns1:result>

    <ns0:value>

        <ns5:parent>

            <ns1:child1>test1</ns1:child1>

            <ns1:child2>test2</ns2:child2>

        </ns5:parent>

    </ns0:value>

  <ns1:result>

<ns0:testResponse>

 

I need to search for child2 value in my soap request using something like the below:


<typ1:attribute>child2</typ1:attribute>
<typ1:operator>=</typ1:operator>
<typ1:value>test2</typ1:value>

 

Kindly assist on how I can achieve the same.

 

Thanks,

Vignesh

2 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3

    can you try with below xpath in Xpath Assertion?

    # Use declaration of namespaces in that assertion.

     

    exists(//ns5:parent/ns1:child2[. = 'test2']) and expected value should be true

     

     

    • vignesh2006n's avatar
      vignesh2006n
      New Contributor

      Hi,

       

      I was able to achieve it using the below piece of code :


      <typ1:conjunction>And</typ1:conjunction>
      <typ1:item>
      <typ1:upperCaseCompare>true</typ1:upperCaseCompare>
      <typ1:attribute>PrimaryAddress</typ1:attribute>
      <typ1:operator>EXISTS</typ1:operator>
      <typ1:nested>
      <typ1:group>
      <typ1:conjunction>And</typ1:conjunction>
      <typ1:upperCaseCompare>true</typ1:upperCaseCompare>
      <typ1:item>
      <typ1:conjunction>And</typ1:conjunction>
      <typ1:upperCaseCompare>true</typ1:upperCaseCompare>
      <typ1:attribute>Country</typ1:attribute>
      <typ1:operator>=</typ1:operator>
      <typ1:value>US</typ1:value>
      </typ1:item>
      </typ1:group>
      </typ1:nested>
      </typ1:item>

       

      Now if I want to search based on an OR condition to check if the country is US or the phone number which is an independent tag itself is "xxx-xxxx" then how will I be able to achieve that? Could you kindly assist.


      Thanks,

      Vignesh