0

I think I've found a bug in Xamarin regarding WCF Client. It seems like Xamarin doesn't like FaultException's which include a FaultActor element. My SLSVCUTIL generated client resides in a PCL (Profile 78). Referencing this PCL is IOS project. My vendor's exposed web service's wsdl exposes a custom Fault. When a fault is thrown by the webservice, no faultexception is raised but interestingly a "Notimplemented" exception is raised.

A couple more notes:

  1. When referencing the PCL in a regular console app, I am able to catch the FaultException and read the deatils.

  2. When creating my own WCF and raise an identical fault my self, the IOS app can catch it! The only difference i see in the Fault response is the missing in the WCF implementation of the service.

    Below are the 2 responses.

WCF Exposed Web Service --> This works in both the console and Xamarin IOS App

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <s:Fault>
         <faultcode>s:Client</faultcode>
         <faultstring xml:lang="en-US">The creator of this fault did not specify a Reason.</faultstring>
         <detail>
            <ECFPFault xmlns="http://RamiCorpSolutions/BusinessObjects" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
               <ErrorCode>PASSWORDEXPIRED</ErrorCode>
               <ErrorMsg>Unknown LoginName</ErrorMsg>
            </ECFPFault>
         </detail>
      </s:Fault>
   </s:Body>
</s:Envelope>

Vendor Exposed Web Service Response --> This works in a Console App. Does not work in Xamarin IOS.

  <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode>SOAP-ENV:Server</faultcode>
         <faultstring>This is an operation implementation generated fault</faultstring>
         <faultactor/>
         <detail>
            <ns:ECFPFault xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns="http://RamiCorpSolutions/BusinessObjects">
               <ns:ErrorCode>PASSWORDEXPIRED</ns:ErrorCode>
               <ns:ErrorMsg>Unknown LoginName</ns:ErrorMsg>
            </ns:ECFPFault>
         </detail>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Some Stack Trace Information: StackTrace " at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_delegate_end_invoke (object,intptr)\n at (wrapper delegate-end-invoke) :end_invoke_object__this___object[]&_IAsyncResult (object[]&,System.IAsyncResult)\n at System.ServiceModel.MonoInternal.ClientRuntimeChannel.EndProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters, IAsyncResult result) [0x00025] in /Users/builder/data/lanes/3412/3cf8aaed/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:460 \n at System.ServiceModel.ClientBase1+ChannelBase1[TChannel,T].EndInvoke (System.String methodName, System.Object[] args, IAsyncResult result) [0x0003c] in /Users/builder/data/lanes/3412/3cf8aaed/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs:404 \n at ECFPLib.ECFPService.ECFPServiceClient+ECFPServiceClientChannel.EndLogin (IAsyncResult result) [0x00010] in /Users/ramiayyad/Documents/RDC Connections/Bonobo.Git.Server/ECFP.git/ECFPLib/Service References/ECFPService/Reference.cs:2778 \n at ECFPLib.ECFPService.ECFPServiceClient.ECFPLib.ECFPService.IECFPService.EndLogin (IAsyncResult result) [0x00008] in /Users/ramiayyad/Documents/RDC Connections/Bonobo.Git.Server/ECFP.git/ECFPLib/Service References/ECFPService/Reference.cs:1939 \n at ECFPLib.ECFPService.ECFPServiceClient.OnEndLogin (IAsyncResult result) [0x00003] in /Users/ramiayyad/Documents/RDC Connections/Bonobo.Git.Server/ECFP.git/ECFPLib/Service References/ECFPService/Reference.cs:1949 \n at System.ServiceModel.ClientBase`1+c__AnonStorey0[TChannel].<>m__0 (IAsyncResult ar) [0x00006] in /Users/builder/data/lanes/3412/3cf8aaed/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientBase.cs:242 " string

***UPDATE**** A bug has been raised: https://bugzilla.xamarin.com/show_bug.cgi?id=42226

The bug report includes a sample project which definitively shows that the addition of a simple element causes the issue. The method is part of the SOAP standard.

Cyberpass
  • 1,145
  • 1
  • 7
  • 13

0 Answers0