Ask a Question

Need help in writing content of request (selected attributes) to external XML file.

SOLVED
Apoorva6
Frequent Contributor

Need help in writing content of request (selected attributes) to external XML file.

I have removed this post and added modified one in my next message.

15 REPLIES 15
Apoorva6
Frequent Contributor

I have removed this post and added updated one in my next message.

nmrao
Champion Level 2

First of all, the question is confusing.

Why do you need values from a static file. Instead shouldn't you be using the values from the request and and send the response based on those? More details would probably help.


Regards,
Rao.
Apoorva6
Frequent Contributor

Hi, I have rephrased my requirement.

My request below will write BillingAccountNumber to another application. Since we are not storing BillingAccountNumber anywhere, I need to store in another remote  XML file which I need to use later. The common fields in request and the remote XML file is BillAccountNodeId,BillAccountNodeType and BillingAccountNumber . That is these 3 attributes will be present in request and remote XML. Now my requirement is to compare BillAccountNodeId of Request
with Remote XML And if matches, then write BillingAccountNumber from Request to Remote XML file. After writing to remote XML, I can use this for another transation. I have Request , mock Response and sample Remote XML below.
Note: This request will come multiple times with different BillAccountNodeId and BillingAccountNumber and still it should write to Remote XML after comparing BillAccountNodeId

Request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header/>
   <soapenv:Body>
      <p109:setBillAccountMigrRequest xmlns:p882="http://cio.ttt.com/commonheader/v3" xmlns:p109="http://edb.ttt.com/dppco/billaccountinsertupdatemigr/v2">
         <p882:WSHeader/>
         <p109:tttContractNumber>NBI0147477</p109:tttContractNumber>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119372</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>C</p109:BillAccountNodeType>
            <p109:BillingAccountNumber>2562</p109:BillingAccountNumber>
         </p109:BillAccount>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119373</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>H</p109:BillAccountNodeType>
            <p109:BillingAccountNumber>3928</p109:BillingAccountNumber>
            <p109:Statustype>HierarchyCreation</p109:Statustype>
            <p109:Status>Success</p109:Status>
            <p109:StatusErrorCode/>
            <p109:StatusErrorDescription/>
         </p109:BillAccount>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119374</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>BA</p109:BillAccountNodeType>
            <p109:BillingAccountNumber>8310000221925</p109:BillingAccountNumber>
         </p109:BillAccount>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119375</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>I</p109:BillAccountNodeType>
            <p109:BillingAccountNumber>8310000221927</p109:BillingAccountNumber>
         </p109:BillAccount>
         <p109:BillAccount>
            <p109:BillAccountNodeAlias>000001</p109:BillAccountNodeAlias>
            <p109:BillAccountNodeType>G</p109:BillAccountNodeType>
            <p109:BillingAccountNumber>000001</p109:BillingAccountNumber>
         </p109:BillAccount>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119376</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>SA</p109:BillAccountNodeType>
            <p109:BillingAccountNumber>8310000221930</p109:BillingAccountNumber>
            <p109:GamsId>BEPLAGEN</p109:GamsId>
            <p109:BillGroup>VAP</p109:BillGroup>
         </p109:BillAccount>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119377</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>SA</p109:BillAccountNodeType>
            <p109:BillingAccountNumber>8310000221932</p109:BillingAccountNumber>
            <p109:GamsId>BES00B</p109:GamsId>
            <p109:BillGroup>VAQ</p109:BillGroup>
         </p109:BillAccount>
      </p109:setBillAccountMigrRequest>
   </soapenv:Body>
</soapenv:Envelope>

Remote XML as below

 

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header/>
   <env:Body>
      <p35:getBillAccountPackageMigrResponse xmlns:p414662882="http://cio.ttt.com/commonheader/v3" xmlns:p35="http://edb.ttt.com/dppco/billaccountquerymigr/v2">
         <p414662882:WSResponseHeader/>
         <p35:Customer xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:CustName>Customer 312        Batch 9</p65:CustName>
            <p65:Addr1>8433 QUIVIRA RD</p65:Addr1>
            <p65:City>Lenexa</p65:City>
            <p65:State>KS</p65:State>
            <p65:PostalCode>66215</p65:PostalCode>
            <p65:IsoCountryCode>US</p65:IsoCountryCode>
            <p65:SubmittedByUserID>mp2012</p65:SubmittedByUserID>
            <p65:MANumber>20110902-0178UA</p65:MANumber>
            <p65:Contact>
               <p65:ContactType>Sales</p65:ContactType>
               <p65:tttuid>mp2012</p65:tttuid>
            </p65:Contact>
         </p35:Customer>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119372</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>C</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>2562</p65:BillingAccountNumber>
            <p65:ContractedBusinessCustomerType>O</p65:ContractedBusinessCustomerType>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:ActivityType>Add</p65:ActivityType>
            <p65:BillAccountNodeId>119373</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>H</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>11812</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143460</p65:ParentBillAccountNodeID>
            <p65:CountryCode>US</p65:CountryCode>
            <p65:CustomerLegalName>CLINICAL REFERENCE LABORATORY, INC.</p65:CustomerLegalName>
            <p65:tttLegalEntityCode>US</p65:tttLegalEntityCode>
            <p65:BillCycle>1</p65:BillCycle>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119374</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>BA</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>8310000221925</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143461</p65:ParentBillAccountNodeID>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119375</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>I</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>8310000037320</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143462</p65:ParentBillAccountNodeID>
            <p65:SolutionsBilledCustomerInd>N</p65:SolutionsBilledCustomerInd>
            <p65:BillingName>CLINICAL REFERENCE LABORATORY, INC.</p65:BillingName>
            <p65:InvoiceCurrency>USD</p65:InvoiceCurrency>
            <p65:Fan>VP0B30</p65:Fan>
            <p65:AdvanceArrearsIndicator>1</p65:AdvanceArrearsIndicator>
            <p65:BillingAddress>
               <p65:TypeOfAddress>Billing</p65:TypeOfAddress>
               <p65:Addr1>8433 QUIVIRA RD</p65:Addr1>
               <p65:City>LENEXA</p65:City>
               <p65:State>KS</p65:State>
               <p65:PostalCode>66215</p65:PostalCode>
               <p65:County>JOHNSON</p65:County>
               <p65:IsoCountryCode>US</p65:IsoCountryCode>
               <p65:GeoCode>0117091090000</p65:GeoCode>
            </p65:BillingAddress>
            <p65:BillingAddress>
               <p65:TypeOfAddress>BillingTax</p65:TypeOfAddress>
               <p65:Addr1>8433 QUIVIRA RD</p65:Addr1>
               <p65:City>LENEXA</p65:City>
               <p65:State>KS</p65:State>
               <p65:PostalCode>66215</p65:PostalCode>
               <p65:County>JOHNSON</p65:County>
               <p65:IsoCountryCode>US</p65:IsoCountryCode>
               <p65:GeoCode>0117091090000</p65:GeoCode>
            </p65:BillingAddress>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>144525</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>G</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>000001</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143463</p65:ParentBillAccountNodeID>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119376</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>SA</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>8310000044619</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>144521</p65:ParentBillAccountNodeID>
            <p65:Mcn>075603</p65:Mcn>
            <p65:Soc>H6</p65:Soc>
            <p65:BillGroup>VAE</p65:BillGroup>
            <p65:TypeOfTriplet>S</p65:TypeOfTriplet>
            <p65:GamsId>VP0B30</p65:GamsId>
         </p35:BillAccount>
       <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:ActivityType>Add</p65:ActivityType>
            <p65:BillAccountNodeId>143461</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>H</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>11812</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143460</p65:ParentBillAccountNodeID>
            <p65:CountryCode>US</p65:CountryCode>
            <p65:CustomerLegalName>CLINICAL REFERENCE LABORATORY, INC.</p65:CustomerLegalName>
            <p65:tttLegalEntityCode>US</p65:tttLegalEntityCode>
            <p65:BillCycle>1</p65:BillCycle>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>143462</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>BA</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>BA_NUM</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143461</p65:ParentBillAccountNodeID>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>143463</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>I</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>8310000037320</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143462</p65:ParentBillAccountNodeID>
            <p65:SolutionsBilledCustomerInd>N</p65:SolutionsBilledCustomerInd>
            <p65:BillingName>CLINICAL REFERENCE LABORATORY, INC.</p65:BillingName>
            <p65:InvoiceCurrency>USD</p65:InvoiceCurrency>
            <p65:Fan>VP0B30</p65:Fan>
            <p65:AdvanceArrearsIndicator>1</p65:AdvanceArrearsIndicator>
            <p65:BillingAddress>
               <p65:TypeOfAddress>Billing</p65:TypeOfAddress>
               <p65:Addr1>8433 QUIVIRA RD</p65:Addr1>
               <p65:City>LENEXA</p65:City>
               <p65:State>KS</p65:State>
               <p65:PostalCode>66215</p65:PostalCode>
               <p65:County>JOHNSON</p65:County>
               <p65:IsoCountryCode>US</p65:IsoCountryCode>
               <p65:GeoCode>0117091090000</p65:GeoCode>
            </p65:BillingAddress>
            <p65:BillingAddress>
               <p65:TypeOfAddress>BillingTax</p65:TypeOfAddress>
               <p65:Addr1>8433 QUIVIRA RD</p65:Addr1>
               <p65:City>LENEXA</p65:City>
               <p65:State>KS</p65:State>
               <p65:PostalCode>66215</p65:PostalCode>
               <p65:County>JOHNSON</p65:County>
               <p65:IsoCountryCode>US</p65:IsoCountryCode>
               <p65:GeoCode>0117091090000</p65:GeoCode>
            </p65:BillingAddress>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>144525</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>G</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>000001</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143463</p65:ParentBillAccountNodeID>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>143464</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>SA</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>8310000044619</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>144521</p65:ParentBillAccountNodeID>
            <p65:Mcn>075603</p65:Mcn>
            <p65:Soc>H6</p65:Soc>
            <p65:BillGroup>VAE</p65:BillGroup>
            <p65:TypeOfTriplet>S</p65:TypeOfTriplet>
            <p65:GamsId>VP0B30</p65:GamsId>
         </p35:BillAccount>
      </p35:getBillAccountPackageMigrResponse>
   </env:Body>
</env:Envelope>

My Mock Response as below

 

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header/>
   <env:Body>
      <p109:setBillAccountMigrResponse xmlns:p882="http://cio.ttt.com/commonheader/v3" xmlns:p109="http://edb.ttt.com/dppco/billaccountinsertupdatemigr/v2">
         <p882:WSResponseHeader/>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119372</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>C</p109:BillAccountNodeType>
         </p109:BillAccount>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119373</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>H</p109:BillAccountNodeType>
         </p109:BillAccount>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119374</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>BA</p109:BillAccountNodeType>
         </p109:BillAccount>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119375</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>I</p109:BillAccountNodeType>
         </p109:BillAccount>
         <p109:BillAccount>
            <p109:BillAccountNodeId>173806</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>G</p109:BillAccountNodeType>
         </p109:BillAccount>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119376</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>SA</p109:BillAccountNodeType>
         </p109:BillAccount>
      <p109:BillAccount>
            <p109:BillAccountNodeId>119377</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>SA</p109:BillAccountNodeType>
         </p109:BillAccount>
      </p109:setBillAccountMigrResponse>
   </env:Body>
</env:Envelope>
Apoorva6
Frequent Contributor

Hi, Any update on my query please ?

Apoorva6
Frequent Contributor

Hi,

 

I am able to read my request from below script.

 

def requestBody = mockRequest.getRequestContent()
log.info "Request body: " + requestBody

 

However I am not able to get the xPath of any elements.

 

Also I am able to read details of my external file with below script,

 

def soapns = new groovy.xml.Namespace("http://schemas.xmlsoap.org/soap/envelope/",'env')
def p882 = new groovy.xml.Namespace("http://cio.ttt.com/commonheader/v3")
def p35 = new groovy.xml.Namespace("http://edb.ttt.com/dppco/billaccountquerymigr/v2")
def p65 = new groovy.xml.Namespace("http://edb.ttt.com/dppco/bcicommon/v2")
def p109 = new groovy.xml.Namespace("http://edb.ttt.com/dppco/billaccountinsertupdatemigr/v2")

def inputFile = new File(groovyUtils.projectPath+"\\GamsMigr\\TEMP\\MIGR_TMP_LITE.xml")
log.info(groovyUtils.projectPath)
if(!inputFile.exists())
{
    //Display an alert if the file is not found.
    alert.showInfoMessage("Input File MIGR_TMP_LITE.xml  not found!");   
}
else
{
    //Read and parse XML file and store it into a variable


    
    def InputXML = new XmlParser().parse("C://Users//ADMIN//Desktop//JULY17//expt//MIGR_TMP_LITE.xml")
      log.info(InputXML)
    def x = InputXML[soapns.Body][p35.getBillAccountPackageMigrResponse][p35.BillAccount].size()
log.info(x)


for(i=0; i<x ;i++){
    def a=InputXML[soapns.Body][p35.getBillAccountPackageMigrResponse][p35.BillAccount][i][p65.BillAccountNodeId].text()
  def z=InputXML[soapns.Body][p35.getBillAccountPackageMigrResponse][p35.BillAccount][i][p65.BillAccountNodeType].text()
  def y=InputXML[soapns.Body][p35.getBillAccountPackageMigrResponse][p35.BillAccount][i][p65.BillingAccountNumber].text()
  log.info("BillingAccountNumberid at node "+ z + " is "+y+ " for Bill account id " +a+ " in position " +i )

}

 

All I need is, get BillAccountNodeId from request, compare if same is present in external file. If present, then write BillingAccountNumber from request to BillingAccountNumber of external file. May be Maps can help here, where I need to know if its possible to read all BillAccountNodeId  of request and that in external file in 2 maps, and compare each other and if match, then write BillingAccountNumber from request to BillingAccountNumber of external file

nmrao
Champion Level 2

May be you could just simplify the question.

Please define input (request)and output(expected response) xmls. Attach sample files. If necessary add the comments in the xml file as needed.


Regards,
Rao.
Apoorva6
Frequent Contributor

I have the request (Request.xml) as below. This has many BillAccount blocks and each block has unique BillAccountNodeId and BillingAccountNumber.
I have external xml file (external.xml) as below which has many BillAccount blocks and each block has unique BillAccountNodeId and BillingAccountNumber.
My requirement is to check BillAccountNodeId from Request.xml with external.xml and if matches, then write corresponding BillingAccountNumber of matched BillAccountNodeId to that in external.xml.

Example: below is the sample request.xml, in this we need to consider BillAccountNodeId of 3 nodes and its corresponding BillingAccountNumber.
I am putting it in [BillAccountNodeId : BillingAccountNumber] format as below.

[119372 : 2562]
[119373 : 3928]
[119374 : 8310000221925]

 

Request.xml as below:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header/>
   <soapenv:Body>
      <p109:setBillAccountMigrRequest xmlns:p882="http://cio.ttt.com/commonheader/v3" xmlns:p109="http://edb.ttt.com/dppco/billaccountinsertupdatemigr/v2">
         <p882:WSHeader/>
         <p109:tttContractNumber>NBI0147477</p109:tttContractNumber>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119372</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>C</p109:BillAccountNodeType>
            <p109:BillingAccountNumber>2562</p109:BillingAccountNumber>
         </p109:BillAccount>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119373</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>H</p109:BillAccountNodeType>
            <p109:BillingAccountNumber>3928</p109:BillingAccountNumber>
            <p109:Statustype>HierarchyCreation</p109:Statustype>
            <p109:Status>Success</p109:Status>
            <p109:StatusErrorCode/>
            <p109:StatusErrorDescription/>
         </p109:BillAccount>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119374</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>BA</p109:BillAccountNodeType>
            <p109:BillingAccountNumber>8310000221925</p109:BillingAccountNumber>
         </p109:BillAccount>
        </p109:setBillAccountMigrRequest>
   </soapenv:Body>
</soapenv:Envelope>

Below is the sample external.xml and I am writing it in [BillAccountNodeId : BillingAccountNumber] format as below.

[119372 : 2544]
[119373 : 11812]
[119374 : 8310000221999]
[119863 : 7607]
[119844 : 11812]
[119855 : 8310000221944]

 

external.xml as below

 

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header/>
   <env:Body>
      <p35:getBillAccountPackageMigrResponse xmlns:p414662882="http://cio.ttt.com/commonheader/v3" xmlns:p35="http://edb.ttt.com/dppco/billaccountquerymigr/v2">
         <p414662882:WSResponseHeader/>
         <p35:Customer xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:MANumber>20110902-0178UA</p65:MANumber>
            <p65:Contact>
               <p65:ContactType>Sales</p65:ContactType>
               <p65:tttuid>mp2012</p65:tttuid>
            </p65:Contact>
         </p35:Customer>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119372</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>C</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>2544</p65:BillingAccountNumber>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119373</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>H</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>11812</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143460</p65:ParentBillAccountNodeID>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119374</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>BA</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>8310000221999</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143461</p65:ParentBillAccountNodeID>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119863</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>C</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>7607</p65:BillingAccountNumber>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119844</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>H</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>11812</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143460</p65:ParentBillAccountNodeID>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119855</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>BA</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>8310000221944</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143461</p65:ParentBillAccountNodeID>
         </p35:BillAccount>
      </p35:getBillAccountPackageMigrResponse>
   </env:Body>
</env:Envelope>

Now if u compare both request.xml and external.xml's  [BillAccountNodeId : BillingAccountNumber], then there is a match in 3 BillAccountNodeId's below.

from Request.xml

[119372 : 2562]
[119373 : 3928]
[119374 : 8310000221925]

from external.xml

[119372 : 2544]
[119373 : 11812]
[119374 : 8310000221999]

Now, we need to write BillingAccountNumber from Request.xml to external.xml wherever there is a match of BillAccountNodeId.

i.e BillingAccountNumber from external.xml 2544, 11812 and 8310000221999 should be replaced respectively with one from Request.xml, 2562, 3928 and 8310000221925.

Below would be the layout of external.xml after writing BillingAccountNumber from Request.xml

 

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header/>
   <env:Body>
      <p35:getBillAccountPackageMigrResponse xmlns:p414662882="http://cio.ttt.com/commonheader/v3" xmlns:p35="http://edb.ttt.com/dppco/billaccountquerymigr/v2">
         <p414662882:WSResponseHeader/>
         <p35:Customer xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:MANumber>20110902-0178UA</p65:MANumber>
            <p65:Contact>
               <p65:ContactType>Sales</p65:ContactType>
               <p65:tttuid>mp2012</p65:tttuid>
            </p65:Contact>
         </p35:Customer>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119372</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>C</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>2562</p65:BillingAccountNumber>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119373</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>H</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>3928</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143460</p65:ParentBillAccountNodeID>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119374</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>BA</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>8310000221925</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143461</p65:ParentBillAccountNodeID>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119863</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>C</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>7607</p65:BillingAccountNumber>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119844</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>H</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>11812</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143460</p65:ParentBillAccountNodeID>
         </p35:BillAccount>
         <p35:BillAccount xmlns:p65="http://edb.ttt.com/dppco/bcicommon/v2">
            <p65:BillAccountNodeId>119855</p65:BillAccountNodeId>
            <p65:BillAccountNodeType>BA</p65:BillAccountNodeType>
            <p65:BillingAccountNumber>8310000221944</p65:BillingAccountNumber>
            <p65:ParentBillAccountNodeID>143461</p65:ParentBillAccountNodeID>
         </p35:BillAccount>
      </p35:getBillAccountPackageMigrResponse>
   </env:Body>
</env:Envelope>

 

nmrao
Champion Level 2

Is it just enough to update in the external file? you do not want to send the response?


Regards,
Rao.
Apoorva6
Frequent Contributor

Hi Rao,

 

Yes, Response is fixed like below.

 

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header/>
   <env:Body>
      <p109:setBillAccountMigrResponse xmlns:p882="http://cio.ttt.com/commonheader/v3" xmlns:p109="http://edb.ttt.com/dppco/billaccountinsertupdatemigr/v2">
         <p882:WSResponseHeader/>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119372</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>C</p109:BillAccountNodeType>
         </p109:BillAccount>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119373</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>H</p109:BillAccountNodeType>
         </p109:BillAccount>
         <p109:BillAccount>
            <p109:BillAccountNodeId>119374</p109:BillAccountNodeId>
            <p109:BillAccountNodeType>BA</p109:BillAccountNodeType>
         </p109:BillAccount>
           </p109:setBillAccountMigrResponse>
   </env:Body>
</env:Envelope>

 

Also, one more thing. There can be multile external files present in same path. So our external file which we need to write will be in name value of tttContractNumber.xml. 

 

In this case its NBI0147477.xml for example. If its not present, then we need to throw soap fault exception. Also if none of BillAccountNodeId matches, then also soapfault exception. If matches and replaced, then give back above response xml.

cancel
Showing results for 
Search instead for 
Did you mean: