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:
Some ideas?
Thanks!
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:
My code is:Break On Error Message:
Unable to convert from Microsoft.Dynamics.Nav.Runtime.NavDotNet to Microsoft.Dynamics.Nav.Runtime.NavOutStream.
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!