Create and publish the Web services operation

Provide your Web service and its operation to users who can access it on the net.

Methods are available in the Genero Web Services library (com) to:

  • Define the Web Service, by creating a WebService object

  • Register the HTTP input and output methods

  • Define the Web Services operation for your function, by creating a WebOperation object

  • Publish the operation - associate it with the Web Service object that you defined.

The com library must be imported into each module of a Web Services Server application.

The following abbreviated example is from the Web Services Server tutorial:
IMPORT com
...
FUNCTION createservice()
    DEFINE service   com.WebService    # A WebService
    DEFINE operation com.WebOperation  # Operation of a WebService
    
    # Handle HTTP register methods
    CALL service.registerInputHttpVariable(HttpIn)
    CALL service.registerOutputHttpVariable(HttpOut)

    # Publish Operation : add
    LET operation = com.WebOperation.CreateDOCStyle("service_implementation.add","add",Add,AddResponse)
    CALL service.publishOperation(operation,"")

    # Register Service
    CALL com.WebServiceEngine.RegisterService(service)
   
...
END FUNCTION

See the Writing a Web server application and Choosing a web services style for complete examples and explanations.