Calling external https web services in AL

brimfred
Member Posts: 14
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!
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!
0
Answers
-
Hi,
have the same issue. Is there a solution yet?0 -
Update service tier to one that use TLS12 by default or use this code:ServicePointManager=System.Net.ServicePointManager
SecurityProtocolType=System.Net.SecurityProtocolTypeServicePointManager.SecurityProtocol := SecurityProtocolType.Tls12;
1 -
But DotNet is not allowed in AL.
And what does it mean - "update service tier to one that use TLS12"?0 -
So does anybody know whether it is possible at all, to consume webservices that require SSL/TLS connection from AL?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions