wsb.create-server

function

Library: Web Services Broker (OMWSB)
Import : omwsb.xmd

Returns: A wsb.server variable representing the newly created server.


Declaration
export external server function create-server 
  on                        value integer port
  of-type                   value integer type
  default-min-threads       value integer min-threads  optional initial {1}
  default-max-threads       value integer max-threads  optional initial {50}
  max-queue-length          value integer queue-length optional initial {25}
  timeout                   value integer timeout      optional initial {2500}
  using-unique-directories  value switch  unique-dir   optional initial {false}  
  using-working-directory   value string  directory    optional

Argument definitions

port
specifies the port number on which the server will run
type
specifies the type of server to create. Valid values are: soap-service, xmlrpc-service, and other-service
min-threads
defines the minimum number of threads to create for handling each service if not specified in the call to add-service
max-threads
defines the maximum number of threads to create for handling each service if not specified in the call to add-service
queue-length
defines the maximum number of unrecognized requests to queue. If more unrecognized requests are received when the queue is full, these additional requests are dropped.
timeout
defines the time, in milliseconds, that the server should wait for any operation to complete.
unique-dirs
when true, a unique directory will be created for each instance of each service, which it can then retrieve using the read-service-arguments function.
directory
specifies in which directory per-service-instance unique directories wil be created; by default, the system temporary directory will be used.


Purpose

The wsb.create-server function is used to create a WSB server which can then be used to accept requests on the specified port, identify known valid requests and deliver them to the service applications for handling. wsb.create-server is used to set up the parameters necessary to manage the client services effectively.

You can use either the SOAP or XMLRPC protocol, or you can use a protocol of your own design, as long has that protocol uses an HTTP header to specify which action to perform. The type of protocol to be used is specified by the type attribute. The value of the type parameter affects the service-name and type parameters meaning for the wsb.add-service, wsb.remove-service and wsb.service-exists functions as follows:

You can specify a timeout value in milliseconds. The timeout value exists to ensure that an error on a connection does not tie up the server. The default value is 2500 milliseconds. A exception will be thrown if the specified time expires before an operation on the connection (read or write) completes.

If unique-dirs is true, the WSB server will create a unique directory for each service instance prior to the instance starting. Then, when the instance later shuts down, the directory is deleted. This feature is useful for situations where services need a work area on the filesystem where they won't clash with other currently running services.

Setting unique-dirs to true on create-server will affect all services for that server. An alternative is to use the same parameter on add-service or dispatch-request; that way this feature can be enabled only for those services which require it (as there is a small performance penalty during service startup).

By default, unique directories will be created in the system temporary directory (often /tmp/ or C:\temp). However, if directory is specified, then the unique directories will be created in that directory instead.