Here's my situation:
wsdl
, "translated" to a header file like this: wsdl2h -o file.h file.wsdl
soapcpp2 -Icorrect_path -j file.h
soapXXXService.[h|cpp]
soap_init2
(with SOAP_IO_KEEPALIVE
), I have soap_bind
, soap_accept
, soap_copy
, etc. and it seems to work perfectly fine (see below)proxy
object (again using SOAP_IO_KEEPALIVE
), construct the message and send it to the serverXML
)ACK
and everything is perfectly fine.So, what I want to do now is make the "server" return the "real" response to the "client" and the "client" has to return back an ACK
to the "server".
How is this possible? (it should be)
"What have you tried?"
Two things come to my mind.
The first is to somehow reuse the socket's file descriptor, returned from soap_accept
, to send the "real response" back to the server. But Is this even possible?
Unix sockets are full duplex, so this is technically possible, but does gSoap
restricts this? Because I didn't see anything about this in the documentation.
The second option, that comes to my mind is to create the same "service" in the "client", to make it possible to receive messages (the "real response") and to return ACK
the same way it's done in the "server". But this would mean, that the "server" must also has an instance of proxy
object to be able to send this so called "real response".
And this sounds really ugly and horrible to me. Not that I'll be surprised if this is the only option, but..
Edit: for the second option - this would mean, that the client should have a listener port, should handle incoming connections, etc. Does not sound like a client to me..
I understand, that I may be missing some fundamental part(s) of how gSoap
works, but I read the whole user documentation and the "getting started" guide and I didn't find anything about this.
Please, let me know if something is not clear
EDIT: Here's the scenario, I want to achieve:
And this scenario could be in the opposite direction, too: server could also send request to the client. That would mean - the same scenario as above, but replacing "client" <-> "server".
NOTE: both request/response
and ACK
ARE SOAP messages.
I implemented it using option 2
in my question. That is: implement service (a listener) and use the proxy (for sending requests) in both - the client and the server. This way, I have the following:
xxx
is the URI, which will be used to connect the server to the client's listener)3.
This says - "OK, I'm ready to communicate with you"
And this way, both - the client and the server know each other's location, both have a listener (implementation of the service), both maintain proxy objects.
Seems like this will work for me. I'd be happy if somebody give me another option or say something about option 1
in my question.
EDIT: After deep research for several days and after deep analysis of the protocol, I intent to implement, it appeared, that that's the only way to do this:
Implementations MUST be able to function as both a SOAP client and a SOAP server
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With