我在 Windows 上使用 Xamarin Studio 制作一个 Android 应用程序(可移植 Xamarin.Forms 项目)。我正在尝试使用此页面上的指南使用 Web 服务:http://developer.xamarin.com/guides/cross-platform/application_fundamentals/web_services/在“使用 SOAP 服务”部分。
但是,我似乎根本无法让它工作。我可以成功生成代理(使用此公共(public)网址:http://wsf.cdyne.com/WeatherWS/Weather.asmx 用于测试目的)。生成一个名为“Reference.cs”的新文件。
但是文件 Reference.cs 产生了几个编译错误:
错误 CS0234:命名空间“System.Runtime.Serialization”中不存在类型或命名空间名称“IExtensibleDataObject”(是否缺少程序集引用?)(CS0234) (XamarinFormsTutorial)
..和其他 41 人(均为 CS0234)
有人知道发生了什么事吗?
最佳答案
我最近不得不实现一个使用 webservice asmx 的跨平台应用程序。
我的解决方案是在两个项目(Android 和 IOS)中使用 Web 服务。 在我使用的共享项目中:
#if __ANDROID__
using "namespace droid webservice";
#endif
#if __IOS__
using "namespace ios webservice";
#endif
在代码中创建一个新的网络服务实例就足够了。
关于c# - 使用 Xamarin.Forms 使用 soap web 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28353948/