Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The request box feature allows you to invoke multiple operations (consecutively) to a datasource using a single operation. Follow the steps given below to define a data service that can invoke request box operations:

...

  1. Log into the management console and click Create under Data Service.
  2. Add a name for the data service.

  3. Select the Enable Boxcarring check box. As a result of selecting this check box, the Disable Legacy Boxcarring Mode check box will appear on your screen as shown below. You can select this new check box (Disable Legacy Boxcarring Mode) as well.

    Note
    titleWhat is Boxcarring and Request Box?

    Boxcarring is a method of grouping a set of service calls so that they can be executed as a group (i.e., the individual service calls will be executed consecutively in the specified order). Note that we have now deprecated the boxcarring method for data services. Instead, we have replaced boxcarring with a new request type called request_box

    Request box is simply a wrapper element (request_box), which wraps the service calls that need to be invoked. When the request_box is invoked, the individual service calls will be executed in the specified order, and the result of the last service call in the list will be returned. In this tutorial, we are using the request box to invoke the following two service calls:

    1. Add a new employee to the database
    2. Get details of the office of the added employee

    When you click the Enable Boxcarring check box for the data service, both of the above functions (Boxcarring and Request box) are enabled. However, since boxcarring is deprecated in the product, it is recommended to disable boxcarring by clicking the Disable Legacy Boxcarring Mode check box.

  4. Click Next and then click Add New Datasource.
  5. Connect to the Company database that you defined above. For instructions, see Exposing an RDBMS as a Data Service.
  6. Click Save, and then click Next to go to the Queries screen.
  7. Click Add New Query to specify the query details:

    1. Enter addEmployeeQuery as the query ID.

    2. Enter the following SQL dialect:

      Code Block
      insert into Employees (EmployeeNumber, FirstName, LastName, Email,OfficeCode) values(:EmployeeNumber,:FirstName, :LastName,:Email,:OfficeCode)
  8. Click Generate Input Mapping and input mappings will be generated automatically:

  9. Click Save.

  10. Click Add New Query to Create another query for the Company datasource:

    1. Enter selectOfficebyID as the query ID.

    2. Enter the following SQL dialect:

      Code Block
      select OfficeCode,AddressLine1,AddressLine2,City,State,Country,Phone from Offices where OfficeCode=:OfficeCode
  11. Generate input and output mappings:

    1. Click Generate Input Mapping and input mappings will be generated automatically for the office code field.

    2. Click Generate Response to automatically generate the output mappings for the fields in the Offices table.

  12. Click Save.

  13. Click Next and then click Add New Operation to create an operation for the addEmployeeQuery query as shown below.

  14. Click Save.

  15. Click Add New Operation to create another operation to invoke the selectOfficebyID query:

  16. Click Save and then click Finish.

...