我正在尝试将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);
我没有找不到方法来识别soap命名空间和方法。 :(
答案 0 :(得分:0)
答案 1 :(得分: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