JSON Web services in BAM

BAM supports the use of RESTful Web Services using JSON.

The exchange protocol is HTTP/REST with JSON encoded messages.

For JSON Services, both the server implementation and client (consumer) API are generated from the model. The JSON Web Service implementation consists of:

  • A Web Service Server, created as an entity in the BA diagram.

    A JSON Web Service Server contains the main logic to publish services. It listens for incoming requests and executes the relevant service operation. When implemented, it generates a .4wsjprg file.

  • One or more Web Services, with or without forms. The Web Services are created as entities and linked to the Web Service Server in the BA diagram.

    A standalone JSON Web Service entity generates a web service with its CRUD operations, but with no accessible form. When implemented, it generates a .4wsj file.

    A CRUD form and JSON Web Service entity generates the code for a CRUD form (a GUI doing create, read, update and delete functionality using a direct connection to a database) and the code for a single standalone Web Service (doing create, read, update and delete functionality using Web service requests.) When implemented, it generates a .4fdmwsj file.

    A Zoom form and JSON Web Service entity generates the code for a Zoom form (a GUI supporting read operations only using a direct connection to a database) and the code for a single standalone Web Service (doing read operations only using Web service requests.) When implemented, it generates a .4fdzwsj file.

  • A Web Service client stub.

    The BAM generates a client stub which encapsulates the lower levels of the HTTP REST JSON operations (requests and responses) in the form of the WebService_serviceclient.4gl file. The Web service client itself must be coded by hand. See Creating a client for a JSON Web service.

When the BAM entities are implemented, they generate business records.

Figure: JSON Web Services in BAM

This figure is a diagram showing how JSON Web services work in BAM. The contents are described in the surrounding text.

For more information regarding JSON (or RESTful) Web services, refer to the Genero Business Development Language User Guide.