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.
- In the samples directory in the File Explorer view, expand and double-click tibco_bw_sample_palette_http_requestresponse. See Accessing Samples for more Information.
- In Project Explorer expand the tibco_bw_sample_palette_http_requestresponse.zip to expand it in the Project Explorer.
- Expand the tibco_bw_sample_palette_http_requestresponse folder.
- Fully expand the Processes directory and double-click HTTP_Request_Response_Example.bwp to open it in the Process Editor pane.
- Click .
- At the left hand tree of Debug Configuration wizard, expand BusinessWorks Application and select BWApplication.
- 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.
This will run the sample in Debug mode.
- Run lendpoints at the prompt in the Console to obtain the endpoint for the application.
- Copy the hostname from the endpoint.
- In File Explorer, right-click on the RequestResponse folder and select Open Location to access the RequestResponse folder in your file system.
- Right-click request_news.html in your file system's folder and open it in a text editor.
- Replace <hostname> with the actual hostname of your machine that you copied from the endpoint and save the file.
- Double-click the request_news.html file found in File Explorer undersamples\palette\http\RequestResponse to open it in TIBCO Business Studio™.
- Click the Get News from Google! button to request headlines from the associated web page.
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.
- 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.