Reputation: 147
I'm trying to enable multiple simultaneous client access to a webservice, enabeling a client to make a request and block until data is available (I am doing it this way since gsoap does not support notifications)
My webservice class is compiled with WITH_PURE_VIRTAL, meaning that I can't create instances of it, as it is an abstract class. Thus, I use one class built by me, which inherits from the webservice class, and is responsible for managing the webservice and webclient requests.
However, when my class is busy handling an existent client, I can't seem to receive any other requests.
I read (here) that you should launch a thread with something similar to this:
soap_serve((struct soap*)soap);
soap_destroy((struct soap*)soap); // dealloc C++ data
soap_end((struct soap*)soap); // dealloc data and clean up
soap_done((struct soap*)soap); // detach soap struct
free(soap);
However, when I modify the that code to call my webservice class instead, the serve call doesn't do anything.
I also tried launching a new thread inside my webservice call methods, but as soon as the thread launches, the webclient receives an empty response.
Does anyone have any suggestions?
Upvotes: 0
Views: 1592
Reputation: 5657
If you look at my answer to this question you can see a very basic C++ threaded gSoap server. What I think you may be missing is the need to copy the service class, in my code the line tc = c.copy() ; // make a safe copy
this copies the gSoap service instance including the gSoap context; it's this copy that's passed into the new thread so that the new thread can respond to the request while the main thread waits for another request to be made.
Upvotes: 1