SelectSingleNode from SOAP Response

kenjeskenjes Member Posts: 76
Hi

I need to get the InnerText from the following xmlfile ( From "NodeB")

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <NodeA>xmlns="https://xxxxxxxxxx.com/">
      <NodeB>NEED TO GET THIS TEXT</NodeB>
    </NodeA>
  </soap:Body>
</soap:Envelope>

I have the XMLFile in a System.Xml.XmlDocument .DOTNET var. ( And in a Instream )


My first idea was to use codeunit 6224
Then use DOTNET

I have tried to google a lot :smile:


Someone that can help me out here..

THANKS

Best Answer

  • HannesHolstHannesHolst Member Posts: 119
    Answer ✓
    Hi,
    XMLDocNodeList := ResponseXML.GetElementsByTagName('NodeB');
    XMLDocNode := XMLDocNodeList.Item(0);
    IF XMLDocNodeList.Count > 0 THEN 
      BEGIN
        MESSAGE(XMLDocNode.InnerText);
      END;
    

    Variables:
    Name	                DataType	Subtype
    ResponseXML	        DotNet	        System.Xml.XmlDocument.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    XMLDocNodeList	DotNet	                System.Xml.XmlNodeList.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    XMLDocNode	        DotNet	        System.Xml.XmlNode.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    

Answers

  • HannesHolstHannesHolst Member Posts: 119
    Answer ✓
    Hi,
    XMLDocNodeList := ResponseXML.GetElementsByTagName('NodeB');
    XMLDocNode := XMLDocNodeList.Item(0);
    IF XMLDocNodeList.Count > 0 THEN 
      BEGIN
        MESSAGE(XMLDocNode.InnerText);
      END;
    

    Variables:
    Name	                DataType	Subtype
    ResponseXML	        DotNet	        System.Xml.XmlDocument.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    XMLDocNodeList	DotNet	                System.Xml.XmlNodeList.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    XMLDocNode	        DotNet	        System.Xml.XmlNode.'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
    
  • RockWithNAVRockWithNAV Member Posts: 1,139
    Please follow as recommended above, it will solve your case for sure.

    If you face any issue then please let us know.
  • kenjeskenjes Member Posts: 76
    :smiley: Of Course ... I was so close .... :smiley:

    Thanks HannesHolst
Sign In or Register to comment.