Wednesday 5 March 2014

Reading Webservice Response

While we are integrating our NAV with any other Frontend , we should read all the response from the webservice response file for our required information.
For simple testing i am just storing the response file in 'C:\TEMP\testing.xml' location

Name                              DataType       Subtype    Length
XMLNodelist                  Automation    'Microsoft XML, v6.0'.IXMLDOMNodeList
XMLDomElement           Automation    'Microsoft XML, v6.0'.IXMLDOMElement
SourceXMLDocument    Automation    'Microsoft XML, v6.0'.DOMDocument    


CLEAR(XMLNodelist);
CLEAR(XMLDomElement);
CREATE(SourceXMLDocument,TRUE,TRUE);

IF SourceXMLDocument.load('C:\TEMP\testing.xml') THEN BEGIN
    XMLNodelist :=SourceXMLDocument.getElementsByTagName('ns1:multiCallResponse');
    XMLDomElement :=  XMLNodelist.item(0);
    IF XMLDomElement.hasChildNodes() THEN BEGIN
       XMLNodelist1 := XMLDomElement.childNodes();
       XMLDomElement1 := XMLNodelist1.item(0);      //item
       MESSAGE (XMLDomElement1.nodeName);  -------------> To get the node name
       MESSAGE (XMLDomElement1.text); ----------------------> To get the node value
     End;
End;

No comments:

Post a Comment