Android KSoap 在 HttpTransportSE 上获取 java.io.FileNotFoundException 并抛出 XmlPullParserException
我正在尝试在 Android 手机上建立 Https 连接到 Wcf 服务。我通过 KSoap 阅读了很多关于 Android 上 Https 的教程。现在我可以通过证书检查了。但我无法连接到 https Web 服务。我总是面对 XmlParserExceptoin。
10-19 17:24:34.840: ERROR/HttpsTest(16518): XmlPullParserException
10-19 17:24:34.840: ERROR/HttpsTest(16518): org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0 in java.io.InputStreamReader@44de6a40)
10-19 17:24:34.840: ERROR/HttpsTest(16518): at org.kxml2.io.KXmlParser.exception(KXmlParser.java:273)
我调试应用程序并查看 ServiceConnection 中的 HttpsURLConnectionImpl 对象何时尝试连接到服务: https:// /192.168.100.66:443/Service1.svc/basic。它抛出一个异常:
java.io.FileNotFoundException: https://192.168.100.66:443/Service1.svc/basic
我在这个问题上花了很多时间,但我仍然坚持下去。我如何通过 Android KSoap 连接到网络服务?任何人都可以帮助我,我非常感谢您的帮助。
I'm trying to make Https connections on the Android phones to Wcf service. I read a lot of tutorials about Https on Android via KSoap. Now I can pass the certificate checking. But I can not make the connection to https web service. I always faced the XmlParserExceptoin.
10-19 17:24:34.840: ERROR/HttpsTest(16518): XmlPullParserException
10-19 17:24:34.840: ERROR/HttpsTest(16518): org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0 in java.io.InputStreamReader@44de6a40)
10-19 17:24:34.840: ERROR/HttpsTest(16518): at org.kxml2.io.KXmlParser.exception(KXmlParser.java:273)
I debug the app and see when the HttpsURLConnectionImpl object in the ServiceConnection try to connect to the service : https://192.168.100.66:443/Service1.svc/basic. It throws an exception:
java.io.FileNotFoundException: https://192.168.100.66:443/Service1.svc/basic
I spent many times for this issue but I'm still stuck with it. How can I connect to the web service via Android KSoap ?, anyone can help me, I really appreciate for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的 WCF 是 REST ful,则使用简单的 Http 请求按以下方式建立连接
<代码>
URL url = new URL("你的带参数的url");
URLConnection yc = url .openConnection();
<代码>
这是我在使用 WCF 时在代码中所做的事情,并且从服务器获取响应。
If your WCF is rest ful then use simple Http request to make connection in following way
URL url = new URL("your url with parameter");
URLConnection yc = url .openConnection();
this is what i have done in my code when i am working with WCF and i am getting resopnse from server.