Using the Debug Engine
You can create a reference for a service that is running on your local machine.
- Run the service using the Run BusinessWorks Application from the right-click context menu.
- Type lrestdoc in the Console once the service is running.
- You can use the Try it out! button to verify that the service is running.
- 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.
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.
- Right-click the Service Descriptors folder of the process and select .
- Enter a name for the .json file and click Finish.
- Right-click the newly created .json file in the Service Descriptors folder and select .
- Paste the JSON code that you copied from the Swagger file into the Text Editor and save the project.
- Expand the .json file in the Service Descriptors folder to expose the paths.
- 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:
- Click on the reference name in the Process Editor to open its properties.
- Click the Bindings tab.
- Click the HTTP Client link in the Bindings tab.
- 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.
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.
- Open the module properties for the reference application by double-clicking on
- Expand the Application module tree to see the newly created module property.
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.