TIBCO HTTP Tutorial: How to Send and Receive Data Using HTTP POST Method in TIBCO

By | March 24, 2014

HTTP based connectivity between different applications and between different processes inside a TIBCO BW project is a common thing that TIBCO developers come across. When it comes to transfer of data through HTTP, you have two options available:

  1. Send data through GET method in which parameters sent in HTTP request get concatenated to the Request URL.
  2. Send data through POST method in which data is posted as part of HTTP request body.

In this tutorial, I will explain step by step, how you can send HTTP Post data and then receive and parse the same data using HTTP Receiver activity.

Step 1: Create HTTP Connection:

In order to develop any HTTP Based solution in TIBCO, the first task that comes in my mind is creation of a HTTP connection. Add a new HTTP Connection from the HTTP Palette and configure HTTP connection as shown below:

The configuration shows that this connection will be used to enable HTTP communication on localhost at port number 8899.

tibco http post create connection

Step 2: Create XML File and Associated XSD Schema:

In our tutorial, we will send an XML file through HTTP Post. So let’s first create XML file. I am going to use a simple XML File with an employee basic information as shown below:

<Employee>

<EmployeeName>Ajmal</EmployeeName>

<EmployeeAge>26</EmployeeAge>

</Employee>

Whenever you play with XML files in your TIBCO BW projects, you have to go for XML schemas. So let’s create XML Schema (XSD File) for this XML.

Our XML Schema created for this type of XML files is as shown below:

tibco http post create employee schema

Step 3: Create TIBCO Process to Send HTTP Post Data:

We will create a TIBCO BW Process SendHTTPPostData that will read XML data stored in a local file and then it will use Send HTTP Request activity to send the data towards a process where HTTP Receiver will be listening on given IP/Port to receive the data.

To read XML File, Read File activity is used. As shown in below screenshot, I have given path of XML file which will be read by this activity:

tibco http post data read xml file

Below is configuration of Send HTTP Request activity. As you can see, same Host and Port are specified here which were used while creating HTTP Connection in Step 1. As we will be sending data through POST method (and not GET method), so I haven’t added any parameters here:

tibco send http post data configuration

In the Input tab of Send HTTP Request activity, I have specified “POST” as method and in the PostData, XML file content read through Read File activity have been specified:

tibco send http post data input mapping

That’s it for our sending side. Now we need to move towards development of other process which will receive POST data and do any processing logic required.

Step 4: Create TIBCO BW Process to receive HTTP Post data:

HTTP Receiver activity is used as process starter in our receiver process ParseHTTPPostData. As you can see in below screenshot, HTTP connection created in step 1 is specified in configuration of our HTTP receiver activity which means it will be listening on the IP and Port given in our HTTP Connection. In Output Style we have chosen String as we will be sending text based data.

Complete configuration of HTTP Receiver activity will look like below:

tibco post http data http receiver configuration

In our process, after receiving HTTP Post data in the form of an XML string, we will use Parse XML activity. In Parse XML input tab, HTTP Receiver’s PostData is mapped to XMLString as shown in below screenshot:

tibco http post parse xml input

In the Output Editor tab of Parse XML activity, choose Employee XSD that we created in step 2 as shown below:

tibco http post parse xml output editor

Now output tab of Parse XML activity will look like below based on the Schema that we selected above in Output Editor tab:

post http data parse xml output

After parsing XML data received through HTTP Receiver by POST method, now we won’t be doing any other activities in the data in this tutorial. We just need to send HTTP Response to the sender to tell that everything has gone fine at receiving side.

For this purpose we will use Send HTTP Response activity. In the configuration tab of Send HTTP Response activity, choose HTTP Receiver in Reply For drop down. Configuration of Send HTTP Response will look like below:

tibco post http data send http response configuration

In the Input tab of our Send HTTP Response activity, we are going to send a simple String in response with the text “Request Received Successfully.” as shown below:

send http response input

That concludes development of our both processes and now we are good to go for testing our HTTP Post based solution.

Step 5: Test TIBCO HTTP Post Data

Validate the project to make sure everything has been developed and configured properly. After successful validation, load both processes (SendHTTPPostData process and ParseHTTPPostData process) in designer tester.

Create a new Job for SendHTTPPostData process and you will see that both processes have run successfully.

To verify that everything has worked fine, go to the process SendHTTPPostData in tester mode and look into the Input Data tab for Send HTTP Request activity. As you can see in below screenshot, correct PostData has been sent by our Send HTTP Request activity (XML file contents read by Read File activity):

send http request input data in tester

Now if you see Output tab of Parse Data activity in process ParseHTTPPostData in tester mode, you will see that It has rightly parsed Post Data that was received by HTTP Receiver as shown below:

http post parsed data in tester

If you go to Input Data tab of Send HTTP Response activity, you can see that It has successfully sent the response to the sending activity:

tibco http post send http response input tester

Now you can go to output tab of Send HTTP Request activity and verify that final response has been received:

send http data output in tester

 

Ajmal Abbasi

Ajmal Hussain Abbasi is a TIBCO Consultant By Profession with more than 6 years experience in TIBCO products. He has extensive practical knowledge of TIBCO Business Works, TIBCO Spotfire, TIBCO BE, EMS and TIBCO ActiveSpaces. He has worked on a number of highly critical integration projects in Telecom sector by using his skills in Tibco Designer, Adapters, TIBCO EMS, RV, Administrator, TIBCO BE, TIBCO ActiveSpaces etc. Ajmal Abbasi is also experienced in developing solutions using Oracle PL/Sql, Linux and Java. You can contact Ajmal Abbasi for Consultancy, Technical Assistance and Technical Discussions.

More Posts - Website - Facebook - LinkedIn

12 thoughts on “TIBCO HTTP Tutorial: How to Send and Receive Data Using HTTP POST Method in TIBCO

  1. Pingback: TIBCO HTTP GET Tutorial: How to Receive Data in TIBCO Using HTTP GET | Tibco Guide

  2. avinash

    Hi Ajmal

    How do you create the New JOb you referred in the Step 5 “Create a new Job for SendHTTPPostData process and you will see that both processes have run successfully”

    On my installation it lets me start either of the processes HTTPPostData or ParseHTTPPostData, but not both.

    How can i run both of them.

    thanks in advance for your help

    thanks
    Avinash

    Reply
  3. saravana mahadevan

    Hi – We’re using TIBCO BW V5.7.2HF11. Messages coming in are accepted in via a HTTP receiver and posted out on EMS queues to the relevant third party systems. When the downstream systems response times increase we’ve notice that threads get hung/stuck within our Web service BW engine – we can see this via Administrator. In order to get it working back to normal we have to restart the engine. Our BW engines with JMS receiver process starters to not seem to experience this same problem. Any ideas as to why this would happen to Web specific services/engines and why the threads/job would not automatically flush out? Any ideas on how to resolve this problem?

    Reply
    1. Siva

      Hi Saravana,

      We are facing exactly the same problem. Have you got any resolution for this issue? If so can you share us the details please?

      Regards,
      Siva

      Reply
  4. Priya

    hi Ajmal ,

    Thanks for Sharing this.However , when i run this process , i m getting “The Http Server replied with a 5XX status code” error in send HTTP Request” .
    Could you please help me with this.

    Thanks , Priya

    Reply
    1. Ajmal Abbasi Post author

      Dear Priya,

      Please use some different port which is available. 5xx error means connection not getting established with given IP and PORT.

      Reply
      1. Priya

        Thanks Ajmal ,
        I have tried using the avalible ports to my IP addres through netstat -a Command.
        However , getting the same Error of 5XX…..Also i have tried all the common ports which we use in tibco ,. but in all the cases it is returning this error.
        Please help.

        Reply
        1. naresg

          Just change the port it will work. 5XX code will come when the port is duplicated you need to kill it from back end or easy way is change the port and test it.

          Reply
  5. lavan

    Hi . I am new to tibco bw. I want to maintain a website using bw. suppose I have a userregistration.html page. I want to store the user registration details into database. After successful registration it will go to login. I create a http connection localhost with port 8080 but how can i specify the URL. like localhost:8080/userregistration.html. Where can I specify this URL? and please tell me how to maintain a total wobsite using bw. How can I receive multiple requests using the same http receiver?.

    Reply
  6. lav

    How can I receive parameters or request from a particular html page. localhost:8080/userregistration.html. for http connection we specify localhost and port number. But how to specify userregistration.html in http connection resource or in http receiver.

    Reply
  7. Aditya

    Sir, I am new to TIBCO and I am trying to do the following functionality:
    I enter a search tag in a textbox on an html page, on submitting the text, I want the user to be redirected to google.
    How can I implement this?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *