2016-05-23 42 views

回答

1

,如果你的服務是不是一個WCF服務,您必須導入Web引用作爲.NET 2.0的Web服務:

Step 1

step 2

調用服務:

 Button button = FindViewById<Button> (Resource.Id.myButton); 

     button.Click += delegate { 
      SoapApp.www.webservicex.net.GlobalWeather soapservice = new SoapApp.www.webservicex.net.GlobalWeather(); 
      var cities = soapservice.GetCitiesByCountry("peru"); 
      button.Text = cities; 
     }; 

這就是結果:

Result

如果它不工作,嘗試這樣做,建立在Visual Studio中的代理在一個新的項目,並將它們複製類的Xamarin Studio項目,我知道這不是最好的方法,但是是一種解決方法。

不要忘記添加System.Web.ServicesSystem.ServiceModel參考。

對不起,Xamarin工作室西班牙文版,希望它可以幫助你