c# SOAP Web Service calls failing with "Could not establish secure channel for SSL/TLS with authority". Even after loading the certificate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2019 06:14 AM
Hi All,
I am using ServiceNow developer instance.
I am trying to call the getRecords() method from the web service (https://xxx.service-now.com/sc_req_item.do?WSDL) using c#.
Its always throwing the error "Could not establish secure channel for SSL/TLS with authority 'xxx.service-now.com'".
Based upon the suggestions i have installed the certificate in windows and loaded the same in code. but still no luck. Here's the sample code. Any suggestion is greatly appreciated. Thanks in advance.
public static void CallServiceNowWebService()
{
RITM.ServiceNowSoapClient ritm = new RITM.ServiceNowSoapClient();
ritm.ClientCredentials.ClientCertificate.SetCertificate(
StoreLocation.LocalMachine,
StoreName.My,
X509FindType.FindByThumbprint,
"f2e30f9dc033b01f8024c5a0f648b916a1bd63fd");
ritm.ClientCredentials.UserName.UserName = "admin";
ritm.ClientCredentials.UserName.Password = "Weblogic@123";
RITM.getRecords ritmtickets = new RITM.getRecords();
ritmtickets.number = "TEST001";
RITM.getRecordsResponseGetRecordsResult[] records = ritm.getRecords(ritmtickets);
if ((records != null && records.Length > 0))
{
MessageBox.Show("Ticket Available");
}
else
{
MessageBox.Show("Ticket Not Available");
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2019 04:25 PM
I have the same error message and believe the issue could be related to KB0746078: Retiring TLS1.0 and 1.1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-19-2019 09:00 PM
Thank You jwalton. Yes it's related to security protocol type. Adding this line in code before creating soap client resolved the issue,
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;