2012-06-07 83 views
0

我試圖連接web服務與我的android應用程序,但它有一個錯誤時聲明SoapObject。請幫我解決它們!非常感謝你。這是我的代碼:Android無法連接到.net網絡服務

@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); 

我沒有方法已瞭解以確定肥皂命名空間和方法。 :(

回答

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