Creating Web Service Methods

You can create Web service JADE methods only for Web service classes.

Methods declared on the JadeWebService class and its subclasses that are marked as Web service methods cannot have a return type of Any and cannot have parameters of type Any. (See also "webService Option" under "Method Options", in Chapter 1.)

For details about defining a JADE method for a non-Web service class, see "Defining and Compiling JADE Methods and Conditions", in Chapter 4 of the JADE Development Environment User’s Guide.

To define a Web services JADE method

  1. In the Class List of the Class Browser, click on the subclass of the JadeWebService class or one of its subclasses to which the method is to be added.

  2. Select the New JADE Method command from the Methods menu. The Jade Method Definition dialog is then displayed.

    The Web Services check box is enabled only when a subclass of the JadeWebService class or one of its subclasses is selected in the Class List.

  3. Uncheck the Web Services check box if you do not want the JADE method to be a Web services method. This check box is checked by default for Web services classes.

When you click the OK button on the Jade Method Definition dialog and the Web Services check box is checked, the signature of your method in the editor pane then includes the webService method option. For example, if you defined a getClients method, the method signature that is created initially is as follows.

getClients(): webService;

The following is an example of a getClient method defined in the ErewhonInvestmentsService subclass of the JadeWebServiceProvider class.

getClient(clientName: String): Client webService;
vars
    client: Client;
begin
    client := app.myCompany.allClients[clientName];
    if client = null then
        setError(23, clientName, 'Client does not exist');
    endif;
    return client;
end;

You can add or remove the webService method option, which toggles the type of method (that is, to change it from a Web services method to a JADE method, or the reverse).

You can specify any type of parameter (that is, constant, input, io, or output) for a Web services method. For details, see "Parameters", in Chapter 1.

The method does not require a return value because the Web service uses the HTTP protocol (which always requires a response) and a reply is always sent to the Web service consumer. Primitive parameters that are io or output are also sent back in the response as are object parameters that are not constant.

JADE timestamp values use the local time zone. External Web service consumers often expect Coordinated Universal Time (UTC) values and external Web service providers often return UTC values. You may need to convert between UTC and local timestamp values using the localToUTCTime and utcToLocalTime methods of the TimeStamp primitive type.