Hi everyone,
First of all, the Webservice it's tested with the SOAP:UI, the response is ;
<data contentType="application/octet-stream" contentLength="88047">JVBERi0x.. A ENCODED PDF</data>
Then, I try to get this info to build a BigText and build my PDF document. I've tried in two different ways that are listed below;
FIRST OPTION
VARS : HTTPRequest DotNet MSXML.XMLHTTPRequest.'Microsoft.MSXML, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' CODE : CLEAR(HTTPRequest); HTTPRequest := HTTPRequestClass.XMLHTTPRequestClass; HTTPRequest.open('POST', URL, FALSE,User,Password); HTTPRequest.setRequestHeader('Content-Type', 'application/xml; charset=utf-8'); HTTPRequest.send(BIGTEXTOutPut); //Valid XML Structure inserted in to the BIGTEXTOutPut IF NOT (HTTPRequest.status = 200) THEN BEGIN InsertErrorLog(COPYSTR(FORMAT(HTTPRequest.status) + ' ' + FORMAT(HTTPRequest.statusText),1,250)); ERROR(TEXTERRORCONSTANT); END;
Now, I have three options to get the HTTPRequest response ;
responseStream --> Try to get the response in a System.IO.MemoryStream , have the chance to use the function CopyTo for copy it to a NAV InStream, and with my BigText read this inStream. When i use the CopyTo from the MemoryStream to a NAV inStream have an error.
responseText --> The text from the response is so long that the RTC client have a unexpected error and the session closes.
responseXML --> The response don't have a valid estructure to load it in a XMLDoc var.
SECOND OPTION
VARS : Credential DotNet System.Net.NetworkCredential.'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' HttpWebRequest DotNet System.Net.HttpWebRequest.'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' HttpWebResponse DotNet System.Net.WebResponse.'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' MemoryStream DotNet System.IO.MemoryStream.'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' XMLDocNet DotNet System.Xml.XmlDocument.'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' CODE :
XMLDocNET := XMLDocNET.XmlDocument(); XMLDocNET.LoadXml(FORMAT(BIGTEXTOutPut)); //XMLDocNET.Save('C:\TEMP\RequestDotNet.xml'); HttpWebRequest := HttpWebRequest.Create(URL); HttpWebRequest.Timeout := 30000; HttpWebRequest.UseDefaultCredentials(FALSE); Credential := Credential.NetworkCredential; Credential.UserName := ValidUser; Credential.Password := ValidPW; HttpWebRequest.Credentials := Credential; HttpWebRequest.Method := 'POST'; HttpWebRequest.ContentType := 'application/xml; charset=utf-8'; MemoryStream := HttpWebRequest.GetRequestStream; XMLDocNET.Save(MemoryStream); MemoryStream.Flush; MemoryStream.Close; HttpWebResponse := HttpWebRequest.GetResponse; MemoryStream := HttpWebResponse.GetResponseStream; lRecTempBlob.Blob.CREATEINSTREAM(lInStream); lMemoryStream.WriteTo(lInStream); //After of that use BIGTEXT.READ for load lInstream
When i try to use WriteTo method, have an error converting to NAV inStream...
Any ideas?
Thank you!!
*This post is locked for comments