开发者

Can I implement callback from WCF based HTTP service to a gSOAP c/Linux client?

开发者 https://www.devze.com 2022-12-21 03:41 出处:网络
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

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 t开发者_运维百科itle.


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


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


I am facing the same issue and the approach I am trying is to have a pair of gsoap servers/clients. Basically each process will listen on a port for soap calls and make its client calls to the other server. This way I avoid the polling or other complex approaches. The code has to be obviously thread safe for whatever business logic is implemented but the client/server combo pair is the simplest solution i have thought of so far.

Obviously one needs to be in control of both sides of the solutions the mentioned server and the mentioned client.

0

精彩评论

暂无评论...
验证码 换一张
取 消