tags:

views:

91

answers:

1

A client and a server communicate in duplex mode. The client has a universal service (Action="*") as contract callback.

I'd like the server to be able to send fault to my client.

How can I do ?

A: 

What about setting your Action to something like

Action = NotificationData.NotificationAction

NotificationData is a MessageContract class that has a property MessageId

[MessageContract]
public class NotificationData
{
    public const string NotificationAction = "http://gfader.com/copied-from/tomasz.janczuk.org";

    [MessageBodyMember]
    public string Message { get; set; }

    [MessageBodyMember]
    public DateTime SendTime { get; set; }

    [MessageBodyMember]
    public MessageIds MessageId { get; set; }
}

Code on client:
if MessageId == 500 --> error from server

Peter Gfader
in fact, my design is a little special. Services are duplex, but clients are Request/Reply and there is a router which translate Request/Reply call in duplex call and vice versa.So my client must be able to use try{}catch(FaultException<MyFault>){}
Nicolas Dorier
huh... sounds interesting... let us know when you came up with a solution on this!
Peter Gfader