cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

SOAP XML Parsing

rkrishna1
1-Newbie

SOAP XML Parsing

Hi,

Could some one help me in parsing below soap response while calling service:

<infasoapns:Envelope xmlns:infasoapns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:infawsdlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.informatica.com/dis/ws/">

<infasoapns:Body>

    <tns:OperationResponse>

      <tns:SNA_SERVICE_RESPONSE>

        <tns:STATUS>Failure</tns:STATUS>

        <tns:STATUS_CODE>000002</tns:STATUS_CODE>

        <tns:STATUS_MESSAGE>SGTIN_NOT_EXIST</tns:STATUS_MESSAGE>

       <tns:PRODUCT_DESC/>

       </tns:SNA_SERVICE_RESPONSE>

     </tns:OperationResponse>

    </infasoapns:Body>

</infasoapns:Envelope>

How can i get values or store into infotable. Any help would be appreciated.

Thanks

2 REPLIES 2
adrianpet
5-Regular Member
(To:rkrishna1)

Hi,


     Can you show me the service that you've made in order to obtain the values from the SOAP?

     Basically you'll need to create a service in which you will set the BaseType in the Inputs/Outputs tab to be InfoTable(you may need to set a DataShape for your parameters) and the infotable Type should be Just Infotable, but first I would like to see the service that you have created for this.

   

Thank you,

Adrian

Hi Rajesh,

did you see this posting: Regarding SOAP based Webservice Call​ and specifically the answer from Pai Chung. It points out how the XML that is returned by a SOAP call can be easily parsed with E4X. You can also use for loops with it, e.g. (based on Pai's example):

// this is what Pai referred to:

// var itemKey = xmlDoc.::Body.::GetTopTenPartsResponse.::GetTopTenPartsResult.::JsonRecord.::item.::key.*::string;

// let's assume GetTopTenPartsResult has multiple JsonRecord sub-elements then your code could look like the following:

//initialize your infotable

var myInfoTable = ...;

for each (var entry in xmlDoc.::Body.::GetTopTenPartsResponse.::GetTopTenPartsResult){

     var itemKey = entry.::JsonRecord.::item.::key.*::string;

     // now use this value with an object for an InfoTable row:

     var newRow = new Object();

     newRow.key=itemKey;

     // ... assign other values from XML to object properties

    myInfoTable.addRow(newRow);

}

var result = myInfoTable;

Top Tags