java通过证书调用https的接口,C#能实现吗?我C#尝试调用,一直报错“ssl通道建立时出现未知错误”
package com.jit.szlb.util.client;
import java.rmi.RemoteException;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
import javax.xml.rpc.encoding.XMLType;
import net.sf.json.JSONObject;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class TestClient {
public static void main(String[] args) throws ServiceException, RemoteException {
String basePath = TestClient.class.getResource("").getPath();
System.setProperty("javax.net.ssl.keyStoreType","pkcs12");
System.setProperty("javax.net.ssl.keyStore",basePath + "anjianshuju.pfx");
System.setProperty("javax.net.ssl.keyStorePassword","11111111");
System.setProperty("javax.net.ssl.trustStoreType","jks");
System.setProperty("javax.net.ssl.trustStore",basePath + "127.0.0.1.jks");
System.setProperty("javax.net.ssl.trustStorePassword","11111111");
Service service=new Service();
Call call=(Call)service.createCall();
call.setTargetEndpointAddress("https://139.215.205.50/iservice/webservice/iservice?wsdl");
call.setSOAPActionURI("http://service.jkfwpt.jit.com/serverService");
call.setUseSOAPAction(true);
call.setOperationName(new QName("http://service.jkfwpt.jit.com/", "serverService"));
call.setReturnType(XMLType.XSD_STRING);
call.addParameter("xtid", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter("fwid", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
call.addParameter("param", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
JSONObject obj = new JSONObject();
obj.put("queryCode", "mg0412kv");
String str = (String)call.invoke(new Object[]{"8a81a7c5576583be01576589ea260001","8a81a7c5576583be01576949f9d80002",""});
System.out.println(str);
}
}