KSOAP2:如何使用HttpsTransportSE?

发布于 2024-12-06 09:26:06 字数 363 浏览 0 评论 0原文

我正在开发一个 Android 应用程序来与需要 SSL 连接的 Web 服务进行通信。为此,我想使用 HttpsTransportSE,但我找不到有关如何使用该类的教程。 我正在尝试构建一个新实例,但我不确切知道必须传递给构造函数的信息。 我的一行代码:

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

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

如果我换了???通过“”或 null,会发生 IOException。 我认为 ????应该是客户端证书。是这样吗? 有人有关于 HttpsTransportSE 的教程吗?有什么有用的链接吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

断爱 2024-12-13 09:26:06

来自 HttpsTransportSE 的这段代码应该有所帮助:

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://MyServer:8080/MyService
您致电:

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

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);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文