Options

Outstream from function empty

kenjeskenjes Member Posts: 76
Hi

I have this code / Function :
LOCAL SendXMLCall(WebServiceURL : Text;Request : InStream;VAR Response : OutStream;VAR ErrorMsg : Text) StatusOK : Boolean
 
//Prepare the request. Load it as a text into an XML document.
vBigText.READ(Request);
vBigText.GETSUBTEXT(TempString,1);
XMLDoc := XMLDoc.XmlDocument();
XMLDoc.LoadXml(TempString);
 
//Start the web service call
XMLHttpRequest := XMLHttpRequest.Create(WebServiceURL);
XMLHttpRequest.Method('POST');
XMLHttpRequest.ContentType('text/xml;charset=utf-8');
XMLHttpRequest.KeepAlive(TRUE);
 
//Send the XMLDoc to the HttpRequest
streamWritter := streamWritter.StreamWriter(XMLHttpRequest.GetRequestStream, Encoding.UTF8);
XMLDoc.Save(streamWritter);
streamWritter.Close();
 
//Get the http response and save it in the response variable
XMLHttpResponse := XMLHttpRequest.GetResponse;
XMLDoc.Load(XMLHttpResponse.GetResponseStream);
XMLHttpResponse.Close;
XMLDoc.Save(Response);

Then Response outstream seems to be empty in the code where i'm calling the function from.

I have tried this in the end of the function - And the it outputs the value/xmltext :
ResponseXmlDoc := ResponseXmlDoc.XmlDocument();
ResponseXmlDoc.Load(Response);
MESSAGE(ResponseXmlDoc.InnerXml);

BUT, when I use the sam code in where i'm calling the function from, it says that there is no root element.. I think its empty

Can someone help - thanks.

Sign In or Register to comment.