In a previous tutorial, I taught you how to receive data in TIBCO BW process using HTTP POST method. In this tutorial, I will teach you how you can receive data in TIBCO with TIBCO HTTP GET Method.
So you are well aware of the difference between HTTP POST and HTTP GET in general? If yes then that’s great. If not, I am here to tell you!!
In case of HTTP POST, data sent from sender is received in the body of HTTP message which can be then accessed in TIBCO process from PostData variable of HTTP Receiver. This data doesn’t become part of HTTP URL while sending request towards HTTP Server.
On the other hand, in case of HTTP GET, data (parameters) sent from the client are sent as part of HTTP URL and these parameters are then accessed in TIBCO Processes from Parameters variable of HTTP Receiver.
Ok, now we move forward with step by step tutorial on working with HTTP GET data in TIBCO. We are going to develop a HTTP based process which will take a file name as input through GET method and then it will return contents of that file as HTTP Response. In case it fails to find the file, it will return a custom HTTP Response message.
Step 1: Create HTTP Connection
Anytime you go for HTTP based messaging in TIBCO, first step is to create HTTP Connection. From the HTTP Palette choose HTTP Connection activity and drag it in your project design window.
Now configure your HTTP Connection by specifying IP, Port etc. as shown below:
Step 2: Create TIBCO Process to receive HTTP GET data
In order to receive HTTP GET data in TIBCO, we create a new process and use HTTP Receiver activity as process starter for it.
In the configuration tab of HTTP Receiver, choose HTTP Connection (that was created in step 1). In the parameters option, click on (+) sign to add a new parameter. This parameter will be used to receive HTTP GET data.
Complete configuration of HTTP Receiver activity will look like below:
As you can see in below screenshot, newly created parameter is now available under parameters in the Output tab of HTTP Receiver:
In order to read file contents, we use Read File activity in our process. In the Input of Read File activity, we have used the file name that we received as HTTP GET parameter. We have concatenated this file name with our path to give absolute file path as shown in below screenshot:
We will have two transitions from our Read File activity to the next activities. In case of Success of Read File activity, we will have a transition to Send HTTP Response activity to send file contents.
In the configuration tab of Send HTTP Response activity, we choose HTTP Receiver for which we are sending back this response as shown below:
In the Input tab of Send HTTP Response activity for success cases, File Contents read through Read File activity are mapped which will be sent as response data.
Input tab mapping of Send HTTP Success Response is shown in below screenshot:
In case of any error in Read File activity, error transition will be followed and Send Failure Response will be used to send response back to the client.
In the Input tab of this failure HTTP Response activity, we are sending a custom message as shown below:
Now we are done with our process development. Validate the project and after successful validation, move to the testing step.
Step 3: Test TIBCO HTTP Get Method
Before testing the process, create some files at the path which was specified in Read File activity. In my case, I have created two files (student.txt and teacher.txt) at the given path as you can see below:
Load the process in TIBCO Designer tester. After loading the process in tester, go to your browser and type following in the URL field:
http://localhost:8899/?filename=teacher
As a file with the name teacher.txt was present at the given path, so I got following response back on my browser window:
You can also observe from above screenshot that success transition path has been followed in our process as file was successfully read by the process.
Now in order to test failure scenario, we will give a filename in the URL for which file doesn’t exist. For this, I typed following URL in my browser:
http://localhost:8899/?filename=doctor
Now, we got error message in response and we can also see from the below screenshot that now, error transition has been followed (as file read activity failed):
Hi Ajmal,
Thanks for such interesting and very useful posts of TIBCO World. I am also a TIBCO BW developer with overall 3.2 Years of Experiance.
I found your blog very helpful, specially for the POCs related to these posts. So thanks once again. However in this particular post “TIBCO HTTP GET Tutorial” I got to no one minor typing mistake which is present in para starting with
“Ok, now we move forward with step by step tutorial on working with HTTP Post data in TIBCO. We are going to…”
Here you have written “HTTP Post data”, whereas as per my understanding you were about the write “HTTP Get data”. As in this particular tutorial ou have explained the steps for HTTP Get Method in TIBCO BW.
Thanks,
K.D.Mishra
Dear Mishra,
Many thanks for appreciation and for the correction. I have updated the post with the typing mistake removed. Your support is much appreciated.
Ajmal sir your site is much more helping to me thank u very much ..
Hi Ajmal,
I have a requirement to automate a manual process of downloading a file from HTTPS website with some user credentials with TIBCO HTTPS activity.
I couldn’t download file, but I could get text content of the file and write it to some file in local drive.
But if possible can you help me in achieving this through HTTPS i.e.. authenticated site by usine some username and pwd dtls.
Hi,
For downloading a file you can go with ftp or sftp activity.
Hi Ajmal,
I have tried above tutorial . Everything is coming . But when I am giving request from web browser 2 job creating in tester . One is getting completed with success message . One is getting failed .
First of all Thanks Ajmal for this tutorial . Very helpful and simple 🙂
@Nikhil,
Try using the send/go arrow key . Sometimes enter gets pressed multiple times and hence the outcome , where 1 succeeds and the rest fail.
Warm Regards,
Vinay
Pingback: 15 Most Popular TIBCO Tutorials on TutorialsPedia | TutorialsPedia
Thanks for your website ! it is almways helpful !
I am looking how to download pdf file from one URL, can I use HTTP connection ? thanks
i have an doubt reagarding how to configure SFTP protocol when we want send a mail.
Hai Ajmal,
I have one doubt that is I try to perform post operation On HTTP receiver from postman.But it was not get the data. How to send data (HTTP – Body) from postman into http receiver.