I recently worked on a Hybris Commerce implementation where the DevOps role was managed by an external, cloud service provider. In this externally managed DevOps situation, the Hybris development team were prevented from accessing the production Linux servers directly, and only the external DevOps team had direct access to the production servers. Sound familiar?
This Hybris implementation, like most Hybris implementations, included third-party integrations to payment and tax web services. Each third-party integration's IP address or domain had to be whitelisted by the external DevOps team before the Hybris Commerce platform was able to connect with the third-party service successfully. On-premise services also had to be whitelisted.
During the initial production deployment, there were quite a few testy moments as connectivity to the third-party services were not working properly, and the Hybris development team were unable to properly validate the third-party connectivity themselves. If you or your Hybris development team found themselves in a similar externally managed DevOps situation, how would you validate third-party connectivity without SSH access to the production servers? In this tutorial, I will show you how to validate outbound connections to third-party e-commerce solutions using HAC.
- CURL is installed on your machine, and is accessible by the command line
Step by Step Instructions
1. Goto to Hybris HAC in your Web browser. (On your local machine, type https://localhost:9002/ in your Web browser URL)
2. Type your user name and password once HAC is displayed. (The following screenshot displays the HAC login page with username and password provided)
3. Once you've logged in successfully, click on Console -> Scripting Languages
4. Copy and paste the following code into the Console window:
/* testing access to PayPal's API Sandbox */
def url = 'https://api-3t.sandbox.paypal.com/2.0/';
/* using curl with a 60 second connection timeout to test the connection
to PayPal's API Sandbox */
def curlCommand = "curl --connect-timeout 60 " + url;
/* execute the curl comand **/
def proc = curlCommand.execute();
def outputStream = new StringBuffer();
/* the curl command may take some time to execute,
use the waitForProcessOutput to wait for the response **/
/* print the output to the console **/
Your HAC Console should resemble the following:
5. Click on the Execute button
6. Next, click on the Output tab, you should see the following CURL output:
The Console output window contains the standard CURL ouput, and response. This CURL response provides the details whether your Hybris server connected with the third-party service successfully.
Note: If your Hybris server was unable to connect with the third-party service correctly, you would have received a url: (6) Couldn't resolve host message
7. Tutorial is complete, now you know how to validate outbound connections to third-party e-commerce solutions using HAC.