In my previous blog I showed you how to create a self signed certificate for your SSL api. you can watch the video at and read the blog here

In this blog I will be showing how you can use this certificate in mule ESB to create a https based api.

Screen Shot 2017-03-18 at 19.20.04

Adding certificate to project

Let’s add the certificate to our project src/main/resources folder, we will be using this to add TLS/SSL to our HTTP endpoint listener

Screen Shot 2017-03-18 at 19.18.27


As shown in the image, we have added the localserver.p12 to the project resources folder.

You can also create sub-folder and add your certificate to the sub-folder but make sure you use the proper location of certificate while adding it to the HTTP listener in your config file.




Using SSL for API

once you are done adding the certificate to your project resources, let’s drag and drop a HTTP listener to your mule config file and start configuring the listener and adding the certificate detail to your listener.

Screen Shot 2017-03-18 at 19.19.21

After adding the certificate detail to your listener add a set payload to get the response in your browser.

Screen Shot 2017-03-18 at 20.11.09We will be calling our API at URL


When you call the above url in your browser, be aware that you will be welcomed with a error message/warning by the browser saying

Your Connection is not Private

Various browser may use different words but the root cause is same, the root cause is that the certificate you are using is not certified by a CA, you can read more about CA

Screen Shot 2017-03-18 at 20.18.49

To overcome this error you can go to advance and add the exception to your browser and than refresh the page and you will be able to see the response from the api.

Screen Shot 2017-03-18 at 20.19.10

one done below will be the output.

Screen Shot 2017-03-18 at 20.19.16

With this you can see how to add HTTPS to you API in mule esb.

Video []