Quantcast
Channel: NAV Three Tier — mibuso.com
Viewing all articles
Browse latest Browse all 10032

Import XML throught XMLport from .NET XmlDocument

$
0
0
Hi!
Pls, I have codeunit with external add-on (dotnet variable) which returning some XmlDocument (next dotnet var.). I want import this XML throught XMLport to database. But I don't want use file system for save xml to disk and read it back to NAV (at 21th century).

My idea is load XML to XmlDocument and write it to MemoryStream and this stream hand over to xmlPort for import.

but i have problem with convert .net stream to "nav" stream:
Break On Error Message:
Unable to convert from Microsoft.Dynamics.Nav.Runtime.NavDotNet to Microsoft.Dynamics.Nav.Runtime.NavOutStream.
My code is:
xmlResponse := xmlResponse.XmlDocument();
MyAddon.GetXml(xmlResponse); // xmlResponse is "out XmlDocument"
// xmlResponse.Save('C:\..\someFile.xml'); // this working

MemoryStream := MemoryStream.MemoryStream();
xmlResponse.Save(MemoryStream);

COPYSTREAM(MemoryStream, InStream); // this not working, error message above
MyXmlPort.SETSOURCE(InStream);
MyXmlPort.IMPORT;
I try convert MemoryStream to OutStream with blob, but without success.
  TempBLOB.INIT;
  TempBLOB.Blob.CREATEOUTSTREAM(OutStream);
 
  //MemoryStream.Flush();
  //MemoryStream.Position := 0; 
  MemoryStream.CopyTo(OutStream); // I try also .WriteTo(..) -> both case make error

  COPYSTREAM(OutStream, InStream);

Some ideas?
Thanks!

Viewing all articles
Browse latest Browse all 10032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>