2 Replies Latest reply on Jan 15, 2016 7:07 AM by moritzvonh RSS
    rkrishna Explorer

    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

      • Re: SOAP XML Parsing
        adrianpet Creator

        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

        • Re: SOAP XML Parsing
          moritzvonh Creator

          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;