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
标签:available,returnCode,webservice,url,String,call,https,new,axis 来源: https://blog.csdn.net/qq_36484670/article/details/114824963