Problem using TLS12/13 for connection with webService

Hi everyone,

I am working with NAV 2018, installed windows server 2012 R2 standard.

I have created a a few years ago an integraion with an external webService. it is working perfectly, but they are changing the security protocol to use TLS 1.2 or 1.3. The system administrators from the webService gave me a new UOLR fortesting that we can connect via TLS1.2 or higher. I’m jsut changing the URL in my development, and I get this error(filtering traffic with fiddler):

This is the error in NAV:

pastedimage1617014488889v2.png

“Error in call System._ComObjectSend with the message: Cannot finde the specified resource”

The code is like this:

  ServicePointManager.SecurityProtocol := SecurityProtocolType.Tls13;
  
 
  IF ISCLEAR(XMLHTTP) THEN
    CREATE(XMLHTTP,FALSE,TRUE);
  XMLHTTP.open('POST', 'https://express5.xxx.com/expressconnect/shipping/ship',0,User,PSWD);
  XMLHTTP.setRequestHeader('Content-Type: ', 'application/x-www-form-urlencoded');
  XMLHTTP.setRequestHeader('Host','express5.xxx.com');
  XMLHTTP.setRequestHeader('SOAPAction', 'https://express5.xxx.com/expressconnect/shipping/ship');
  
  XMLText := 'xml_in=' +  XMLDocDotNet.OuterXml;
  XMLHTTP.send(XMLText);

It worries me that may be it will be an issue with the server, or any setting of it…

Any hint? Thank you all

Hello,

I’ve changed the develompnet to use DOTNET instead of automation. This is the new code:

ServicePointManager.SecurityProtocol(SecurityProtocolType.Tls13);
HttpWebRequest := HttpWebRequest.Create('https://express5.xxxx.com/expressconnect/shipping/ship');
credentials := credentials.NetworkCredential(User,PSWD);
HttpWebRequest.Credentials := credentials;
HttpWebRequest.Method :='POST';
HttpWebRequest.Accept := 'application/x-www-form-urlencoded';
HttpWebRequest.ContentType := 'application/x-www-form-urlencoded';
StreamWriter := StreamWriter.StreamWriter(HttpWebRequest.GetRequestStream);
StreamWriter.Write(XMLText);
StreamWriter.Close;
StreamWriter.Dispose;
HttpWebResponse := HttpWebRequest.GetResponse;
response := HttpWebResponse.ToString;

And I get this error:

pastedimage1617103136260v1.png

“…cannto create a secure channel…”

I’m starting to get quite desperate…

Maybe do you need to receive a secure token first (based on login & password because I can see the “http_s_://e…”)? like below :

WebRequestMgt.SetContentType(ContentTypeAppJSON);
WebRequestMgt.SetReturnType(ContentTypeAppJSON);

AuthorizationString := STRSUBSTNO(AuthTemplate, Login, Password);
TempBlob.WriteAsText(AuthorizationString, TEXTENCODING::UTF8);
AuthorizationString := TempBlob.ToBase64String();
WebRequestMgt.AddHeader(‘Authorization’, 'Basic ’ + AuthorizationString);

Thanks for your answer. I’ve just asked to the sysetm providor about this issue, but the authentication remains he same as before, user and password. They’ve jsut changed TLS 1.0 and 1.1, to 1.2 and 1.3