Back to Contents


The Web Service Engine class

Summary:

See also: The Genero Web Services COM  Extension Library


Syntax

The Web Service Engine class provides an interface to manage the Web Services Engine. This class does not have to be instantiated.

Note that status is set to zero after a successful method call.

Syntax:

com.WebServiceEngine

Methods:

Class Methods
Name Description
com.WebServiceEngine.RegisterService(
  ws com.WebService )
Registers a WebService to the DVM, where ws is the WebService to be registered.
Throws an exception in case of errors, and updates status with an error code.
com.WebServiceEngine.Start() Starts all registered Web Services; throws an exception if the services cannot be started.
com.WebServiceEngine.ProcessServices(
  timeout
INTEGER )
  
RETURNING status
Specifies the wait period for an HTTP input request, to process an operation of one of the registered Web Services. timeout is the time in seconds to wait for an incoming request before returning; the value -1 specifies an infinite waiting time. Returns a value indicating the status.
com.WebServiceEngine.getHTTPServiceRequest(
  timeout
INTEGER)
  
RETURNING com.HTTPServiceRequest
Returns a HTTPServiceRequest object to handle an incoming HTTP request, or null if there was none during the given period of time. timeout is the time in seconds to wait for an incoming request, and -1 means infinite wait.
Notice that any new call to this function will raise an error until the previous HTTP request was handled by sending a response back to the client, or destroyed.
Throws an exception in case of errors, and updates status with an error code.
com.WebServiceEngine.SetFaultCode(
 code
STRING,
 codeNS
STRING )
Defines a user SOAP Fault code to be returned to the client, where code is the mandatory SOAP Fault code and codeNS is the mandatory Code namespace. This function has an effect only if called inside a WebService operation.
com.WebServiceEngine.SetFaultString(
  str
STRING )
Defines a user SOAP Fault description to be returned to the client, where str is the description string. This function has an effect only if called inside a WebService operation.
com.WebServiceEngine.SetOption(
  flag
STRING,
  value
INTEGER )
Sets an option flag to change the global behavior of the Web Services engine, where flag is the option flag and value is the value of the flag. See Global option flags.
Throws an exception in case of errors, and updates status with an error code.
com.WebServiceEngine.GetOption(
  flag STRING )

  RETURNING
value
Gets an option flag value of the Web Services engine, where flag is the option flag and value is the value of the flag. See Global option flags.
Throws an exception in case of errors, and updates status with an error code.

Usage

A human-readable description of the error codes for RegisterService and ProcessServices  is available in the SQLCA.SQLERRM structure

ProcessServices returns a status value with the following meaning:

      0 : A request has been processed successfully
    -1 : Time out reached
    -2 : Disconnected from application server
    -3 : Lost connection with the client
    -4 : Server has been interrupted with Ctrl-C
    -5 : Bad HTTP request
    -6 : Malformed SOAP envelope
    -7 : Malformed XML document
    -8 : HTTP error
    -9 : Unsupported operation
  -10 : Internal server error
  -11 : WSDL Generation failed
  -12 : WSDL Service not found
  -13 : Reserved
  -14 : Incoming request overflow
  -15 : Server was not started
  -16 : Request still in progress
  -17 : Stax response error

Global option flags for SetOption and GetOption:

Flag Client or Server Description
readwritetimeout Client Defines the default maximum time in seconds a client, a HTTP request/response and a TCP request/response have to wait before to raise an error because the server doesn't return or accept data.
Note: A value of -1 means infinite wait (the default value is -1)
connectiontimeout Client Defines the default maximum time in seconds a client, a HTTPRequest and a TCPRequest have to wait for the establishment of a connection with a server.
Note: A value of -1 means infinite wait (the default value is 30 seconds except for Windows, where it is 5 seconds).
maximumresponselength Both Defines the maximum size in KBytes a client, the server, a HTTP or TCP response, allows before to break.
Note: A value of -1 means no limit (the default value is -1).
wsdl_decimalsize Server Defines whether the precision and scale of a DECIMAL variable will be taken into account during the WSDL generation. See Notes on WSDL Generation Options below.
Note: A value of zero means false (the default value is true).
wsdl_arraysize Server Defines whether the size of a BDL array will be taken into account during the WSDL generation. See Notes on WSDL Generation Options below.
Note: A value of zero means false (the default value is true).
wsdl_stringsize Server Defines whether the size of a CHAR or VARCHAR variable will be taken into account during the WSDL generation. See Notes on WSDL Generation Options below.
Note: A value of zero means false (the default value is true).
http_invoketimeout
(deprecated use readwritetimeout)
Client Defines the default maximum time in seconds a client has to wait before the client connection raises an error because the server is not responding.
Note: A value of -1 means that it has to wait until the server responds (the default value is -1)
tcp_connectiontimeout
(deprecated use connectiontimeout)
Client Defines the default maximum time in seconds a client has to wait for the establishment of a TCP connection with a server.
Note: A value of -1 means infinite wait (the default value is 30 seconds except for Windows, where it is 5 seconds).

Notes on WSDL Generation Options

1. For a BDL type DECIMAL(5,2), when "wsdl_decimalsize" is TRUE, the generated WSDL file contains the total size and the size of the fractional part of the decimal:
<types>
   <schema xmlns="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://www.4js.com/types/">
      <simpleType name="echoDecimal5_2_a_dec5_2_out_FGLDecimal">
         <restriction base="decimal">
            <totalDigits value="5" /> 
            <fractionDigits value="2" /> 
         </restriction>
      </simpleType>
   </schema>
</types>
<message name="echoDecimal5_2">
  <part name="dec5_2" type="f:echoDecimal5_2_a_dec5_2_in_FGLDecimal" /> 
</message>

When "wsdl_decimalsize" is FALSE, the total size and the size of the fractional part are not mentioned:

<message name="echoDecimal5_2">
  <part name="dec5_2" type="xsd:decimal" /> 
</message>

2. If the WSDL file does not contain the size, the client application has no way of knowing the size. In this case, a default value for the size is generated. For example, the exported server type DECIMAL(5,2) becomes a DECIMAL(32) on the client side.

3. It is better to keep the options "wsdl_arraysize", "wsdl_stringsize", "wsdl_decimalsize" set to TRUE (default) so that the BDL client application can do exact type mapping.

4. When setting a facet constraint attribute on a simple datatype, the generation of the WSDL will take this attribute into account even if an option has been set to perform the opposite.

5. Notice also that when setting one facet constraint attribute, all default ones won't be generated anymore excepted if you specify them as facet constraint attributes.


Examples

Placeholder