Using the Debug Engine

You can create a reference for a service that is running on your local machine.

Procedure

  1. Run the service using the Run BusinessWorks Application from the right-click context menu.
  2. Type lrestdoc in the Console once the service is running.
  3. You can use the Try it out! button to verify that the service is running.
  4. Copy the Discovery URL and paste it into a browser address bar and press Enter. The Swagger page in the browser will display the path to the Swagger file of the running service.

  5. Copy the Swagger file URL and paste it into another browser tab address bar and press Enter. The browser displays the contents of the Swagger file.

    Now that you have the Swagger file for the service you can create a reference using it. The reference can reside on a machine other than the machine where the service is running. The Swagger file that you just obtained from the running service will contain all the information such as the hostname or the machine where the service is running, the port number and the basepath for the service. The reference you create will reach out to the service using this information from the Swagger file.

Creating the Reference

To create a reference using the Swagger code that you retrieved from the service, you must first create a Swagger file in the Service Descriptors folder of your process.

Create a process for the reference if you do not already have one. You will need to create a .json file in its Service Descriptors folder.

Procedure

  1. Right-click the Service Descriptors folder of the process and select New > File.
  2. Enter a name for the .json file and click Finish.
  3. Right-click the newly created .json file in the Service Descriptors folder and select Open With > Text Editor.
  4. Paste the JSON code that you copied from the Swagger file into the Text Editor and save the project.
  5. Expand the .json file in the Service Descriptors folder to expose the paths.
  6. Drag and drop a path from the Service Descriptors folder to the right boundary of the Process Editor to create a reference.

To make your reference application portable

The reference that you created above can only access a service that is running on a reachable network address. You can modify the reference to use a hostname and port that is configurable even after this application is deployed. Using a Module Property for the hostname and/or port will allow that property value to be provided by an administrator that is running the application. The value may also need to be changed if the service is physically moved to another host or port.

Follow these steps to modify the reference such that it can invoke a service from a location determined even after this application is deployed:

Procedure

  1. Click on the reference name in the Process Editor to open its properties.
  2. Click the Bindings tab.
  3. Click the HTTP Client link in the Bindings tab.
  4. In the HTTP Client section, click the Choose the field value type button next to the Default Host field text box and select Module Property.
  5. Enter host <IP address of machine on which the service is running> in the Default Host text box and click .
    It creates a module property called host and gives it the value of the service machine hostname that you provided.
  6. Open the module properties for the reference application by double-clicking on <Application Name> > Package Unit > Properties
  7. Expand the Application module tree to see the newly created module property.
  8. Click the up arrow button to promote the module property to Application property.
    Now the IP address becomes available to be accessed from outside the firewall.