XMLHTTP.send -> Text too long for the textbuffer

NavBoy13NavBoy13 Member Posts: 15
Hello, I want to send a xml file created in Navision with a xmlport to a webservice. i use the xmlhttp automation. This works fine for small xml files. When my xml file is 2 kb I get this error when the xmlhttp.send function is executed: The text is too long for the textbuffer.

When I open the XMl generated from the xmlport, I see that there are breaks after every line, is this the cause of the error? How can I remove them from the xml, it doens't work on my way...

Did anyone ever retrieved the same error? How did you solve it?

Tnx!

This is de code:
//XML EXPORT
//-------------
IF XMLPORT.EXPORT(50009,lstrOutStream,lrecEloHeader) THEN BEGIN
  ltmpBlob.Blob.CREATEINSTREAM(lstrInStream);
  lautXml.load(lstrInStream);
  lautXml.save('C:/Question.xml');
END ELSE BEGIN
  ERROR('error:'+ GETLASTERRORTEXT);
END;

//XML send
//-------------
CREATE(locautXmlHttp);
CREATE(locautXmlResponse);

locautXmlHttp.open('POST','http://management.companyname.be/nav.php',TRUE);
locautXmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
locautXmlHttp.setRequestHeader('Connection', 'close');

//This line gives an error
//locautXmlHttp.send('navml='+lautXml.xml));

//So I want to remove al the breaks from the xml generated by the xmlport. I hope that this is the cause of the error.
lchr10 := 10;
lchr13 := 13;

intPos := STRPOS(FORMAT(lautXml.xml),FORMAT(lchr10));

WHILE intPos > 0
DO BEGIN
  lbtxtXML := DELSTR(FORMAT(lautXml.xml),intPos,1);
  intPos := STRPOS(lbtxtXML,FORMAT(lchr10));
END;

locautXmlHttp.send(FORMAT(lbtxtXML));

//RETRIEVE ANSWER
//-------------------
locautXmlResponse.load(locautXmlHttp.responseXML);
locautXmlResponse.save('C:\Response.xml');

Comments

Sign In or Register to comment.