|
WSServer
Web Service Server Side -- Creating a Tcl Web Service
IntroductionThe Web Services package, WS::Server, is not a standalone application, but rather is designed be a "module" of TclHttpd. The following command is normally placed in httpdthread.tcl: Loading the Web Services Server PackageTo load the web services server package, do: package require WS::Server 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. Defining a ServiceThe code that defines a service is normally placed in one or more files in the custom directory. Procedure Name: ::WS::Server::Service Description: Declare a Web Service, the following URLs will exist
Displays an HTML page describing the service Returns a WSDL describing the service Invoke an operation Arguments: this procedure uses position independed arguments, they are:
The host name for this serice. Defaults to "localhost" The HTML description for this service Extra XML namespaces used by the service The service name (this will also be used for the Tcl namespace of the procedures that implement the operations). This is a command prefix to be called before an operation is called. The following arguments are added to the command prefix:PRE serviceName operationName operArgList This is a command prefix to be called after an operation is called. The following arguments are added to the command prefix:POST serviceName operationName OK|ERROR results List of input header types. List of output header types. Command prefix to check headers. If the call is not to be allowed, this command should raise an error. The signature of the command must be:
Returns: Nothing Side-Effects: None Exception Conditions:
Missing required arguments Pre-requisite Conditions: None Defining an Operation (aka a Service Procedure)Procedure Name: ::WS::Server::ServiceProc Description: Register an operation for a service and declare the procedure to handle the operations. Arguments:
Name of the service this operation is for List of three elements: List of argument definitions, each list element must be of the form: {type typeName comment commentString} where typeName can be any simple or defined type and commentString is a quoted string describing the field
HTML describing what this operation does The tcl code to be called when the operation is invoked. This code should return a dictionary with OperationName_Result as a key and the operation's result as the value. Returns: Nothing Side-Effects:
Exception Conditions: None Pre-requisite Conditions: ::WS::Server::Server must have been called for the ServiceName Declaring Complex TypesSee: Creating a Web Service Type from Tcl |
Sign in to add a comment
Is the flag "-decription" or "-description"?