Using HTTP or SOAP to Get Information from MySQL

Several processes are defined that show how to get information from MySQL and Sakila, which is a sample database (included with MySQL) that has default schemas and tables.

Prerequisites

Ensure to install JDBC Drivers for Design time and Run time.

For more information about a JDBC Connection shared resource, see the "JDBC Connection" section in the TIBCO ActiveMatrix BusinessWorks™ Bindings and Palettes Reference guide.

Procedure

  1. In the samples directory, select palette > http > MultiEndpointApp and double-click tibco.bw.sample.palette.http.MultiEndpointApp. For more information, see Accessing Samples.
  2. In Project Explorer expand the tibco.bw.sample.palette.http.MultiEndpointApp project.
  3. Set the default ApplicationProfile to match the OS you are running on. For more information, see Setting the Default Application Profile.
  4. Fully expand the Resources directory and then double-click HTTPConnectorResource.httpConnResource. Verify that the Host and Port values are correct.
  5. Double-click JDBCConnectionResource.jdbcResource and verify the database connection properties. Click the Test Connection button to verify your database configuration.
  6. Fully expand the Processes directory and double-click ActorService.bwp, FilmService.bwp, or SakilaService.bwp.
  7. Click Run > Debug Configurations.
  8. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select BWApplication.
  9. Click the Applications tab and then click the Deselect All button if you have multiple applications. Select the check box next to tibco.bw.palette.http.MultiEndpointApp.application.
  10. Click Debug.
    This runs the sample in Debug mode.
  11. Note: By complying to the instructions mentioned above, you can run the client and server only in TIBCO ActiveMatrix BusinessWorks 6.x.
    To run TIBCO ActiveMatrix BusinessWorks 5.x client do the following:
    1. Unzip, open, and run bw5/tibco.bw.sample.palette.http.MultiEndpointApp.bw5_client in the TIBCO Designer.
    2. Click the Tester tab and then click the green button. Select the check box next to the process and Select All > Load & Start Current.
  12. Click the Terminate icon to stop the process.

Result

The expected outcome for the file identified in the OUTPUT_FILE property is:

Actor Name: CUBA OLIVIER

Film Title: ALIEN CENTERDescription: A Brilliant Drama of a Cat And a Mad Scientist who must Battle a Feminist in A MySQL Convention CUBA OLIVIER

Understanding the Configuration

Three processes are defined:
  • ActorService Process: contains the HTTP Receiver requests the input query to retrieve actor information using JDBC Query Activity. The response is provided back to HTTP Response activity.
  • FilmService Process: this process has logic similar to the ActorServer process to fetch film information using the JDBC Query activity.
  • SakilaService Process: returns the actor information using the SOAP service, which invokes a JDBC Query and returns the result.

There are corresponding clients for sending HTTP requests and invoking the SOAP service created in ActiveMatrix BusinessWorks 5.x and ActiveMatrix BusinessWorks 6.x.

The ActiveMatrix BusinessWorks 5.x clients demonstrate interoperability between ActiveMatrix BusinessWorks 5.x and ActiveMatrix BusinessWorks 6.x.
  1. Extract the ActiveMatrix BusinessWorks 5.x project tibco.bw.palette.http.MultiEndpointApp.bw5client.zip into a folder and open the project in TIBCO Designer.
  2. Update the Shared Resource configurations for JDBC and HTTP:
    • JDBC: Verify the database connection properties and then click the Test Connection button to verify your database configuration.
    • HTTP: Verify the Host name and Port.
  3. If you change the HTTPConnector.httpConnResource Host name or Port in the ActiveMatrix BusinessWorks 6.x project, then update the same in the ActiveMatrix BusinessWorks 5.x client activities (Send HTTP Request and SOAP Request Reply) configuration.
  4. If you have made any change in WSDL operations or schema used in WSDL, you must regenerate the concrete WSDL for the Sakila service and then import the WSDL in the ActiveMatrix BusinessWorks 5.x client project SOAP Request Reply activity.
  5. You can run the client to invoke the endpoints exposed in the ActiveMatrix BusinessWorks 6.x project in the following three ways:
    • Use ActiveMatrix BusinessWorks 5.x to trigger the jobs.
    • Use localhost:13001/actor/getActor/? id=15 and localhost:13001/film/getFilm/?id=15, to send HTTP requests from your browser for the ActorService and FilmService processes respectively. To send SOAP requests use the generated concrete WSDL in ActiveMatrix BusinessWorks 6.x project in a third party SOAP client such as SOAPUI.
    • Run the ActiveMatrix BusinessWorks 6.x project as it has the designed Client process.