如何在android xamarin项目中使用.net web服务(.asmx)?

时间:2015-03-25 10:44:56

标签: android soap xamarin asmx

我想使用soap格式在xamarin android应用程序中使用Web服务,下面是我的代码:

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 forbidden / 404 Not Found错误可以任何一个请让我知道是什么问题

1 个答案:

答案 0 :(得分:0)

我刚试过使用这项服务。

我为我的项目添加了一个Web引用,然后以下代码工作

var service = new TempConvert.TempConvert();
var f = service.CelsiusToFahrenheit("50");

这里有一个很好的介绍:http://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/