How to assign namespace and action to FaultContract in ServiceContract Interface (Web Service Software Factory)?
April 2, 2010
I am using the latest edition of Service Factory - Modeling Edition (VS2008). I've created a number of FaultContracts in my DataContract model, and utilized them in my ServiceContract model. The generated code for the ServiceContract does not include the namespace or action for the FaultContract, e.g.
[WCF::ServiceContract(Namespace = "http://mynamespace", Name = "MyServiceContract", SessionMode = WCF::SessionMode.Allowed, ProtectionLevel = ProtectionLevel.None )] public partial interface IMyServiceContract { [WCF::FaultContract(typeof(MyFaultContract))] [WCF::OperationContract(IsTerminating = false, IsInitiating = true, IsOneWay = false, AsyncPattern = false, Action = "http://mynamespace/Contract/GetSomething", ProtectionLevel = ProtectionLevel.None)] PcaFocus.MessageContracts.GetSomethingResponse GetSomething(GetSomethingRequest request);
Whereas I expected the FaultContract attribute to be something like:
[FaultContract(typeof(MyFaultContract), Namespace = "http://mynamespace", Action = "http://mynamespace/MyFaultContract", Name = "MyFaultContract")]
The effect is that the different Fault types are not recognized because of a de-serialization problem. That has the effect that I cannot catch specific faults with
catch (System.ServiceModel.FaultException<MyFaultContract> fault)
Does anyone know of a work-around for this?