Choosing a web services style

Genero Web Services 2.0 allows you to create Web Services operations in the following styles:

Table 1. Web Services Styles
Web Services Style Description
RPC Style Service (RPC/Literal) Generally used to execute a function, such as a service that returns a stock option.
Document Style Service (Doc/Literal)

Generally used for more sophisticated operations that exchange complex data structures, such as a service that sends an invoice to an application, or exchanges a Word document; this is the MS.Net default.

Both RPC/Literal and Doc/Literal Styles are WS-I compliant ( Web Services Interoperability organization).

RPC Style Service (RPC/Encoded)

Provided only for backwards compatibility with older versions of web services already published.

Important: This style is deprecated by the WS-I organization, and is not recommended, as most Web Service implementations won't support it in the future.

The style of service to be created is specified in the Genero application for the Web Service, using the following methods of the WebOperation class from from the Web Services COM Library (com). The parameters are the same for both methods:

  1. The name of the 4GL function that is executed to process the Web Service operation

  2. The name you wish to assign to the Web Service operation

  3. The input record defining the input parameters of the operation (or NULL if there is none)

  4. The output record defining the output parameters of the operation (or NULL if there is none)

LET op = com.WebOperation.CreateRPCStyle("add","Add",
           add_in,add_out)
LET op = com.WebOperation.CreateDOCStyle("checkInvoice",
           "CheckInvoice",invoice_in,invoice_out)

Calling the appropriate function for the desired style is the only difference in your Genero code that creates the service. The remainder of the code that describes the service is the same, regardless of whether you want to create an RPC or Document style of service.

Important: Do not use the setInputEncoded() and setOutputEncoded() methods of the WebService class from the Web Services COM Library (com), as they apply only to RPC/Encoded Style, which is not recommended.
Note: If you add headers to your RPC Style service, choose the Literal serialization mechanism by setting the encoded parameter of the createHeader() method to FALSE:
CALL serv.createHeader(var,FALSE)
Note: GWS release 2.0 allows you to create RPC Style and Document Style operations in the same Web Service. However, we do not recommend this, as it is not WS-I compliant.