RE: Service Point Manager NAV 2009
Hi yzhums
Thanks for your answer. After many hit and tries finally this worked for me but I end up in another problem. I will explain. I am passing a certificate to the request.
//ServicePointManager.SecurityProtocol := SecurityProtocolType.Tls12;
ServicePointManager.Expect100Continue := TRUE;
ServicePointManager.SecurityProtocol := 3072;
ServicePointManager.DefaultConnectionLimit := 9999;
HttpWebRequest := HttpWebRequest.Create(UrlL);
HttpWebRequest.Method := 'POST';
HttpWebRequest.ClientCertificates.Add(Certificate);
HttpWebRequest.ContentType := 'application/xml';
RequestStr := HttpWebRequest.GetRequestStream();
StreamWriter := StreamWriter.StreamWriter(RequestStr,Encoding.ASCII);StreamWriter.Write(XMLResponse.InnerXml);
StreamWriter.Flush;
StreamWriter.Close;
StreamWriter.Dispose;
HttpWebResponse := HttpWebRequest.GetResponse();
Everything is working fine as long as I am in the server but when I try to process the request from the clients computer I get the error of .net assembly. I realized I should enable
RunasClient = true but when I enable that I get error on the COPYSTREAM. Something like NAV Instream to DotNet not possible.
Any suggestions?
SupplySetupTBL.ZAM_Certificate.CREATEINSTREAM(_InStream);
MemoryStreamL := MemoryStreamL.MemoryStream;
COPYSTREAM(MemoryStreamL,_InStream);
Certificate := Certificate.X509Certificate2(MemoryStreamL.ToArray,InformImmediateSupplySetupTBL.ZAM_Password);