Storing XML document from Stream Object via MSMQ

I have this issue, when receiving my event: CC2::MessageReceived triggered by the Communication Component i have this code: InMsg := InMessage; InS := InMsg.GetStream(); XMLDom.load(inS); XMLDom.save(STRSUBSTNO(‘c:_msmq\private$_apovision%1.xml’,FORMAT(TIME,0,’<Hour,2><Minute,2><Seconds,2>’))); InMsg.CommitMessage(); But all my saved files end up with zero content. Any hints? Have also tried looking at the File.CREATEINSTREAM and File.CREATEOUTSTREAM also with no luck.

Ok, solved it by changing the code to: XMLDom.load(inMsg.GetStream); [:I]

Soren, Still getting an empty XMLDOM even when using XMLDom.load(inMsg.GetStream) Any thoughts?

lCarpen, Have you discovered yet as to why your DOMDoc is still empty? I have the same issue and have been beating myself in the head. If you have anything please let me know.

Im sure you have already tried this, but what happens if you change the above to read: IF NOT XMLIn.load(InMsg.GetStream()) THEN ERROR(‘DOM parser cannot understand message format!’); If you do get the error message, it means theres probably a problem with the format of the incoming message. Regards, Edward.

Edward, Thanks for your reply. I tried your piece of code and I did receive the error. However I do not know what to do at this point. I have already tried formatting it with XML, ACTIVEX, and Binary. Any pointers?

What the error means is whatever application is putting messages onto the queue is not placing messages that can be understood by the xml parser. Instead of passsing the incoming message to the DOM parser, try outputting it to a text file or message box to see what it looks like. InS := InMsg.GetStream(); IF InS.READ(Txt,250) THEN; MESSAGE(Txt); Have a look at the output and see if the xml has any obvious errors. I suppose obvious ones would be: 1) Only 1 root element is allowed 2) All opening tags have closing tags hello 3) All lone elements should be closed too It could be one of many things really. At least we know that the problem is not to do with MSMQ or Navision now. Regards, Edward.

After much wrangling with Microsoft, I ended up abandoning the MSMQ adapter and using the old Commerce Portal dll and it worked great. Using the MSMQ adapter, I did discover that if you send a message from outside of Navision, the text of the body in the MSMQ message has a space between each character - Microsoft said it was unicode conversion. When I constructed the same XML document and created the MSMQ message from within Navision, the body of the MSMQ message had no spaces between the characters. It appeared to be packed in some way. Never did figure this out. Basically, I am sold on the idea of using the MSMQ adapter for outbound messages and the Commmerce Portal dll for inbound. A bonus in using the Commerce Portal dll is that it returns an XML DOM document with an additional node added that contains the MSMQ GUID of the message… very handy! Lindsay