Forums - C# Corner

Forum guidelines
Mushtaq M A

Mushtaq M A

  • 256
  • 7.1k
  • 582.8k

WCF service methods not connected with Xamarin.Forms app

May 18 2019 10:21 AM
I have created a WCF service and called the same from Xamarin Cross-Platform with Dot Net Standard 2 (UWP, iOS, Android), an app using Connected Service approach.
I checked this service approach in UWP and it works fine. But in Android and iOS project, the service is not connected.
Connected service call
  1. IMobileservice mobileservice = new MobileserviceClient();  
  2. try  
  3. {  
  4. ValidateCredentials validateCredentials = await mobileservice.ValidateLoginCredentialsAsync(_param);  
  5. label.Text = validateCredentials.p_UserGroupCodeDesc;  
  6. }  
  7. catch (Exception ex)  
  8. {  
  10. }  
Android runtime error after clicked button :
Unhandled Exception:
System.ServiceModel.FaultException`1[[System.ServiceModel.ExceptionDetail, System.ServiceModel, Version=, 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 ''. Found node type 'Element' with name 'GetDataAsync' and namespace ''
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.
 I have posted this to Github and no solution. Kindly help me to resolve the issue.

Answers (1)