webservice axis绕过https证书验证及NONEwithRSA Signature not available问题解决

webservice axis绕过https证书验证:


public String callWebservice(){
		String urlprint = "your url";
		String returnCode=null;
		try {
		//在方法中添加这一句代码即可
		AxisProperties.setProperty("axis.socketSecureFactory", "org.apache.axis.components.net.SunFakeTrustSocketFactory");
		Service service = new Service();
		URL url = new URL(urlprint);
		Call call = (Call) service.createCall();
		call.setTargetEndpointAddress(url);
		call.setOperationName("接口方法名");
		String returnMes = (String) call.invoke(new Object[]{"参数内容"});
		returnCode = returnMes;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return returnCode;
	}

但有时会出现以下报错:

Caused by: java.security.NoSuchAlgorithmException: NONEwithRSA Signature not available
解决方法:

在项目的lib包下添加sunjce_provider.jar,这个包可以在本地安装的Java的以下路径里找到:

$JAVA_HOME/jre/lib/ext


上一篇:The TensorFlow library wasn‘t compiled to use SSE instructions, but these are available on your mach


下一篇:避免死锁