簡體   English   中英

如何在Android Xamarin項目中使用.net Web服務(.asmx)?

[英]How to consume .net web service(.asmx) in android xamarin project?

我想使用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");

我正在嘗試使用示例Web服務 ,但是每當我收到403禁止/ 404未找到錯誤時,任何人都可以讓我知道是什么問題

我剛剛嘗試使用此服務。

我將Web參考添加到我的項目,然后以下代碼工作了

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

這里有一個很好的介紹: http : //developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM