如何在android xamarin项目中使用.net web服务(.asmx)?
问题描述:
我想消费使用肥皂格式xamarin的Android应用程序的网络服务,下面是我的代码:如何在android xamarin项目中使用.net web服务(.asmx)?
System.Net.ServicePointManager.Expect100Continue = false;
TempConversionService.TempConvert tempConvert = new TempConversionService.TempConvert();
tempConvert.Url = "http://www.w3schools.com/webservices/tempconvert.asmx";
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Text = tempConvert.CelsiusToFahrenheit("50");
我试图消耗sample web service,但每次我得到403禁止/ 404 Not Found错误可以任何一个请让我知道是什么问题
答
我刚刚尝试使用此服务。
我添加了一个Web引用到我的项目,然后将下面的代码工作
var service = new TempConvert.TempConvert();
var f = service.CelsiusToFahrenheit("50");
有一个很好的介绍在这里:http://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/