XML doc out of Message Queue

I need to get the XML doc out of an incoming message from a Microsoft Message Queue. I have a Message Queue Bus Adapter, and a Communication Component, and in my ComCom::MessageReceived event I have the following code: MyInMsg := InMessage; CREATE(XMLIn); XMLIn.async := FALSE; MyInstream := MyInMsg.GetStream(); IF XMLIn.load(MyInstream) THEN MESSAGE(XMLIn.text) ELSE MESSAGE('Could not load XML Doc'); I borrowed this code from the standard Commerce Gateway codeunit, so it should work, but for some reason it’s not reading the XML out of the message’s stream. By the way, if I do: MyInMsg := InMessage; MyInstream := MyInMsg.GetStream(); MyInstream.READ(MyText); IF MyText = '' THEN MESSAGE('itsempty') ELSE MESSAGE(MyText); then it DOES show me the test XML (which only has one node for testing. However, I think this will lead to problems, since I want to read incoming sales orders out of the MSMQ, and that’s going to be more than the maximum 1024 characters of a text variable. Any suggestions? [xx(] <edit_add_PS> By the way II: If I add the MyInstream.READ(MyText);After the first block of code, the MyText variable is empty. Clearly I am not doing something right… [^] </edit_add_PS>

Hi Daniel, somewhere in the forum I found something like this: WHILE NOT (MyInstream.EOS()) DO BEGIN MyInStream.READTEXT(MyText,1024); IF MyText = '' THEN MESSAGE('itsempty') ELSE MESSAGE(MyText); END; This could solve problems with large files. Kind regards Herbert

<following_up> As it turned out, my initial code for receiving an XML document out of the message queue was correct after all… The problem was with the code that I wrote to send a message INTO the message queue. What I initially did was this: CREATE(CC2); CREATE(MQBus); CC2.AddBusAdapter(MQBus,1); locPathName := '.\private$\MyPrivateQueue'; MQBus.OpenWriteQueue(locPathName,0,0); OutMsg := CC2.CreateoutMessage('Message queue://' + locPathName); OutS := OutMsg.GetStream(); OutS.WRITE('<myxml>hello there</myxml>'); OutMsg.Send(0); all I needed to do was send in an XMLDOM object instead, and my receiving code worked without a problem. //OutS.WRITE('<myxml>hello there</myxml>'); CREATE(MSDOM); MSDOM.load('C:MyTest.xml'); // this file contains the same XML string MSDOM.save(OutS); // saves the DOM into the outstream OutMsg.Send(0); I thought you’d be interested in my findings here. So in order to receive an XML document out of the message queue, it must be sent into it first. Just an XML text string does not work. </following_up>