Unable to load XMLDOM from OUTSTREAM in RTC?

pdjpdj Member Posts: 643
edited 2013-01-25 in NAV Three Tier
NAV2009 R2 - I have this code, which works fine in the classic client:
Variables:
OutStreamXSL: OutStream		
xmldomXSL: Automation: 'Microsoft XML, v6.0'.DOMDocument	

Code:
SomeRec.GET;
SomeRec.CALCFIELDS("Some BLOB Field");
IF NOT SomeRec."Some BLOB Field".HASVALUE THEN
  ERROR('Some error');
SomeRec."Some BLOB Field".CREATEOUTSTREAM(OutStreamXSL);
CREATE(xmldomXSL);
xmldomXSL.load(OutStreamXSL);
MESSAGE(xmldomXSL.documentElement.nodeName);
This works fine in the Classic client, but the MESSAGE gives me an "The automation variable has not been instantiated." in the RTC. The code needs to work in both the Classic Client and the RTC so using .NET Interop is not an option. Can anybody tell me what I'm doing wrong?

I have tried with CREATE(xmldomXSL,TRUE,TRUE) but that gives me an error: "Streams cannot be used with client-side invoked automation objects.". I don't wish to do it client side, so there is no need to "solve" this issue.
Regards
Peter

Answers

  • deV.chdeV.ch Member Posts: 543
    the 3rd parameter if the function Create specifies if the automation is created on the client, you set true so its client siede isntead of server-side!
    [Ok :=] CREATE(Automation [,NewServer] [,OnClient])
    

    So you need to call it this way: CREATE(xmldomXSL,true,false)
  • pdjpdj Member Posts: 643
    Which is why there is no need to look further at the CREATE statement :-)

    It seems it is my mistake - I'm using OutStreams where I should use InStreams :oops:
    Apparently the classic client doesn't mind... :?
    Regards
    Peter
  • CyberghostCyberghost Member Posts: 46
    Can you post your code, as I'm still having the same issue?

    Thanks in advance
    "When you eliminate the impossible, whatever remains, however improbable, must be the truth" - Sherlock Holmes

    "God and developers are in a constant battle. Developments to make their applications more idiot-proof, and God to produce bigger idiots!"
  • pdjpdj Member Posts: 643
    Well, it is a long time ago, but I'm quite sure I just replaced the OutStream variable with an InStream variable. (And the CREATEOUTSTREAM with CREATEINSTREAM)
    Regards
    Peter
  • CyberghostCyberghost Member Posts: 46
    Okay thanks. I done that.

    I'm still getting issue but hoping it will be resolved when running it as a web service rather than from a report which I was doing to test it.
    "When you eliminate the impossible, whatever remains, however improbable, must be the truth" - Sherlock Holmes

    "God and developers are in a constant battle. Developments to make their applications more idiot-proof, and God to produce bigger idiots!"
Sign In or Register to comment.