Using a SOAP Web Service to Make a Query to a Bookstore

Using a SOAP binding, a web service WSDL operation queries for information from a data source. The web service has one operation, GetBooksByAuthor, that is implemented in the process, QueryBooksByAuthorProvider. At run-time, a request containing an author name returns details about the author's books.

Prerequisites

Copy the BookStore.xml file to C:\tmp location.

Procedure

  1. In the samples directory, select binding > soap > http > BookStore and double-click tibco.bw.sample.binding.soap.http.BookStore. For more information, see Accessing Samples.
  2. In Project Explorer, expand the tibco.bw.sample.binding.soap.http.BookStore 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 Processes directory and double-click QueryBooksByAuthorProvider.bwp.
  5. Click Run > Debug Configurations.
  6. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select BWApplication.
  7. Click the Applications tab and then click the Deselect All button if you have multiple applications.
  8. Select the check box next to tibco.bw.sample.binding.soap.http.BookStore.BookStore.application.
  9. Click Debug.
    This executes the sample in Debug mode.
  10. Click the Terminate icon to stop the process.

Result

The query sends a request for "Vivek Ranadive" and returns the following book details:

17:58:24.807 [PVM:In-Memory STWorkProcessor:2] INFO c.t.b.g.L.t.b.b.s.h.BookStore.Log - Message=Book Title: The Power of Now, Author is Vivek Ranadive, Date: 1999, ISBN 0-06-566778-9, Publisher is Tibco Software Inc

Understanding the Configuration

The following processes are defined in the project:

  • BookStoreServiceClient.bwp: The process implements the GetBooksByAuthor operation using BooksInterface.wsdl, and then invokes the QueryBooksByAuthorProvider process. The reply containing the query results is made by mapping to the output of the Query service. A Timer activity triggers the client and then triggers a SOAP Invoke activity, which is the actual web service client.
  • QueryBooksByAuthorProvider.bwp: The process definition representing the service's business logic. The service Receive activity implements the GetBooksByAuthor operation based on the BooksInterface.wsdl file. The Read File activity reads the bookstore (an XML file in this sample).
    Note: The file must be on the machine that is used to run the sample.
    The Parse XML activity then parses the XML document. Finally, the filter is executed at the end of the process flow in the Reply (see Reply activity's Input tab).

The following resources are defined in the project:

  • Resources\BookStore.xml. The file representing the bookstore database.
  • HTTPConnector.httpConnResource: The HTTP shared resource to use. If you want the web service to access a different host machine or port, edit the Host and Port properties, and then regenerate the concrete WSDL from the component binding.

    For more information, see TIBCO ActiveMatrix BusinessWorks™ Application Development.

The following schemas and service descriptors are defined in the project:

  • Schemas\Books.xsd: The schema file containing the type definitions used by the web service interface.
  • Service Descriptors\BooksService.wsdl: The WSDL file that describes the Bookstore web service.