Could not create an instance of the OLE or Automation...

erarunaryaerarunarya Member Posts: 21
edited 2014-12-11 in Navision e-Commerce
Hi,
I am trying to run a processing report to update items on magento from Nav thorough APIs.
For this i am using Automation Server in which i have take a variable of XMLNode of type 'Microsoft XML, v3.0'.IXMLDOMNode.
Now i am using this variable in the code:

"XMLDOM.load(objConn.OutputStream);
XMLDOM.getElementsByTagName('loginReturn');

XMLNode := XMLDOM.selectSingleNode('//loginReturn');
SessionId := FORMAT(XMLNode.text);"

But an error come everytime i run this report mentioned in image below:

Comments

  • vremeni4vremeni4 Member Posts: 323
    Hi,

    The problem is that you did not create the automation. You have to use the command CREATE to do this.
    You need first to define a variable:

    Name DataType Subtype Length
    XmlDoc Automation 'Microsoft XML, v6.0'.DOMDocument60

    Then in the code you have to create automation.
    IF ISCLEAR(XmlDoc) THEN CREATE(XmlDoc);
    XmlDoc.load(objConn.OutputStream);

    I hope this helps.
    Thanks.
  • erarunaryaerarunarya Member Posts: 21
    HI vremeni4,

    Problem is not in XMLDom and outstream, I have created it properly.
    Actually on debugging it shows the error on XMLNOde (). Afterwards if I am going to create this automation then also there is an error that this library is not properly register or corrupted. :-k
    Name DataType Subtype Length
    XMLNode Automation 'Microsoft XML, v6.0'.IXMLDOMNode
  • vremeni4vremeni4 Member Posts: 323
    Hi,

    In one of the database we have this code

    IF ISCLEAR(XmlDoc) THEN CREATE(XmlDoc);
    XmlDoc.load(XmlHttp.responseBody);
    XmlNode := XmlDoc.selectSingleNode('//Soap:Envelope/Soap:Body/Checkline_Result/return_value/');
    //MESSAGE(XmlNode.text);
    XmlDoc.save('C:\response.xml');
    //HYPERLINK('C:\response.xml');
    CLEAR(XmlDoc);

    Name DataType Subtype Length
    XmlDoc Automation 'Microsoft XML, v6.0'.DOMDocument60
    XmlNode Automation 'Microsoft XML, v6.0'.IXMLDOMNode

    It works fine.

    Also you can take a look at the standard codeunit
    Type ID Name Modified Version List Date Time Compiled Locked Locked By
    5 6224 XML DOM Management No NAVW13.10 17/12/01 12:00:00 Yes No

    as it provides some additional examples.
    It may be worth to try to run repair from NAV setup DVD.

    I hope this helps.
    Thanks.
  • erarunaryaerarunarya Member Posts: 21
    ](*,) may be this is due the corrupted library for XMLNode. Didn't find any solution till now.
  • Stella567Stella567 Member Posts: 6
    Hello everyone!
    your answers were helpfull for me also, thank you very much!
Sign In or Register to comment.