Skip to Content

If you are new to HCI, one of the things you will learn is that tracing the outgoing message or produced payload of the integration may be a little tricky. HCI provides you with a few connectors you can select from for Incoming and Outgoing channels (such as SFTP, HTTPS,etc.), but if you missing any of the items required to set these up (like certificates) it is hard to get started quickly.

In this blog I will describe how to create a super lightweight “web listener” using PHP (server side programming language) to as an additional tool to have available during development. We will make this end point record into a file any information posted to it. It will also have the capability to display the information back as a response in order to test response case scenarios.

We will make this web listener run on HTTP rather than HTTPS to make sure certificate is not required. We will also make sure it does not require any authentication.

Pre-requisites:

  • Access to a web server hosting with a folder exposed to the internet
  • web server must support PHP

Steps to create the web listener:

1) Open the text editor of your choice (such as notepad++) and create a file called: show.php

2) Enter the following lines of code into the file and save.

phpweblistener1.JPG

3) Upload (FTP) this file into the web hosting server you have access to.

You may end up with a page such as http://www.yourhosting.com/myfolder/show.php This URL will be your end point.


4) You are done!

Testing the web listener:

Use SoapUI or any other software that allows you to quickly post information to an endpoint. The screenshot below is for “Advanced Rest Client Application” plugin for Chrome.

phpweblistener2.JPG

As you can see, the output responds with the same information that was used for the POST method of the payload section.

You may also use the following options to turn off displaying and/or saving into a file.

http://www.yourhosting.com/myfolder/show.php&noshow

http://www.yourhosting.com/myfolder/show.php&nosave

Using the Web listener in HCI:

Once you have tested that the end point is functioning, you may use it in HCI as your HTTP channel.

phpweblistener3.JPG

Go to your Adapter Type options and select HTTP.

phpweblistener4.JPG

Go to the Adapter Specific settings and enter your end point. Select POST and authentication None.

phpweblistener5.JPG

Now run your integration and see how the payload gets posted into this channel. As a result, a new .txt file is created on the server with the payload!

Connect via FTP to see the files created.


phpweblistener6.JPG

And that concludes this tutorial of how to create a lightweight web listener/ end point for HCI. I hope you find it useful. If you have any questions don’t hesitate to contact me. Enjoy!

Disclaimer: This script is to be use in development environments only, it is not intended for production environments and any script that generates a file into the webserver needs to be used with caution as it has risk of Cross-site scripting (XSS) attacks.

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply