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. For more information, see Accessing Samples.
  2. In the Project Explorerview, expand the tibco.bw.sample.palette.http.RequestResponse.
  3. Set the default application profile to match the OS you are running on. For more information, see Setting the Default Application Profile.
  4. Expand the tibco.bw.sample.palette.http.RequestResponse folder.
  5. Fully expand the Processes directory and double-click HTTP.Request.Response.Example.bwp to open it in the Process Editor pane.
  6. Click Run > Debug Configurations.
  7. At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select BWApplication.
  8. 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.
  9. Click Debug.
    This runs the sample in Debug mode.
  10. Run lendpoints at the prompt in the Console to obtain the endpoint for the application.
  11. Copy the hostname from the endpoint.
  12. In File Explorer, right-click on the RequestResponse folder and select Open Location to access the RequestResponse folder in your file system.
  13. Right-click request_news.html in your file system's folder and open it in a text editor.
  14. Replace <hostname> with the actual hostname of your machine that you copied from the endpoint and save the file.
  15. Double-click the request_news.html file found in File Explorer undersamples\palette\http\RequestResponse to open it in TIBCO Business Studio™ for BusinessWorks™.
  16. Click the Get News from Google! button to request headlines from the associated web page.
  17. Click the Terminate icon to stop the process.

    The Google News web page displays in your default browser. The Response sent successfully!! message appears in the TIBCO Business Studio for BusinessWorks console.

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.