KSOAP2: How to use HttpsTransportSE?

user959571 picture user959571 · Sep 22, 2011 · Viewed 8.7k times · Source

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?

Answer

Marty Cullen picture Marty Cullen · Sep 22, 2011

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