c#-使用Xamarin.droid使用soap web服务

c#-使用Xamarin.droid使用soap web服务,xamarin,xamarin.android,Xamarin,Xamarin.android,我正在使用xamarin studio构建我的第一个android应用程序,以使用web服务,但在文档中找不到任何帮助: 单击 我试着看了一些视频,发现的都是关于xamarin.forms的如果您的服务不是WCF服务,则必须将web引用作为.NET 2.0 web服务导入: 呼叫服务: Button button = FindViewById<Button> (Resource.Id.myButton); button.Click += dele

我正在使用xamarin studio构建我的第一个android应用程序,以使用web服务,但在文档中找不到任何帮助: 单击


我试着看了一些视频,发现的都是关于xamarin.forms的

如果您的服务不是WCF服务,则必须将web引用作为.NET 2.0 web服务导入:

呼叫服务:

        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;
        };
Button-Button=findviewbyd(Resource.Id.myButton);
按钮。单击+=委派{
SoapApp.www.webservicex.net.GlobalWeather soapservice=new SoapApp.www.webservicex.net.GlobalWeather();
var cities=soapservice.GetCitiesByCountry(“秘鲁”);
文本=城市;
};
结果是:

如果它不起作用,请尝试在一个新项目中在VisualStudio中构建代理,然后他们将该类复制到Xamarin Studio项目中,我知道这不是最好的方法,但这是一种变通方法

不要忘记添加
System.Web.Services
System.ServiceModel
引用

为Xamarin Studio的西班牙版本感到抱歉,希望它能帮助您