Embeding a Web Service

Contents

Loading the Webservices Server Package

To load the webservices server package, do:

 package require WS::Embedded

This command will only load the server the first time it is used, so it causes no ill effects to put this in each file declaring a service or service procedure.


Specify a Port to Receive Request on

Procedure Name : ::WS::Embeded::Listen

Description : Instruct the module to listen on a Port, security information.

Arguments : this procedure uses position dependent arguments, they are:

     port     -- Port number to listen on.
     certfile -- Name of the certificate file. Defaults to {}.
     keyfile  -- Name of the key file. Defaults to {}.
     userpwds -- A list of username:password. Defaults to {}.
     realm    -- The seucrity realm. Defaults to {}.

Returns : Handle of socket

Side-Effects : None

Exception Conditions :  : None

Pre-requisite Conditions : None


Enter the event queue

To serve any requests, the interpreter must enter the event queue using, for example:

     vwait waitVariable

Stop the server

To stop serving requests, the server socket may be closed. The socket handle was returned by ::WS::Embeded::Listen. Optionally, the event queue may be stopped as follows:

     close $handle
     set waitVariable 1