Non - blocking RPC invocation, using gSoap
Asked Answered
M

4

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

Montemayor answered 10/5, 2013 at 12:27 Comment(10)
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).Chalutz
@Chalutz - true, but this is not what I'm asking. Please review my edit.Montemayor
Have a look at: twistedmatrix.com/documents/current/historic/ipc10paper.html and #5375468 I think this is what you are after.Bauble
@Bauble - the first one is python while I need C++, and the second one seems a bit irrelevant to me. Can you clarify?Montemayor
Well I was just pointing out the basic idea of using Event Based programming for your issue. I might have misunderstood your question.Bauble
@Bauble - that's what I'm trying to do, but using gSoap :)Montemayor
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 ;)Bauble
@Bauble - 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.Montemayor
C or C++? They're not the same language.Condition
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.Caw
D
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.

Donn answered 7/9, 2013 at 21:14 Comment(0)
K
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.

Kloof answered 18/6, 2013 at 6:33 Comment(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..Montemayor
C
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.

Cocotte answered 19/7, 2013 at 13:3 Comment(1)
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)Montemayor
B
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

Brownout answered 25/7, 2013 at 14:9 Comment(1)
I'm familiar with this solution, I was looking for another option to achieve this.Montemayor

© 2022 - 2024 — McMap. All rights reserved.