I'm trying to make a connection between a website and navision v3.70 using MSMQ. This works fine with text files, I can send and receive text files but now I want to use XML files and it doesn't seem to work. This is the C/AL code for receiving XML files, does anybody know what the problem is.
Comcom::MessageReceived(VAR InMessage : Automation "''.IDISPATCH")
InMsg := InMessage;
InStr := InMsg.GetStream;
CREATE(XMLDom);
XMLDom.load(InStr);
InsertMSMQXML(XMLDom.documentElement);
Globals
Comcom /Automation/ 'Navision Communication Component version 2'.CommunicationComponent
MQBus /Automation/ 'Navision MS-Message Queue Bus Adapter'.MSMQBusAdapter
InMsg /Automation/ 'Navision Communication Component version 2'.InMessage
XMLDom /Automation/ 'Microsoft XML, v5.0'.DOMDocument
XMLNode /Automation/ 'Microsoft XML, v5.0'.IXMLDOMNode
InStr /InStream
This is the function that inserts a record when the XML file is imported.
InsertMSMQXML(xmlCustomerNode : Automation "'Microsoft XML, v5.0'.IXMLDOMNode")
MSMQTestData.TextValue := xmlCustomerNode.firstChild.firstChild.nodeValue;
IF NOT MSMQTestData.INSERT THEN
REPEAT
MSMQTestData."Entry No." := MSMQTestData."Entry No." + 1;
UNTIL MSMQTestData.INSERT
0
Comments
I really have no idea what you are trying to do with this: Of course it gets a little tricky when you have to go into nodelists for repeating nodes, but there are plenty of examples in standard Navision XML codeunits.
HTH
RIS Plus, LLC
For your information...
MSMQTestData is a Table with two fields: "Entry No." (integer) and "TextValue" (Text 50). This Table is for testing only, just to see if the data from the XML file is inserted into a table. Now I know this is possible, I'll start building the application.
The last part is to increase the "Entry No." If the number exist it does "Entry No." + 1 and checks if an insert is possible.
THNX Again!
RIS Plus, LLC
So first you have to be sure that your code is correct. Are you trying to import a text file or an XML file?
To access the Single Instance property, open the codeunit in design mode, open the properties window and set the SingleInstance property to Yes.
Also, the MSMQ must be a non-transactional queue, and it will only work if you have just the common MSMQ objects installed.
RIS Plus, LLC