We are at the beginning of our gsoap experience and evaluation process designed 
to find out a C++ WS framework for linux based embedded devices.

We already had a successful initial experimental phase with gsop and now
we are looking at the embedding covering the different involved process.

One of the problem we are facing now, due to the non-multithreaded
nature of the process framework, is that we can't rely on the blocking
services like xxx.run(port) automatically generated by "soapcpp2 -i"
tool.

All our process have to take care of a lot of events, from different
channel, with a multiplexing strategy based on the select(...) unix
system call; that also means we cant leave full control to the run(...)
service of gsoap server framework.

I'm sure this issue is already managed by gsoap framework without a
multithread approach but its not very clear to us.


A first quick-and-dirty solution is:

1) Inherit a new class, let's say MyService, from soap<XXX>Service generated 
class 

2) Create an instance of such a class setting the accept_timeout to a give 
suitable value.

int main(int argc, char **argv)
{
        //GetFaxStsIBndService faxStsS;
        struct soap soapCfg;
        soapCfg.accept_timeout=1;
        
        MyService faxStsS(soapCfg);
...
...

3) Redefine the run(...) service like below

int MyService::run(int port)    {

        if (soap_valid_socket(bind(NULL, port, 100)))
        {       for (;;)
                {       if (!soap_valid_socket(accept()))
                                if(this->error == 28)   {
                                        printf("Nothing to do... look at some 
other things \n");
                                        continue;
                                }
                                else
                                        return this->error;
                        (void)serve();
                        soap_destroy(this);
                        soap_end(this);
                }
        }
        else
                return this->error;
        return SOAP_OK;

}


this seems to work since the bloking service is the accept (i.e. 
soap_accept,...)

Does anybody knows some other, may be more elegant, solutions since we are very 
new to the gsoap framework

Thank you in advance,
Marco

Reply via email to