Hello, I need to call a WCF service. I generated a WCF proxy (using slsvcutil) according to tutorial http://wiki.ios.xamarin.com/HowTo/WebServices/Using_WCF and used it in the Mono for Android project. I made WCF proxy to the same service as tutorial http://docs.xamarin.com/android/tutorials/consuming_web_services uses (calculator service). My code for calling calculator WCF service looks like this:
var ws = new CalculatorClient(new BasicHttpBinding(), new EndpointAddress("http://ws1.parasoft.com/glue/calculator")); ws.addCompleted += delegate(object s, addCompletedEventArgs ev) { Log.Info("Test", "Add result: {0}", ev.Result.ToString()); }; ws.addAsync(10, 20); But after calling addAsync method is thrown exception: 10-14 07:38:41.826 E/mono ( 292): Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object 10-14 07:38:41.826 E/mono ( 292): at CalculatorClient+CalculatorClientChannel.Endadd (IAsyncResult result) [0x00000] in <filename unknown>:0 10-14 07:38:41.826 E/mono ( 292): at CalculatorClient.ICalculator.Endadd (IAsyncResult result) [0x00000] in <filename unknown>:0 10-14 07:38:41.826 E/mono ( 292): at CalculatorClient.OnEndadd (IAsyncResult result) [0x00000] in <filename unknown>:0 10-14 07:38:41.826 E/mono ( 292): at System.ServiceModel.ClientBase`1+<InvokeAsync>c__AnonStoreyD[ICalculator].<>m__A (IAsyncResult ar) [0x00000] in <filename unknown>:0 10-14 07:38:41.826 E/mono ( 292): --- End of inner exception stack trace --- 10-14 07:38:41.826 E/mono ( 292): at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary () [0x00000] in <filename unknown>:0 10-14 07:38:41.826 E/mono ( 292): at addCompletedEventArgs.get_Result () [0x00000] in <filename unknown>:0 10-14 07:38:41.826 E/mono ( 292): at TestWebServicesAndroid2.Activity1.<OnCreate>b__0 (System.Object s, .addCompletedEventArgs ev) [0x00000] in <filename unknown>:0 What is wrong with that? What I made wrong? Best Regards, Peter -- View this message in context: http://mono-for-android.1047100.n5.nabble.com/Problem-with-calling-WCF-service-tp4901829p4901829.html Sent from the Mono for Android mailing list archive at Nabble.com. _______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid