Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Can't call WCF methods in Xamarin.Forms (Cross-Platform)

$
0
0

Hi,
I just create a simple WCF project with default values (without change even a single line of code), i publish it in web, Consume it in EXE application and it work fine, Cosume it in asp.net webform and it work fine.

Now i create another simple Xamarin Cross-Platform with .Net Standard 2 (UWP, iOS, Android), Used "Microsoft WCF Web Service Reference Provider" and i checked all 3 project in UWP work fine but in android and iOS project load and after click the button can't call GetDataAsync().

Xamarin button clicked code :

Service1Client client = new Service1Client(Service1Client.EndpointConfiguration.BasicHttpsBinding_IService1);
string returnString;
returnString = await client.GetDataAsync(Convert.ToInt32(entNumber.Text));
lblResult.Text = returnString;
await client.CloseAsync();

Android runtime error after clicked button :

Unhandled Exception:
System.ServiceModel.FaultException`1[[System.ServiceModel.ExceptionDetail, System.ServiceModel, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Error in deserializing body of request message for operation 'GetData'. OperationFormatter encountered an invalid Message body. Expected to find node type 'Element' with name 'GetData' and namespace 'http://tempuri.org/'. Found node type 'Element' with name 'GetDataAsync' and namespace 'http://tempuri.org/'

iOS runtime error after clicked button :

Unhandled Exception:
System.InvalidOperationException: MonoTouch does not support dynamic proxy code generation. Override this method or its caller to return specific client proxy instance

Funny thing is UWP work fine and return method string just fine.
This is my first experience to consume WCF in xamarin.forms and i feel maybe i do something wrong.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>