MSMQ: sending XML data with more then 250 characters?

I have established a MSMQ connection and try to send xml formatted data from Navision to the message queue. This seems impossible with data exceeding 250 characters as I get the error message “The length of the text string exceeds the size of the string buffer”. (If I try sending pure text, then at least I get up to 1024 characters (limitation of text variables).)

This error is caused by the following line in bold (OutS being OutStream Var; xmldoc being Automation XML3 Document Var):

OutMsg := CC2.CreateoutMessage(‘Message queue://ntserv29\test’);

OutS := OutMsg.GetStream();

OutS.WRITE(xmldoc.xml);

<…>

The XML stream is created as follows:

IF ISCLEAR(xmldoc) THEN
CREATE(xmldoc);

xmldoc.async := FALSE;

xmldoc.loadXML(
‘<?xml version="1.0" encoding="utf-16"?>’+
‘<Purchase_Order_Export_XML/>’);

xmlNode := xmldoc.documentElement;

DOMManagement.AddElement(xmlNode,‘DocType’,’’,’’,DocTypeNode);
DOMManagement.AddElement(DocTypeNode,‘Document_Type’,‘Purchase Order’,’’,PropertyNode);
DOMManagement.AddAttribute(PropertyNode,‘Caption’,‘Document Type’);
DOMManagement.AddElement(xmlNode,‘Purchase_Header’,’’,’’,HeaderNode);

<…>

Can please anyone tell me, why I get this text-size restriction? If there is no error on my side, is the only way to send messages of this size by cutting them into chunks of 250 characters? If yes, how can I assure that the whole XML message is put into the in-queue of the MSMQ before it is read?

Any other idea how to send messages from Navision to be received by a third party system?

Thanks for any help!

Try to use bigtext. You can write a bigtext to a stream in one operation