Calling external https web services in AL

brimfredbrimfred Posts: 13Member
Hello,

I have the following code for consuming soap web services in AL.

RequestMessage.SetRequestUri(URL);
RequestMessage.Method('POST');
Content.GetHeaders(Headers);
Headers.Remove('Content-Type');
Headers.Add('Content-Type', ContentType);
Content.WriteFrom(XML_text);
RequestMessage.Content := Content;
WsHTTPClient.send(RequestMessage, ResponseMessage);
if not ResponseMessage.IsSuccessStatusCode() then
error(format(ResponseMessage.HttpStatusCode()) + ' , ' + ResponseMessage.ReasonPhrase());
if ResponseMessage.IsSuccessStatusCode() then
begin
ResponseMessage.Content().ReadAs(InStr);
while not instr.EOS() do begin
InStr.ReadText(ReadString);
OutString += ReadString;
end;

// do something with outstring

end
else
error(format(ResponseMessage.HttpStatusCode()));

It works ok for http web services but crashes on https.

Error from event log:

Type: System.Net.WebException
Status: SecureChannelFailure
Message: <ii>The request was aborted: Could not create SSL/TLS secure channel.</ii>
StackTrace:
at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)

Do I need to change some ssl configuration on IIS or NAV server?

Thanks!
Sign In or Register to comment.