Sending XML with MSMQ

Hi Am trying to send an XML file created by an XMLport with MSMQ. I have a single instance Codeunit running with the Navision Timer that is checking a table inside Navision. When it finds a record, it exports a Sales Order using an XMLPort and tries to send it to a message queue. My code so far on the Timer trigger… CLEAR(SalesHeader); SalesHeader.SETRANGE(“Document Type”,SalesHeader.“Document Type”::Order); SalesHeader.SETRANGE(“No.”,ActionLine.“Source No.”); SalesHeader.FIND(’-’); SalesHeader.SETRECFILTER; IF ISCLEAR(MQBus) THEN CREATE(MQBus); IF ISCLEAR(CC2) THEN CREATE(CC2); IF ISCLEAR(OutMsg) THEN CREATE(OutMsg); IF ISCLEAR(XMLDom) THEN CREATE(XMLDom); FileName := ‘C:\test.xml’; CLEAR(Outputfile); Outputfile.TEXTMODE(TRUE); Outputfile.WRITEMODE(TRUE); Outputfile.QUERYREPLACE(FALSE); Outputfile.CREATE(FileName); Outputfile.CREATEOUTSTREAM(OutS); XMLPORT.EXPORT(71000,OutS,SalesHeader); CC2.AddBusAdapter(MQBus,0); MQBus.OpenWriteQueue(‘private$\Queue1’,0,0); OutMsg := CC2.CreateoutMessage(‘Message queue://private$\Queue1’); OutS := OutMsg.GetStream; XMLDom.load(FileName); Outs.Write(XMLDom.xml); OutMsg.Send(0); Basically the message is empty becuase XMLDom.xml is not returning any value (I know the xml file contains data becuase I have opened it manually to check). Do I need to do anything else to the XMLDom variable to get the data into the message queue or can you suggest a better way of doing this??? Thanks and regards Simon

The line Outs.Write(XMLDom.xml); should read Outs.Write(XMLDom); and it should work. Good Luck!!

Thanks for that, but I tried it but it doesnt work. XMLDom is my XML document automation variable. The OutS.WRITE() requires text to be passed through, by using OutS.WRITE(XMLDom) I am passing through the wrong data type. I have tried MESSAGE(’%1’,XMLDom.xml) directly after XMLDom.load(FileName); and the message box is empty, therefore I’m certain I need to do somthing to the XMLDom variable before I pass it to OutS.WRITE. I was possibly thinking of XMLDom.Selectnodes()?? BTW, I have also tried XMLDom.loadxml(FileName);. Any other suggestions? Anyone? Please? Regards Simon

Sorry I wasn’t paying attention there (still too early for me) What you need to do is save XMLDOM to your stream so it would be along the lines of XMLDOM.Save(OutS). It should work this time!!