tags:

views:

89

answers:

1

Hi all,

I am working on an application.

The application goes like this. I am a recent grad and still learning the power of WCF.

client1 should not directly interact with client2.

The problem I have right now is I have a webservice. Client1 can interact with the webservice and insert some commands to DB. Client2 reads the command execute the command and put the results back in db. The client1 should know that the command is executed and it should read the results from db.

As soon as a Command is inserted by client1, the webservice has to intimate a client2 that a command is ready in the db, and client2 can go ahead and execute the command.

I have no idea how the webservice can intimate client2 that a command is ready for execution in db and then intimate client1 when the results are ready.

Any help is appreciated.

Thanks,

A: 

WCF supports duplex contracts. That is, you can have a service contract which has a corresponding callback contract. This can be used by the service to call the client back.

See "Duplex Services" in the MSDN Library.

John Saunders
The problem is client1 and the webservice will be running in one process and the client2 and webservice will be running in some other process. How can one process tell other process that some task is finished?Please let me know.
Sandeep
@Sandeep: did you read the linked article on Duplex Services?
John Saunders
Yes and I have tried it. It really looks great. The issue is client1 and webservice will be communicating through a channel lets say it is channel1. Client1 inserts a command. There is a one more channel between client2 and webservice. I am not sure if the server can intimate client1 when some task is finished by client2.
Sandeep
@Sandeep: Yes, it can. That's a primary use case for duplex contracts.
John Saunders
I Could solve the problem..Thanks for your reply..sorry for the late reply....
Sandeep