Task 3: Retrieving an OpenAPI description and calling the service in a generated client
You get an OpenAPI description of your HTDS, and use it to generate a Java client. Then, you test the Java client with a JUnit class.
About this task
You download an OpenAPI description of your HTDS, and copy it to the tutorial directory. Then, you use the description to generate a Java client. You add custom code to the Java client to call your decision service with input parameters. If you have an installation of Maven, you can run the Java client test.
Step 1: Downloading and replacing files
About this task
Procedure
- In the Navigator pane of the Explorer tab in Rule Execution Server, expand the RuleApps.
- Expand /PreTradeChecksRuleApp/1.0 RuleApp, and click PreTradeChecks/1.0.
- On the Ruleset View page, click Retrieve HTDS Description File.
- Select REST in the Service protocol type field.
- Select OpenAPI - YAML.
- Select the Decision trace information option, and then click
Download.

- Save the file by renaming it pretradecheck.yaml and replacing the following file: <InstallDir>/executionserver/samples/decisionservice/data/pretradecheck.yaml.
Step 2: Generating the Java client
About this task
Procedure
Step 3: Adding a test to the Java client
About this task
You add a JUnit test to the generated client by using a command that copies a Java file that is provided for this task.
Procedure
Step 4: (Optional) Running the Java client test
This step is optional because you must have Maven 3.0 or higher installed, and Java 8 in your PATH environment variable.
About this task
You run your JUnit test and check the results.