Android的KSOAP Web服务问题 [英] Android kSOAP web service problem

查看:157
本文介绍了Android的KSOAP Web服务问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图调用通过KSOAP公共Web服务(w3schools.com/webservices/tempconvert.asmx)(下载并包括来​​自谷歌的.JAR直接)。

I'm trying to invoke a public web service (w3schools.com/webservices/tempconvert.asmx) via kSOAP (downloaded and included the ".jar" directly from Google).

下面是我的code:

// declarations

private static final String NAMESPACE = "http://tempuri.org/" ;
private static final String METHOD_NAME = "CelsiusToFahrenheit";
private static final String SOAP_ACTION = "http://tempuri.org/CelsiusToFahrenheit";
private static final String URL = "http://216.128.29.26/webservices/tempconvert.asmx";

// code

try
{
   SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
   SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
   HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

   request.addProperty("Celsius", "32");
   envelope.setOutputSoapObject(request);
   androidHttpTransport.call(SOAP_ACTION, envelope);

   Object result = envelope.getResponse();
}
catch(Exception e)
{
   e.printStackTrace();
}

此外,的Andr​​oidManifest.xml包括访问互联网的权限:

Also, "AndroidManifest.xml" includes the permission to access the internet:

<uses-permission android:name="android.permission.INTERNET"></uses-permission>

另外,我的AVD可以访问互联网(通过浏览器应用程序试了一下)。

Also, my AVD can access the internet (tried it via the Browser app).

有人可以帮我吗?我一直在想这个约6小时,现在,我仍然失败了。

Can someone please help me? I've been trying this for about 6 hours now, and am still failing.

感谢您!

推荐答案

不太。我之前(尝试至少5种不同的方法)。它并没有帮助。这是API版本。我有12.它没有工作。我发现某处KSOAP仅适用于8和较低。去图:)

Not quite. I had it before (tried at least 5 different approaches). It didn't help. It was the API version. I had 12. It didn't work. I found somewhere that kSOAP works only with 8 and lower. Go figure :)

我希望大家谁遇到过这个问题,会发现这之前,他们将失去太多的时间与12 API。

I hope everyone who encountered this problem, will find this before they'll loose too much time with the 12 API.

这篇关于Android的KSOAP Web服务问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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