从调用Android应用程序的Web服务 [英] call a web service from android app

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

问题描述


  

可能重复:结果
  <一href=\"http://stackoverflow.com/questions/7201100/android-ksoap2-httpstransport-warning-end-mothd\">android KSOAP2 HttpsTransport警告结束mothd


我建立一个简单的SOAP Web服务的Netbeans。我现在想从我在Eclipse中的Andr​​oid应用程序调用Web服务。我用ksoap2和我运行Android应用到真实设备不emulator.I有这样的警告:


  

霉素警告:忽略InnerClasses属性为匿名内部类
  (org.ksoap2.transport.KeepAliveHttpsTransportSE $ 1)不拿出一个
  相关EnclosingMethod属性。这个类可能是由一个生产
  编译器并没有针对现代.class文件格式。建议
  解决方案是重新编译从源类,使用最多的最新的编译器
  并且不指定任何-target类型选项。忽视的后果
  这个警告是,在这个类反射操作不当会
  表明它是的的内部类。



解决方案

该警告是确定的(我得到同样的警告)。

我觉得你的字符串是错误的,他们必须是:

 私有静态最后弦乐NAMESPACE =htt​​p://service.hello.com;
私有静态字符串URL =htt​​p://79.107.216.7:8080/HelloWebApplication/HelloWS/;
私人静态字符串METHOD_NAME =你好;
私人静态字符串SOAP_ACTION = NAMESPACE + METHOD_NAME;

如果这条线给你一个错误

  SoapObject resultsRequestSOAP =(SoapObject)envelope.getResponse();

试试这个:

 对象响应= envelope.getResponse();

Possible Duplicate:
android KSOAP2 HttpsTransport warning End mothd

i build a simple soap web service to Netbeans. Now i am trying to call that web service from my android application in Eclipse. I use ksoap2 and i run the android app to a real device not to emulator.I have this warning:

Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.ksoap2.transport.KeepAliveHttpsTransportSE$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is not an inner class.

解决方案

The warning is ok (I get the same warning).

I think your strings are wrong, they must be:

private static final String NAMESPACE = "http://service.hello.com";
private static String URL="http://79.107.216.7:8080/HelloWebApplication/HelloWS/";
private static String METHOD_NAME = "hello";
private static String SOAP_ACTION = NAMESPACE + METHOD_NAME;

And if this line gives you an error

SoapObject resultsRequestSOAP = (SoapObject) envelope.getResponse();

try this:

Object response = envelope.getResponse();

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

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