Configuring Liberty for IBM Cloud Watson services

Use the IBM® Bluemix® utility command-line integration tool to configure your on-premise Liberty server to use IBM Cloud Watson™ services.

Before you begin

Before you configure your Liberty server to any IBM Cloud service, you must create an account. See Sign up for IBM Cloud to create your IBM Cloud account.

About this task

Configure your Liberty server to use Watson services. Your application must use the Watson Developer Cloud Java™ SDK to access the Watson service. For more information, see Watson Developer Cloud Java SDK services. For more information about Watson, see Watson services.

Procedure

  1. Log in using the bluemixUtility login command. After you initially log in, you do not have to complete this step again.
  2. Run the bluemixUtility marketplace command to list details about all the IBM Cloud services that can be used with the command-line utility. See the following example of the Personality Insights description:
    Service: personality_insights
    Description: The Watson Personality Insights derives insights from transactional and social media data to identify psychological traits
    Documentation: https://www.ibm.com/watson/developercloud/personality-insights.html
    Plans: tiered, premium
  3. Note: If you already created an instance, skip to step 4. You can also create an instance from the IBM Cloud dashboard.
    Run the bluemixUtility createService [options] serviceType servicePlan serviceName command to create an instance of the service that you want to use. You can choose a unique serviceName for your service instance. The following example creates an instance of the Personality Insights service:
    bluemixUtility createService personality_insights premium myWatsonService
  4. Optional: Run the bluemixUtility listServices command to view the Name, Type, and Plan of all the service instances that you created. See the following example:
    myWatsonService personality_insights premium
  5. Run the bluemixUtility import myWatsonService command to import the configuration.
    1. Accept the license terms and conditions of the necessary libraries that are needed to access the service.
    2. After the configuration is successfully imported, complete any additional steps to use the imported configuration in your application, such as adding a classloader reference to the library. The classloader element must be added to each application that is using the service. The classloader reference ID is different from each unique Watson service. For example, you must add the following classloader reference to your application to use the Watson Java SDK libraries.
      <application id="myWatsonApp">
                      <classloader commonLibraryRef="personality_insights-library"/>
              </application>
  6. Optional: Run the bluemixUtility listImports command to view the service configurations that you imported.
    The following IBM Bluemix service configurations have been imported:
    myWatsonService
  7. Run the bluemixUtility bind [options] serverName serviceName to bind the configuration to a Liberty server. See the following example and description of a service listed:
    bluemixUtility bind defaultServer myWatsonService
    
    Checking if features required for the myWatsonService are installed.
    All required features are installed.
    The myWatsonService is now bound to defaultServer server.

Results

You can now use Watson services with your Liberty server.

Icon that indicates the type of topic Task topic

File name: twlp_config_blmx_watson.html