< Previous | Next >

Task 4: (Optional) Run your decision service through IBM API Connect

You create an OpenAPI file of your decision service, and then run it from API Connect.

Before you begin

You must have a IBM® Bluemix® account to do this task. In the IBM Bluemix welcome page, click Sign up and follow the instructions to create your account. For more information, see Setting up your account.

About this task

You run your decision service in API Connect. You generate an OpenAPI file of the decision service, and then import the file into API Connect and run it.

Step 1: Generating the OpenAPI file

About this task

You download an OpenAPI - YAML file of your decision service that is specific to API Connect. This procedure is similar to task 3, but it has additional steps.

Procedure

  1. In the Navigator pane of the Explorer tab in Rule Execution Server, expand the RuleApps.
  2. Expand /PreTradeChecksRuleApp/1.0, and click PreTradeChecks/1.0.
  3. In the Ruleset View, click Retrieve HTDS Description File.
  4. Select REST as the service protocol type.
  5. Select OpenAPI - YAML as the format for the file. (Optionally, you can use the JSON format.)
  6. Select Latest ruleset version and Latest RuleApp version to generate a file for the latest versions.
  7. Select Proxy for API Connect to add a proxy that API Connect can use to call the decision service.
    Image shows the settings for generating the OpenAPI file.
  8. Click Download. The Rule Execution Server console generates an OpenAPI - YAML file of your decision service. Save the file to your computer so that you can easily find it in the next step.

Step 2: Importing the OpenAPI file into API Connect

About this task

You import your OpenAPI file into API Connect. You must have a Bluemix account to do this step. Optionally for a custom service with authentication, you set the user name and password that are used to connect to the service.

Procedure

  1. Download and install API Designer for IBM API Connect, or use it on IBM Bluemix.
  2. Open API Designer.
  3. In the APIs tab, click Add > Import API from file or URL.
  4. Click Select File > Import.
  5. Navigate to the file that you downloaded in step 1, and then click Open.
  6. Click Import. You see information for the imported file.
    Image shows information about the imported file.
  7. Optional: Browse through the sections to look at the parameters for your service in API connect.
  8. Open the Assemble tab to see the policy assembly.
  9. Click Cancel if you made any changes. You can now use your decision service from API Connect.

Step 3: Running your decision service from API Connect

About this task

You run your decision service from API Connect.

Note: These steps work with API Connect 5.0, and might change in future releases.

Procedure

  1. In API Designer, use the Start command to run your OpenAPI file. You see a message that the gateway is started.
  2. Click Explore to see such information as endpoints and parameters:
    Image shows the parameters.
  3. In the sample data section, click Generate, and then click Call operation. You might have to scroll down to the buttons.
    Image shows the generate and call operation buttons.

    If you encounter a certificate error, click the link in the error message to go back to the explorer. Click Call operation again. You can edit the generated data, and test the service with other values.

  4. Enter sample data from previous tasks:

    Set the customer parameter as follows:

    "customerParameter": {
    "name": "John Smith", 
    "owner": "George Smith@IBM",    
    "initialValue": 2000, 
    "currentValue": 800, 
    "sectorPosition": 800, 
    "bankStockPosition": 800,
    "oilStockPosition": 800, 
    "railStockPosition": 800, 
    "bondPosition": 800,  
    "futurPosition": 800, 
    "stockPosition": 800, 
    "currency": "EURO" 
    }

    Set the order parameter as follows:

    "orderParameter": {  
    "id": "string",  
    "stock":"Company X",    
    "amount": 90,    
    "exchange": "Nouveau Marche",
    "currency": "EURO",    
    "destination": "France", 
    "action": "BUY", 
    "securityType": "STOCK",  
    "dateTime": "2004-02-14T19:44:14.000+0000",    
    "sector": "OIL", 
    "status": "PENDING",  
    "reasons": "BAD_CLIENT"  
    } 
        
  5. Click Call operation. You see a message as follows:
    Image shows the results from the calling operation.

What to do next

In the next task, you continue working in the Rule Execution Server console. You retrieve a WSDL description and call the decision service with a generated client.
< Previous | Next >