0

我正在尝试将 Web 服务与我的 android 应用程序连接,但在声明 SoapObject 时出现错误。请帮我解决它们!非常感谢。这是我的代码:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    final String Soap_Action = "http://huroid.com/AndroidGetAllUser";
    final String Soap_MethodName = "AndroidGetAllUser";
    final String Soap_NameSpace = "http://huroid.com/";
    final String Soap_URL = "http://huroid.com/UserService.asmx?op=AndroidGetAllUser";

    //CallService
    try{

        SoapObject request = new SoapObject(Soap_NameSpace, Soap_Action);
    }
    catch(Exception e){
        Toast.makeText(this, "Error", Toast.LENGTH_LONG);
    }

    adpUser.notifyDataSetChanged();


}

并且在这一行发生错误:

SoapObject request = new SoapObject(Soap_NameSpace, Soap_Action);

我不了解识别肥皂名称空间和方法的方法。:(

4

2 回答 2

0

输入 http://huroid.com/UserService.asmx?wsdl

在任何网络浏览器中,您都会看到可用的方法和带有方法参数和返回类型的肥皂命名空间信息。

这是你要问的吗?

于 2012-06-07T07:11:04.633 回答
0

您可以尝试以下格式:

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

喜欢:

    SoapObject request = new SoapObject(Soap_NameSpace, Soap_MethodName);

笔记:

+ replace Soap_Action with Soap_MethodName
+ Soap_Action = Soap_Namespace + Soap_MethodName
于 2012-06-07T08:37:32.440 回答