views:

396

answers:

2

I have a Linux/c client app that connects to a WCF web service over HTTP/SOAP (BasicHTTPBinding). I am using gSOAP. Can I implement the calls to the web-service using callback? I want to get the data asynchronously as call back.

Update: I have updated the question title.

A: 

The basicHttpBinding does not support callbacks. Another approach might be to have another method that the client can poll on for the response.

tgeros
Thanks. In such a case, I shall like to go for sync calls.
Kangkan
+1  A: 

WCF does support Duplex services, or those that have the ability to call back to the requesting client. Duplex services can be very complicated, as they are not only stateful, but they impose an contract implementation requirement on their clients.

Duplex services require the use of the WSDuplexHttpBinding. You will need to make use of the OperationContext to get a reference to the callback channel. Your clients MUST implement the callback contract in some class, and provide an InstanceContext that contains an instance of the callback class to the client proxy. Communications in both directions must be supported, and if the client is behind its own firewall or across the internet, this can be a complicated matter to resolve. Take care when writing duplex services...they are often more trouble than they are worth...so make sure you really need it. ;-)

The following page might be helpful:

http://msdn.microsoft.com/en-us/library/ms731064.aspx

jrista
Thanks for your nice feedback. Can you also make me aware, if such callback implementation can be possible on c/Linux hand held machine with gSOAP.
Kangkan
I am not really sure. I have heard of gSOAP, but I don't know much about it. WCF is more than just a SOAP/WSDL web services platform. It supports multiple protocols and binding types that are not commonly supported by other platforms. When it comes to duplex web services, I do not believe there is any standard for cross-platform support, so gSOAP would have to support WCF's duplex implementation to be compatible.
jrista