KSOAP2: How to use HttpsTransportSE?

浪子不回头ぞ 提交于 2019-12-10 17:13:21

问题


I am developing a android app to communicate with an web service that requires an SSL connection. To do that, I want to use HttpsTransportSE, but I can't find tutorials about how to use that class. I am trying to build a new instance, but I don't know exactly the info I must pass to the constructor. A line of my code:

HttpsTransportSE httpsTransport = new HttpsTransportSE("address", port, ????, timeout);

What string should be at ???? place?

If I replace ???? by "" or null, an IOException occurs. I think ???? should be the client certificate. Is that right? Does anybody have a tutorial about HttpsTransportSE? Any useful link?


回答1:


This code from the HttpsTransportSE should help:

public HttpsTransportSE (String host, int port, String file, int timeout) {
    super(HttpsTransportSE.PROTOCOL + "://" + host + ":" + port + file);
    this.host = host;
    this.port = port;
    this.file = file;
    this.timeout = timeout;
}

So to hit https://MyServer:8080/MyService You call:

HttpsTransportSE("MyServer", 8080, "/MyService", timeout);


来源:https://stackoverflow.com/questions/7518324/ksoap2-how-to-use-httpstransportse

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!