【问题标题】:How to consume .net web service(.asmx) in android xamarin project?如何在 android xamarin 项目中使用 .net Web 服务(.asmx)?
【发布时间】:2015-03-25 10:44:56
【问题描述】:

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

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 错误,任何人都可以告诉我是什么问题

【问题讨论】:

    标签: android soap xamarin asmx


    【解决方案1】:

    我刚刚尝试过使用这项服务。

    我为我的项目添加了一个网络引用,然后下面的代码就起作用了

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-17
      • 2013-10-23
      • 1970-01-01
      • 2011-02-23
      • 1970-01-01
      相关资源
      最近更新 更多