Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Consume soap web service with Xamarin.Forms

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".

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.

But the file Reference.cs generates several compile errors:

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)

.. and 41 others(all CS0234)

Anybody got an idea what is going on?

like image 994
Michael Avatar asked Nov 10 '22 19:11

Michael


1 Answers

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

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

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

like image 139
erivandons Avatar answered Nov 15 '22 05:11

erivandons