KSOAP2:如何使用HttpsTransportSE? [英] KSOAP2: How to use HttpsTransportSE?

查看:2700
本文介绍了KSOAP2:如何使用HttpsTransportSE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个Android应用程序与要求SSL连接的Web服务进行通信。为了做到这一点,我想用HttpsTransportSE,但我找不到有关如何使用该类教程。 我想建立一个新的实例,但我不知道确切的信息,我要传递给构造函数。 A线我的code:

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 =新HttpsTransportSE(地址,端口,????,超时);

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

应该在什么字符串????地方?

What string should be at ???? place?

如果我更换????通过或为空,一个IOException发生。 我想 ????应客户端证书。是对的吗? 没有任何人有一个关于HttpsTransportSE教程?任何有用的链接?

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?

推荐答案

从HttpsTransportSE这code应该帮助:

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

所以打 https://开头要播:8080 /为MyService 你叫:

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

这篇关于KSOAP2:如何使用HttpsTransportSE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆