Forum Discussion

ppat7046_1's avatar
ppat7046_1
Occasional Contributor
7 years ago

Read & Loop multiple requests and response

Multiple Request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<MIKE:pFU>
<uId>?</uId>
<p>?</p>
<UFL>
<MIKE:UFD>
<MIKE:NVPFF>
<MIKE:name>NULL</MIKE:name>
<MIKE:value>NULL</MIKE:value>
</MIKE:NVPFF>
<MIKE:wII>105</MIKE:wII>
<MIKE:b>659-458</MIKE:b>
<MIKE:fT>P1B</MIKE:fT>
<MIKE:action/>
</MIKE:UFD>
<MIKE:UFD>
<MIKE:NVPFF>
<MIKE:name>NULL</MIKE:name>
<MIKE:value>NULL</MIKE:value>
</MIKE:NVPFF>
<MIKE:wII>363</MIKE:wII>
<MIKE:b>756-124</MIKE:b>
<MIKE:fT>P1B</MIKE:fT>
<MIKE:action/>
</MIKE:UFD>
<MIKE:UFD>
<MIKE:NVPFF>
<MIKE:name>NULL</MIKE:name>
<MIKE:value>NULL</MIKE:value>
</MIKE:NVPFF>
<MIKE:wII>354</MIKE:wII>
<MIKE:b>741-652</MIKE:b>
<MIKE:fT>P1B</MIKE:fT>
<MIKE:action/>
</MIKE:UFD>
</UFL>
</MIKE:pFU>
</soapenv:Body>
</soapenv:Envelope>

Response: Loop the request and for each UFD send Response with wII, b, s, and sM shown below.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<MIKE:pFUR>
<RSL>
<MIKE:RS>
<MIKE:wII>105</MIKE:wII>
<MIKE:b>659-458</MIKE:b>
<MIKE:s>Success</MIKE:s>
<MIKE:sM>Successfully updated for: 659-458; 105; P1B</MIKE:sM>
</MIKE:RS>
</RSL>
</MIKE:pFUR>
</soapenv:Body>
</soapenv:Envelope>

3 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    What is the question? What is your use case? How to reproduce it by others?
    • ppat7046_1's avatar
      ppat7046_1
      Occasional Contributor

      Sorry for not clearly asking the question. Here is the issue.

      1) In Ready! API 1.9.0, under projects, I imported the wsdl then sending following request

      <soapenv:Envelope xmlns:soapenv="http://../">
          <soapenv:Header/>
          <soapenv:Body>
              <MIKESmiley:TongueFU>
                  <uId>?</uId>
                  <p>?</p>
                  <UFL>
                      <MIKE:UFD>
                          <MIKE:NVPFF>
                              <MIKE:name>NULL</MIKE:name>
                              <MIKE:value>NULL</MIKE:value>
                          </MIKE:NVPFF>
                          <MIKE:wII>105</MIKE:wII>
                          <MIKE:b>659-458</MIKE:b>
                          <MIKE:fT>P1B</MIKE:fT>
                          <MIKE:action/>
                      </MIKE:UFD>
                  </UFL>
              </MIKESmiley:TongueFU>
          </soapenv:Body>
      </soapenv:Envelope>

       

      2) Under ServiceV, I have following Script

      def blockValue="XX";
      def groovyUtils=new com.eviware.soapui.support.GroovyUtils(context)
      def xml=new XmlSlurper().parseText(mockRequest.requestContent)
      xml.breadthFirst().each{
              if(it.name()=="b"){
                      bValue=it.text();
                      context.setProperty("BVALUE", bValue);                
              }
              if(it.name()=="wII"){
                      wIIValue=it.text();
                      context.setProperty("WII", wIIValue);                
              }
              if(it.name()=="fT"){
                      fTValue=it.text();                
                      context.setProperty("FT", fTValue);
              }   
      }
      context.setProperty("STATUSMESSAGE1", "Updated for: ${bValue}; ${wIIValue};");

       

      3) Under Response, I have following

      <soapenv:Envelope xmlns:soapenv="http://..." xmlns:map="https://test.com/">
         <soapenv:Header/>
         <soapenv:Body>
            <pas:pFUR>
               <RSL>
                  <pas:RS>
                  <pas:wII>${wIIValue}</pas:wII>
                  <pas:b>${bValue}</pas:b>
                  <pas:statusMessage>${STATUSMESSAGE1}</pas:statusMessage>
                  </pas:RS>
               </RSL>
            </pas:pFUR>
         </soapenv:Body>
      </soapenv:Envelope>

       

      4) I get correct response, no issues so far.

       

      5) Now, I send following request

      <soapenv:Envelope xmlns:soapenv="http://../">
          <soapenv:Header/>
          <soapenv:Body>
              <MIKESmiley:TongueFU>
                  <uId>?</uId>
                  <p>?</p>
                  <UFL>
                      <MIKE:UFD>
                          <MIKE:NVPFF>
                              <MIKE:name>NULL</MIKE:name>
                              <MIKE:value>NULL</MIKE:value>
                          </MIKE:NVPFF>
                          <MIKE:wII>105</MIKE:wII>
                          <MIKE:b>659-458</MIKE:b>
                          <MIKE:fT>P1B</MIKE:fT>
                          <MIKE:action/>
                      </MIKE:UFD>

                      <MIKE:UFD>
                          <MIKE:NVPFF>
                              <MIKE:name>NULL</MIKE:name>
                              <MIKE:value>NULL</MIKE:value>
                          </MIKE:NVPFF>
                          <MIKE:wII>106</MIKE:wII>
                          <MIKE:b>659-459</MIKE:b>
                          <MIKE:fT>P1B</MIKE:fT>
                          <MIKE:action/>
                      </MIKE:UFD>
                  </UFL>
              </MIKESmiley:TongueFU>
          </soapenv:Body>
      </soapenv:Envelope>

       

      6) Issue: I only received a response that is highlighted in Red. I DO NOT get response for 105 and 106.

       

      Can someone please help?

      • nmrao's avatar
        nmrao
        Champion Level 3
        Because, it is working as per the script.

        What is the expected response message (xml ) please?