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>