调用含有header的WebService时,跳过证书验证
最近在做Webservice的接口调用,header的用户名和密码都是正确的,地址也是对的,但一直提示:基础连接已关闭,未能与SSL/TLS安全通道建立信任关系。
解决方案:
请求之前加上下面得代码即可,简洁实用
1.
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
2.
ServicePointManager.ServerCertificateValidationCallback = new
RemoteCertificateValidationCallback
(
delegate { return true; }
);
这样做会潜在一定风险
所有验证都会通过,不论是否证书是无效得。whatever ,还有其他方案? 或者针对特定链接这样做就好了
1.This will accept all certificates, regardless of why they are invalid, which resolved the customer’s issue.
By validating the X509 certificate provided by the computer running Microsoft Exchange Server 2007 for SSL over HTTP, you help to provide a layer of security for the client application. You must validate certificates before you can start programming with Exchange Web Services proxy classes. If the callback is not set up, the first call will fail with a certificate error.
2.This solution could be potential security threat as you are turning off the SSL certificate validation. If this is production code, understand the risk of the server you are connecting to.
原文地址:https://www.cnblogs.com/miralce/p/4773037.html
调用含有header的WebService时,跳过证书验证的更多相关文章
- Ajax在调用含有SoapHeader的webservice方法
· [WebService(Namespace = "http://tempuri.org/")] · [WebServiceBinding ...
- Xcode中使用svn时,报证书验证错误Error validating server certificate for
转:http://blog.csdn.net/yhawaii/article/details/7511141 今天使用Xcode自带的svn客户端时,总是连接不上服务器,报如下错误: Error va ...
- java httpclient 跳过证书验证
import java.io.IOException;import java.net.InetAddress;import java.net.Socket;import java.net.Unknow ...
- Https Webservice接口的免证书调用
目录 前言 思路 方案 Axis调用 HttpClient调用 参考链接 前言 在调用https协议的Webservice接口时,如果没有做证书验证,一般会报javax.net.ssl.SSLHand ...
- 用C#.NET调用Java开发的WebService传递int,double问题
用C#.NET调用Java开发的WebService时,先在客户端封装的带有int属性的对象,当将该对象传到服务器端时,服务器端可以得到string类型的属性值,却不能得到int类型.double和D ...
- 用C#.NET调用Java开发的WebService传递int,double问题,出现java无法获得值!
https://www.cnblogs.com/zhbsh/archive/2013/04/22/3035477.html 用C#.NET调用Java开发的WebService时,先在客户端封装的带有 ...
- .net core中引用webservice,并忽略https证书验证
1.打开vs, 工具-->扩展和更新 下载这个 2. 在admin下右键,添加-->connected service 选择wsdl文件路径,或者服务的url,比如https://**** ...
- 动态调用webservice时 ServiceDescriptionImporter类在vs2010无法引用的解决方法
[导读]ServiceDescriptionImporter是创建Web Service 时使用的类,它是引用继承System.Web.Services 当我将VS2005里写的一段代码放在VS201 ...
- delphi7调用java写的webservice,在调用的时候弹出“wssecurityhandler:request does not contain required security header”
delphi7调用java编写的webservice问题我用delphi7调用java写的webservice,在调用的时候弹出“wssecurityhandler:request does not ...
- C#调用WebService时插入cookie
SOAPUI插入Cookie的方法 SOAP插入cookie的方法如下,点击Head,点击加号,然后直接设置就可以了. C#中调用webService时插入Cookie 由于调用的时候必须要带上coo ...
随机推荐
- 深入理解 Skywalking Agent
概述 Agent 功能介绍 + 整体结构 + 设计 插件机制详解 Trace Segment Span 详解 异步 Trace 详解 如何正确地编写插件并防止内存泄漏 扩展:如何基于 Skywalki ...
- 模块化打包工具-Webpack插件与其他功能
1.Webpack插件机制 上一篇提到的webpack的loader可以用来加载资源,包括各种css,图片文件资源,实现打包文件的功能,而webpack的插件则起到了加强webpack的作用,可以完成 ...
- Fox and Minimal path 题解
Fox and Minimal path 题目大意 构造一张无向图,使得从 \(1\) 到 \(2\) 的最短路数量为 \(k\). 思路分析 我们首先可以发现当 \(k = 2^t\) 时的构造方式 ...
- [ABC208E] Digit Products 题解
Digit Products 题目大意 求有多少个不大于 \(n\) 的正整数,使得该正整数各位乘积不大于 \(k\). 思路分析 观察数据范围,首先考虑数位 DP. 考虑设计记忆化搜索函数 dfs( ...
- Chromium 通过IDL方式添加扩展API
基于chromium103版本 1. 自定义扩展API接口 chromium默认扩展api接口中有chrome.runtime.*,和chrome.send.*等,现在我们就仿照chrome.runt ...
- node(1)
1.新建http.js //node搭建http服务器 let http=require('http'); //使用http建立服务请求 http.createServer(function(requ ...
- Ansible与Ansible部署
Ansible与Ansible部署 Ansible简介: Ansible是一个基于Python开发的配置管理和应用部署工具,现在也在自动化管理领域大放异彩.它融合了众多老牌运维工具的优点,Pubbet ...
- c#中单例模式详解
基础介绍: 确保一个类只有一个实例,并提供一个全局访问点. 适用于需要频繁实例化然后销毁的对象,创建对象消耗资源过多,但又经常用到的对象,频繁访问数据库或文件的对象. 其本质就是保证在整个 ...
- [Python急救站课程]正方形螺旋线的绘制
正方形螺旋线的绘制 import turtle turtle.speed('fastest') # 加快画笔速度 length = 3 # 正方形边长 angle = 90 # 转向角度 for i ...
- C#判断字符串的显示宽度
C#判断字符串的显示宽度 起因: 公司有一个使用项目使用HTML转换为PDF,其中有一个表格,表格的最后一列中的单元格,其字符串超长后会被丢弃,而不是换行到下一行展示(HtmlToPdf渲染引擎导致的 ...