15

Is this even possible?

I know, I can make a one-way asynchronous communication, but I want it to be two-way.

In other words, I'm asking about the request/response pattern, but non-blocking, like described here (the 3rd option)

Related to Asynchronous, acknowledged, point-to-point connection using gSoap - I'd like to make the (n)acks async, too

Community
  • 1
  • 1
Kiril Kirov
  • 37,467
  • 22
  • 115
  • 187
  • The WSClient always have the initiative of talking with the WSServer, when your WCLient do a SOAPRequest can receive a SOAPResponce (two-way) or not (one-way). But this behavior is defined on service description (WSDL). – nms May 10 '13 at 15:36
  • @nms - true, but this is not what I'm asking. Please review my edit. – Kiril Kirov May 11 '13 at 16:16
  • Have a look at: http://twistedmatrix.com/documents/current/historic/ipc10paper.html and http://stackoverflow.com/questions/5374968/is-network-event-based-programming-really-better I think this is what you are after. – Stolas May 17 '13 at 12:17
  • @Stolas - the first one is `python` while I need `C++`, and the second one seems a bit irrelevant to me. Can you clarify? – Kiril Kirov May 20 '13 at 07:18
  • Well I was just pointing out the basic idea of using Event Based programming for your issue. I might have misunderstood your question. – Stolas May 21 '13 at 06:44
  • @Stolas - that's what I'm trying to do, but using `gSoap` :) – Kiril Kirov May 21 '13 at 06:46
  • Yea, well I'd give the Python Twisted libraries a look. I don't mean how to use 'em but reading the source itself. And re-implement that in gtk-style c. I am not interested in the bounty btw. But I'll give tonight a look maybe I can help you out ;) – Stolas May 21 '13 at 07:04
  • @Stolas - the bounty expired already, but that's not important. Thanks for the hint, but I believe this is `gSoap` specific thing. I mean I know how to implement this using event-based async (non-blocking) plain tcp socket connection (I even did and it's working). I just want to make it using `gSoap`. – Kiril Kirov May 21 '13 at 15:02
  • C or C++? They're not the same language. – MD XF Dec 05 '16 at 18:30
  • Your link to the wsd-guide sort of indicates how this would be done. You make a subsequent gSoap request asking if the async request has a response yet. The initial async gSoap request returns a future (e.g., a cookie). The subsequent request asking for a completed response offers the cookie in exchange for the complete response. Either the "in progress" response comes back with a future again, or the complete response comes back. – jxh Jul 29 '19 at 19:16

4 Answers4

1

You need a way to associate requests with replies. In normal RPC, they are associated by a timeline: the reply follows the response before another response can occur.

A common solution is to send a key along with the request. The reply references the same key. If you do this, two-way non-blocking RPC becomes a special case of two one-way non-blocking RPC connections. The key is commonly called something like request-id or noince.

Cort Ammon
  • 10,221
  • 31
  • 45
0

I think that is not possible by basic usage, The only way to make it two way is via response 'results of the call'

But you might want to use little trick 1] Create another server2 at client end and call that server2 from server Or if thats not you can do over internet because of NAT / firewall etc
2] re architect your api so that client calls server again based on servers responce first time.

Anand Rathi
  • 790
  • 4
  • 11
  • 1
    Yeah, that's the only solution, I can think of. This will work, but it will still be blocking. So, to avoid this, a new thread must be started. And that's what I'm trying to avoid.. – Kiril Kirov Jul 25 '13 at 14:26
0

You can have client - server on both end. For example you can have client server on system 1 and system 2. (I specify sender as cient and receiver as server). You send async message from sys1 client to sys 2 server. On recieving message from sys1 you can send async response from sys 2 client to sys1 server back. This is how you can make async two way communication.

Rocker
  • 25
  • 5
  • Yes and no. Yes - seems like I can do this, I thought about this. And "no" - I want the response to be **over the same TCP** (or whatever the transport is) connection (what you suggest will create 2 connections for both directions) – Kiril Kirov Jul 25 '13 at 14:30
0

I guess you would need to run the blocking invocation in a separate thread, as described here: https://developer.nokia.com/Community/Wiki/Using_gsoap_for_web_services#Multithreading_for_non-blocking_calls

vanto
  • 3,134
  • 18
  • 28