泪流云 2016-10-18 01:56 采纳率: 0%
浏览 5730

C#调用https接口证书验证不通过问题

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);
}

}

  • 写回答

1条回答 默认 最新

  • oyljerry 2016-10-18 02:36
    关注

    一个是服务器证书是否正确,其次客户端建立ssl连接过程是否正确

    评论

报告相同问题?

悬赏问题

  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥30 用arduino开发esp32控制ps2手柄一直报错
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题