I would like to consume a public web service using Xamarin and WCF. For this demo, I'll be using Xamarin.iOS .
This is the (public) webservice I'm trying to consume:
http://www.webservicex.net/globalweather.asmx?WSDL
Inside Xamarin Studio, I add a Web Reference with the URL from the webservice. The selected Framework is set to Windows Communication Foundation (WCF).
Now, I'm using the following code to connect with the service:
var _client = new GlobalWeatherSoapClient();
_client.BeginGetWeather ("Berlin", "Germany", (ar) => {
var result = _client.EndGetWeather(ar);
}, null);
When executing this code, I'm getting a System.NullReferenceException
. This is the problem, why isn't it working correct?
The strangest part: When I'm not using WCF, but select .NET 2.0 Web Services as Framework, everything seems to be working fine.
I can't see what's wrong with my WCF code - according to the docs, everything should work ok.
I hope somebody can help me out! Thanks in advance!