DotNet Interop: error constructor of XmlHttpClass

greysgreys Member Posts: 29
edited 2015-03-28 in NAV Three Tier
Hi,

I'm currently in the process of migrating to NAV2013. I have a codeunit that contains all wisdom concerning calling webservices. It was formerly based on automations and I'm now bringing it up to date with the use of dotnet interoperability.

I have declared the following variables:
XmlHttp (DotNet,MSXML.IXMLHttpRequest.'Microsoft.MSXML, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
XmlHttpClass (DotNet,MSXML.XMLHTTPRequestClass.'Microsoft.MSXML, Version=8.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a')

But on calling the following constructor
XmlHttp := XmlHttpClass.XMLHTTPRequestClass;

I get the error message
'Cannot create an instance of the following .NET framework object: assembly Microsoft.MSXML, Version=8.0.0.0, Culture-neutral,PublicKeyToken=b03f5f7f11d50a3a, type MSXML.XMLHTTPRequestClass'

Since .Net is not my natural development habitat, I'm a bit confused on what goes wrong. Anybody a suggestion?

Best regards,

Greys

Comments

  • greysgreys Member Posts: 29
    Mmmm, I think the configuration of our application server (Windows 2012) is the problem. Running the code from my local machine works flawlessly. Doesn't come Windows 2012 Server with the MSXML?

    Regards,

    Greys
  • PhdevriesPhdevries Member Posts: 2
    We have exactly the same problem. Installing msxml 6 on the windows 2012 server won't help. Who has any suggestions?
  • okioki Member Posts: 46
    Hi,

    you should assign the constructor result to the variable XmlHttpClass, not to XmlHttp:

    XmlHttpClass := XmlHttpClass.XMLHTTPRequestClass;

    Oli
  • okioki Member Posts: 46
    Hi,

    I was wrong in my last post.

    Here is the solution:

    You have assigned an invalid .Net declaration in your variable definition:

    use
      MSXML.XMLHTTPRequest.'Microsoft.MSXML, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
    instead of interface
      MSXML.
    IXMLHttpRequest.'Microsoft.MSXML, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

    oli
  • PhdevriesPhdevries Member Posts: 2
    In the end the problem was the lack of the assembly in C:\Windows\Assembly folder. Thanks everybody for their help.
Sign In or Register to comment.