Xamarin IOS Not Implemented Exception instead of WCF FaultException

rayyadrayyad CAMember ✭✭
edited June 2016 in Xamarin.iOS

Hey Guys,

What's going on over here? It seems like the following Fault Response doesn't work in Xamarin IOS. Throwing a Not Implemented Exception.

First my details:
I have WCF client(assuming it was generated using SLSvcUtil.exe) residing in a PCL (Profile 78). The Xamarin IOS app references this PCL. The Vendor's Web service(which i have some control over) generates a custom fault. The following fault response is returned and for some reason, instead of the WCF client catching the FaultException a Not Implemented Exception is raised.

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode>s:Client</faultcode>
         <faultstring>The creator of this fault did not specify a Reason.</faultstring>
         **<faultactor>Random</faultactor>**
         <detail>
            <ns:ECFPFault xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns="http://RamiCorpSolutions/BusinessObjects" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/">
               <ns:ErrorCode>UNKNOWN</ns:ErrorCode>
               <ns:ErrorMsg>Unknown LoginName</ns:ErrorMsg>
            </ns:ECFPFault>
         </detail>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Now, interestingly, the following Fault Response works just fine:

<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>UNKNOWN</ErrorCode>
               <ErrorMsg>Unknown LoginName</ErrorMsg>
            </ECFPFault>
         </detail>
      </s:Fault>
   </s:Body>
</s:Envelope>

I have highlighted the only discernible differences. Is the inclusion of "FaultActor" really causing the Mono to hiccup?! Unfortunately, I cannot remove the faultactor tag. This element is also part of the SOAP 1.1 standard so i would assume, Mono should be able to support it.

Finally, I created a Console App and referenced this PCL. Low and Behold, the first response is successfully parsed and I'm able to cast into a FaultException!! This leads me to believe its an issue with Xamarin's implementation.

Here is the stack trace of the error:
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

Answers

  • SebastianSeidel.9226SebastianSeidel.9226 DEInsider, University ✭✭✭✭

    Last time I used WCF in combination with Xamarin, there was the limitation that WCF is not fully implemented. Only the parts that works within Silverlight where available. So it might be that you run into such a limitation.

  • rayyadrayyad CAMember ✭✭
    edited July 2016

    Ok. So Narrowed it down to the "FaultActor" element of a Soap Fault being present. The is part of the SOAP standard. This a clearly a defect.

    A bug with the sample solution presenting the issue can be found at https://bugzilla.xamarin.com/show_bug.cgi?id=42226

    Good Luck All!

  • rayyadrayyad CAMember ✭✭
    edited July 2016

    .

  • MelbourneDeveloperMelbourneDeveloper AUMember ✭✭✭

    We are having a very similar problem with Android. Is there a sample app somewhere that has a WCF service, and an XF client so we can point this Xamarin Bug out for the Android platform?

Sign In or Register to comment.