cancel
Showing results for 
Search instead for 
Did you mean: 

How do i prepare requests with repeated blocks having unique number in each blocks ?

Frequent Contributor

How do i prepare requests with repeated blocks having unique number in each blocks ?

Hi All,

 

I have below XML request , where <oewInventoryDetails> block can repeat N number of times. and only unique value in all blocks is <oew:inventoryId>. How do i add number of blocks of my intention
with unique number in each block ?. For example, i need to create request with 10,000 blocks of oewInventoryDetails and each should have a unique <oew:inventoryId>.

 

My XML as below:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:oew="http://oew.bt.com/webservice/order/oewsocnorderload">
   <soapenv:Header>
      <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <wsse:UsernameToken>
            <wsse:Username>userid</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">pwd</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      <oew:oewSOCNOrderLoadRequest>
         <oew:oewSOCNOrderLoadRequestInfo>
            <oew:oewOrderDetails>
               <oew:oewSiteDetails>
                  <oew:transactionId>${=System.currentTimeMillis()}</oew:transactionId>
                  <oew:orderNumber>IAASDEM1012</oew:orderNumber>
                  <oew:orderType>N</oew:orderType>
                  <oew:serviceName>SOFTLAYER</oew:serviceName>
                  <oew:taskOrderNumber>To#2-Agency50-ATNTDEMO4</oew:taskOrderNumber>
                  <oew:subAccountNumber>8310000046091</oew:subAccountNumber>
                  <oew:effectiveDate>2017-04-30T10:58:17.687Z</oew:effectiveDate>
                  <oew:foreignAccountNumber>45612</oew:foreignAccountNumber>
                  <oew:oewInventoryDetails>
                     <oew:actionType>I</oew:actionType>
                     <oew:productName>NI</oew:productName>
                     <oew:inventoryId>NI1_JUL7</oew:inventoryId>
                     <oew:oewLocationDetails>
                        <oew:activityType>I</oew:activityType>
                        <oew:room>RM1</oew:room>
                        <oew:floor>FL01</oew:floor>
                        <oew:addressLine1>1 S DEARBORN ST</oew:addressLine1>
                        <oew:city>CHICAGO</oew:city>
                        <oew:state>IL</oew:state>
                        <oew:zip>60603</oew:zip>
                        <oew:geocode>0121510004001</oew:geocode>
                        <oew:countryCode>US</oew:countryCode>
                        <oew:buildingName>EGL</oew:buildingName>
                        <oew:outsideCityLimitIndicator>N</oew:outsideCityLimitIndicator>
                     </oew:oewLocationDetails>
                     <oew:oewServiceDetails>
                        <oew:activityType>I</oew:activityType>
                        <oew:serviceOrderProductCode>IA90002</oew:serviceOrderProductCode>
                        <oew:mappingType>ICB</oew:mappingType>
                        <oew:caseNumber>1</oew:caseNumber>
                        <oew:quantity>300</oew:quantity>
                        <oew:nrcWaiverIndicator>N</oew:nrcWaiverIndicator>
                        <oew:uniqueServiceIdentifier>UBISOFT_0372</oew:uniqueServiceIdentifier>
                        <oew:federalJurisdictionFrom>FJR</oew:federalJurisdictionFrom>
                     </oew:oewServiceDetails>
                     <oew:oewServiceDetails>
                        <oew:activityType>I</oew:activityType>
                        <oew:serviceOrderProductCode>IA90003</oew:serviceOrderProductCode>
                        <oew:mappingType>ICB</oew:mappingType>
                        <oew:caseNumber>368</oew:caseNumber>
                        <oew:quantity>300</oew:quantity>
                        <oew:nrcWaiverIndicator>N</oew:nrcWaiverIndicator>
                        <oew:uniqueServiceIdentifier>UBISOFT_0372</oew:uniqueServiceIdentifier>
                        <oew:federalJurisdictionFrom>FJR</oew:federalJurisdictionFrom>
                     </oew:oewServiceDetails>
                     <oew:oewServiceDetails>
                        <oew:activityType>I</oew:activityType>
                        <oew:serviceOrderProductCode>IA90003</oew:serviceOrderProductCode>
                        <oew:mappingType>ICB</oew:mappingType>
                        <oew:caseNumber>369</oew:caseNumber>
                        <oew:quantity>300</oew:quantity>
                        <oew:nrcWaiverIndicator>N</oew:nrcWaiverIndicator>
                        <oew:uniqueServiceIdentifier>UBISOFT_0372</oew:uniqueServiceIdentifier>
                        <oew:federalJurisdictionFrom>FJR</oew:federalJurisdictionFrom>
                     </oew:oewServiceDetails>
                     <oew:oewServiceDetails>
                        <oew:activityType>I</oew:activityType>
                        <oew:serviceOrderProductCode>IA90003</oew:serviceOrderProductCode>
                        <oew:mappingType>ICB</oew:mappingType>
                        <oew:caseNumber>370</oew:caseNumber>
                        <oew:quantity>300</oew:quantity>
                        <oew:nrcWaiverIndicator>N</oew:nrcWaiverIndicator>
                        <oew:uniqueServiceIdentifier>UBISOFT_0372</oew:uniqueServiceIdentifier>
                        <oew:federalJurisdictionFrom>FJR</oew:federalJurisdictionFrom>
                     </oew:oewServiceDetails>
                     <oew:oewServiceDetails>
                        <oew:activityType>I</oew:activityType>
                        <oew:serviceOrderProductCode>IA90003</oew:serviceOrderProductCode>
                        <oew:mappingType>ICB</oew:mappingType>
                        <oew:caseNumber>371</oew:caseNumber>
                        <oew:quantity>300</oew:quantity>
                        <oew:nrcWaiverIndicator>N</oew:nrcWaiverIndicator>
                        <oew:uniqueServiceIdentifier>UBISOFT_0372</oew:uniqueServiceIdentifier>
                        <oew:federalJurisdictionFrom>FJR</oew:federalJurisdictionFrom>
                     </oew:oewServiceDetails>
                  </oew:oewInventoryDetails>
               </oew:oewSiteDetails>
            </oew:oewOrderDetails>
         </oew:oewSOCNOrderLoadRequestInfo>
      </oew:oewSOCNOrderLoadRequest>
   </soapenv:Body>
</soapenv:Envelope>
11 REPLIES 11
Super Contributor

Re: How do i prepare requests with repeated blocks having unique number in each blocks ?

Are you familiar with groovy scripting

looks like you have use groovy to compose your request

within a loop you could add your unique blocks

 

 

Frequent Contributor

Re: How do i prepare requests with repeated blocks having unique number in each blocks ?

Groovy, not much. Any sample script? Or link to refer please?
Super Contributor

Re: How do i prepare requests with repeated blocks having unique number in each blocks ?

@Apoorva6 I will look at your requets and see how to do it in groovy.

I will send you an update soon

Super Contributor

Re: How do i prepare requests with repeated blocks having unique number in each blocks ?

Here is an example of how to modify xml request using groovy

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )  

// get XmlHolder for request message def 
holder = groovyUtils.getXmlHolder( "login#Request" ) 

// change password using XPath 
holder["//username"] = "test"  

// write updated request back to teststep 
holder.updateProperty()
context.requestContent = holder.xml

 taken from

https://www.soapui.org/scripting-properties/tips-tricks.html

 You like the reply. How to give a Kudos / Accept as solution?

 

Community Hero

Re: How do i prepare requests with repeated blocks having unique number in each blocks ?

@Apoorva6,
I know it is late.
Do you mean to add more "oewServiceDetails" elements?

How do you want to fill data? from external file ? or any dummy data would be fine?

First of all are you still looking for the answer?


Regards,
Rao.
Frequent Contributor

Re: How do i prepare requests with repeated blocks having unique number in each blocks ?

Hi Rao,

 

yes, I am still looking for an answer. I need to fill the data from external file. In external xls file, I have the <oew:inventoryId> values in first column and according to its total numbers, we need so many blocks of  oewServiceDetails.

Only <oew:inventoryId>  should be unique in oewServiceDetails.

If my xls has 600 <oew:inventoryId> then my script should be able to fetch all 600 values , make a request with 600 blocks and then run the request.

Community Hero

Re: How do i prepare requests with repeated blocks having unique number in each blocks ?

Does it really have to be excel file? A comma separated (csv) file will also do? Because that is more simplest to deal with. Of course, you can open the csv file in excel sheel as well if some wants.

Then can you please send the sample data (preferably csv) file (you could save your excel file as csv file as well).


Regards,
Rao.
Frequent Contributor

Re: How do i prepare requests with repeated blocks having unique number in each blocks ?

CSV will work for me. attached is sample file with 20 unique oewInvId's. In this case script should read number of InvId and should prepare one final request of 20 blocks and run the step.

Thanks for the reply.

Community Hero

Re: How do i prepare requests with repeated blocks having unique number in each blocks ?

The file you attached is the entire data or any more data is missing? Because the solution would directly depends on the data.

Anyways, you have a look at the below thread which I did some time ago. May be if you still have issue, then share the full sample data.

https://stackoverflow.com/questions/37956927/groovy-reference-repeating-nodes-values-in-xml-with-xpa...



Regards,
Rao.
New Here?
Join us and watch the welcome video:
Watch the New Interview
7Mistakes
Join the exciting event
SeptemberHubBub
Top Kudoed Authors
Join the September Hub-bub to show off, learn and win