Sending a Request and Getting a Response from a Web Site

Using the HTTP palette activities you can configure requests to a web server and manage the response.

Prerequisites

Your computer must be connected to the Internet.

Procedure

  1. In the samples directory in the File Explorer view, expand palette > http > RequestResponse and double-click tibco_bw_sample_palette_http_requestresponse. See Accessing Samples for more Information.
  2. In Project Explorer expand the tibco_bw_sample_palette_http_requestresponse.zip to expand it in the Project Explorer.
  3. Expand the tibco_bw_sample_palette_http_requestresponse folder.
  4. Fully expand the Processes directory and double-click HTTP_Request_Response_Example.bwp to open it in the Process Editor pane.
  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. Select the check box next to tibco_bw_sample_palette_http_requestresponse_application.
  8. Click Debug.
    This will run the sample in Debug mode.
  9. Run lendpoints at the prompt in the Console to obtain the endpoint for the application.
  10. Copy the hostname from the endpoint.
  11. In File Explorer, right-click on the RequestResponse folder and select Open Location to access the RequestResponse folder in your file system.
  12. Right-click request_news.html in your file system's folder and open it in a text editor.
  13. Replace <hostname> with the actual hostname of your machine that you copied from the endpoint and save the file.
  14. Double-click the request_news.html file found in File Explorer undersamples\palette\http\RequestResponse to open it in TIBCO Business Studio™.
  15. Click the Get News from Google! button to request headlines from the associated web page.
  16. Click the Terminate icon to stop the process.

    The Google News web page displays in your default browser. The Response sent successfully!! message will print in the TIBCO Business Studio™ console.

  17. Optionally, push your application to the cloud. For details on how to do this see the topic "Pushing an Application to the Cloud". Before you can do that, you must replace the action field with the actual endpoint URL, action="https://integration.cloud.tibcoapps.com/ufa2wteninl6lqj7d2w5slpfqdmahmgm/ListeningHTTPConnection/listeninghttpconnection". Be sure to append the HTTP connector name (listeninghttpconnection) at the end of the endpoint.

Understanding the Configuration

The Incoming HTTP Request process starter listens on the connection specified in ListeningHTTPConnection.httpConnResource. The request_news.html file contains a form and clicking the Get News from Google! button sends the corresponding text string (Google) to the Incoming HTTP Request activity.

The conditional transition routes the request to the Send HTTP Request activity, which sends the request to the host using ListeningHTTPConnection. Finally, when the response comes from the remote site, the Send HTTP Response activity closes the HTTP Connection established by the Incoming HTTP Request process starter.

An internet connection is required for the sample to connect to Google News. The ListeningHTTPConnection listens on port 13008. Change the LISTENING_PORT value in the Module Properties dialog. You must also change the Port defined in the request_news.html file to the same value.