使用Xamarin.Forms消费soap Web服务 [英] Consume soap web service with Xamarin.Forms

查看:127
本文介绍了使用Xamarin.Forms消费soap Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows上使用Xamarin Studio制作一个Android应用(便携式Xamarin.Forms项目).我正在尝试使用此页面上的指南使用Web服务: http://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/在使用SOAP服务"部分中.

I'm using Xamarin Studio on Windows to make an Android app(Portable Xamarin.Forms project). I'm trying to consume a web service using the guide on this page: http://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/ in section "Consuming SOAP Services".

但是,我似乎根本无法使它工作.我可以成功生成代理(使用此公共URL: http://wsf.cdyne.com/WeatherWS/Weather.asmx 进行测试).生成一个名为"Reference.cs"的新文件.

However, I can't seem to make it work at all. I can generate the proxy successfully(using this public url: http://wsf.cdyne.com/WeatherWS/Weather.asmx for testing purposes). A new file called "Reference.cs" is generated.

但是文件Reference.cs会生成一些编译错误:

But the file Reference.cs generates several compile errors:

错误CS0234:类型或名称空间名称'IExtensibleDataObject'在名称空间'System.Runtime.Serialization'中不存在(您是否缺少程序集引用?)(CS0234)(XamarinFormsTutorial)

Error CS0234: The type or namespace name 'IExtensibleDataObject' does not exist in the namespace 'System.Runtime.Serialization' (are you missing an assembly reference?) (CS0234) (XamarinFormsTutorial)

..和另外41个(均为CS0234)

.. and 41 others(all CS0234)

有人知道发生了什么事吗?

Anybody got an idea what is going on?

推荐答案

我最近不得不实现一个使用Web服务asmx的跨平台应用程序.

I recently had to implement a cross-platform application consuming webservice asmx.

我的解决方案是在两个项目(Android和IOS)中使用Web服务. 在共享项目中,我使用了:

My solution was to consume the web service in both projects (Android and IOS). In the shared project I used:

#if __ANDROID__
using "namespace droid webservice";
#endif

#if __IOS__
using "namespace ios webservice";
#endif

在代码中创建一个新的Web服务实例就足够了.

In the code it was enough to create a new instance of the webservice.

这篇关于使用Xamarin.Forms消费soap Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆