Sending a HTTP request with a parameter from TIBCO BusinessEvents.

Sending a HTTP request with a parameter from TIBCO BusinessEvents.

book

Article ID: KB0086483

calendar_today

Updated On:

Products Versions
TIBCO BusinessEvents Enterprise Edition -
Not Applicable -

Description

Resolution:
Description:
===========
Sending a HTTP request with a parameter from TIBCO BusinessEvents.

Environment:
===========
TIBCO BusinessEvents 4.x,5.x
All Operating Systems

Resolution:
========

Use HTTP.encodeURL to encode the parameter part.  Compose the request URL with parameters.

The following  http://maps.googleapis.com  will be used as an example.
>>>>>>>>>>>>>
                              String reqUrl1="http://maps.googleapis.com/maps/api/geocode/xml?address=";
                              String addr = "3301 Hill View Ave, Palo Alto, CA";
                              String reqUrl2="&sensor=";
                              String sens = "false";
                              String reqUrl=reqUrl1+HTTP.encodeURL(addr,"UTF-8")+reqUrl2+HTTP.encodeURL(sens,"UTF-8");
<<<<<<<<<<<<<

The final request URL looks like the following:

http://maps.googleapis.com/maps/api/geocode/xml?address=3301+Hill+View+Ave%2C+Palo+Alto%2C+CA&sensor=false

Now use the HTTP.sendRequest to send request event to this URL:

  HTTP.sendRequest(reqUrl, request, "/Events/httpResponse", 1000);

The response is returned to BE with the following payload:
>>>>>>>>>>
<?xml version="1.0" encoding="UTF-8"?>
&ltGeocodeResponse>
&ltstatus&gtOK</status>
&ltresult>
  &lttype&gtstreet_address</type>
  &ltformatted_address&gt3301 Hillview Ave, Palo Alto, CA 94304, USA</formatted_address>

</GeocodeResponse>
<<<<<<<<<<

Issue/Introduction

Sending a HTTP request with a parameter from TIBCO BusinessEvents.