How to implement fault contracts in call back functions

J.D. Meier, Jason Taylor, Prashant Bansode, Carlos Farre, Madhu Sundararajan, Steve Gregersen.

In duplex bindings you need to implement the service with a callback contract specifying the interface so the client can implement it. Use the CallbackContract attribute in the service contract to specify the type of callback contract which has the callback function.

The following code example shows a service that specifies a callback contract:
[ServiceContract(CallbackContract = typeof(IMyContractCallback))]
interface IMyContract
{
   [OperationContract]
   void DoSomething( );
}
interface IMyContractCallback
{
   [OperationContract]
   [FaultContract(typeof(InvalidOperationException))]
   void OnCallBack( );
}

Last edited May 8, 2008 at 4:46 AM by prashantbansode, version 1

Comments

No comments yet.