Forum Discussion

Apoorva6's avatar
Apoorva6
Frequent Contributor
8 years ago

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>
  • sanj's avatar
    sanj
    Super Contributor

    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

     

     

  • Apoorva6's avatar
    Apoorva6
    Frequent Contributor
    Groovy, not much. Any sample script? Or link to refer please?
  • nmrao's avatar
    nmrao
    Champion Level 3
    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?
    • Apoorva6's avatar
      Apoorva6
      Frequent Contributor

      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.

      • nmrao's avatar
        nmrao
        Champion Level 3
        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).