web-servicesaxis2cstaff-wsf

Staff-WSF Axis2C SOAP load service component on startup


*Impl.h file of a service component has these functions:

virtual void OnCreate();
virtual void OnDestroy();

OnCreate is called only when the client makes a call to the service.

I'd like to have it when the server axis2_http_server is launched. (just one instance of my class that receives OnCreate when the whole server is started and OnDestroy when it is stopped)

Staff-WSF service has loadServiceAtStartup by default, but how to make it load my service components too?


Solution

  • To load a service at server startup you must add loadAtStartup metacomment before service class declaration like this:

    // *loadAtStartup: true
    class MyService: public staff::IService
    {
    

    Please see this example for full header code.