Passing an XML document to VB .NET

Kenny_Vaes
Member Posts: 8
Hi, I'm having some problems with passing an XML document to a VB .NET component I've created.
I'm trying to create a shipment schedule similar in functionality as the production schedule in Navision 4.0
I've created a Setup table that stores a BLOB...And an XMLPort that generates the XML.
I'm still a "Junior" developper so bear with me here
the autOutboundXML is an Automation variable of type "Microsoft XML, 4.0, DOMDocument40"
xptScheduleShipment is the XMLPort.
To pass the document to VB i'v made this code in navision after the autOutboundXML variable has been filled.
autGantt is a DLL i've created in VB .NET... the showForm funtion expects a XMLDocument to be passed..
When running this function from Navision is get an error...I've found out why this error occurs but I do not know how to solve it.
When changing the type of XMLDoc in the VB code to Object...and then displaying the object type in a messagebox I get System._ComObject as type instead of MSXML2.DOMDocument40.
Has anyone had any experience with this? Or does anyone know how to pass this XMLDocument to VB .NET?
Thanks in advance
I'm trying to create a shipment schedule similar in functionality as the production schedule in Navision 4.0
I've created a Setup table that stores a BLOB...And an XMLPort that generates the XML.
I'm still a "Junior" developper so bear with me here

recShipSchedSetup.LOCKTABLE(); recShipSchedSetup.GET(); recShipSchedSetup.GanttXML.CREATEOUTSTREAM(lostXMLSource); //GanttXML is the BLOB xptScheduleShipment.SETDESTINATION(lostXMLSource); xptScheduleShipment.InitializeHeader(rSalesHeader,TRUE,datDateFilter); //Sets a filter in the XMLPort IF xptScheduleShipment.EXPORT THEN BEGIN autOutboundXML.load(lostXMLSource);
the autOutboundXML is an Automation variable of type "Microsoft XML, 4.0, DOMDocument40"
xptScheduleShipment is the XMLPort.
To pass the document to VB i'v made this code in navision after the autOutboundXML variable has been filled.
... CREATE(autGantt); autGantt.ShowForm(autOutboundXML); ...
autGantt is a DLL i've created in VB .NET... the showForm funtion expects a XMLDocument to be passed..
Public Function ShowFrom(ByRef XMLDoc As MSXML2.DOMDocument40) As Integer Implements _Wrapper.ShowForm ..... End Function
When running this function from Navision is get an error...I've found out why this error occurs but I do not know how to solve it.
When changing the type of XMLDoc in the VB code to Object...and then displaying the object type in a messagebox I get System._ComObject as type instead of MSXML2.DOMDocument40.
Public Function ShowFrom(ByRef XMLDoc As Object) As Integer Implements _Wrapper.ShowForm MessageBox.Show(XMLDoc.GetType.ToString) End FunctionSo the variable I pass from navision isn't an MSXML2.DOMDocument40 but a System._ComObject. I tried converting the variable in VB, but that doesn't work.
Has anyone had any experience with this? Or does anyone know how to pass this XMLDocument to VB .NET?
Thanks in advance

0
Comments
-
Hi Kenny,
what are you doing within your VB.Net DLL ?
"Public Function ShowFrom(ByRef XMLDoc As MSXML2.DOMDocument40) As Integer Implements _Wrapper.ShowForm
.....
End Function"
It is possible to use the MSXML4 as Reference for your own functions.
When you try to show the XML-String use
MessageBox.Show(XMLDoc.Text) or
MessageBox.Show(XMLDoc.XML)
Stefan0 -
I wanted to pass the XML doc via a BLOB in a setup table to VB. But I got errors when doing that. Because of the type I gues. I know exported the XMLPort to a textfile and passed the location string to VB. That worked, But now I get errors with my Automation DLL
When I do CREATE(autDll) Navision says it cannot create an instance of the class.
I think I'm doing something wrong in the VB Code with the DLL. Does anyone know how to create a dll so I can register it to COM and navision can see the public functions?
Here's the code i've got now:Imports System Imports System.Xml Imports System.Runtime.InteropServices Imports NETRONIC.XGantt Namespace Wrapper <Guid("626C8CFD-E71A-4c7a-92A5-CE4DA6AEE4DA"), _ InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _ Public Interface _cWrapper <DispId(1)> Function ScheduleShipment(ByVal fileLocation As String) As Integer End Interface <Guid("FB4FB05F-A779-400f-93CC-4CB0D9F1A7C0"), _ ClassInterface(ClassInterfaceType.None), _ ProgId("Wrapper.cWrapper")> Public Class cWrapper Implements _cWrapper Public cWrapper() Private WithEvents myFrmGantt As New frmGantt Private WithEvents myVcGantt As New VcGantt Public Function ScheduleShipment(ByVal fileLocation As String) As Integer Implements _cWrapper.ScheduleShipment Initialize() ReadXML(fileLocation) End Function .....
I got this code from the net here: http://www.codeproject.com/dotnet/nettocom.asp
So I followed their instructions to create the DLL. It used to work fine before but since yesterday I've been getting errors. When I use the OLEView tool of Microsoft Visual Studio and try to create an instance of it by double clicking on the COM, I get:
IClassFactory::CreateInstance failed
Severity: SEVERITY_ERROR, facility: <Unknown>, ...
Anyone know what's the problem here?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions