TLDR; I stopped using the HTTPSOut channel for its various problems. Now, I use the Send Web Service process.
In part 5, I had used the sample HTTPSOut channel from the MEC documentation, for MEC to make HTTPS requests, but it turned out to have a variety of problems.
Then, in a previous post I had explored the Send Web Service process for MEC to make SOAP requests, and I had realized it can be used for any content, not just for SOAP. I will explore that here.
Instead of HTTPSOut, use the Send Web Service process. It is easy to use: set the Service Endpoint to the desired URL, put whatever value in the SOAP Action (it will be ignored), set the Content type (e.g. text/plain, application/xml), select the checkbox if you want the response, and set the user/password if you need Basic authentication:
The process will use Java’s HttpsURLConnection and its default hostname verifier and certificate validation. If the URL endpoint uses a certificate that is not part of the MEC JRE truststore, you will have to add it with keytool import (see part 5).
In MEC, the processes are piped in order: the output of one process is the input of the next process. In my example, I send a message to my agreement, that goes through an XML Transform with my mapping, the output of that is sent to example.com, and the HTTP response of that is archived.
One problem with the Send Web Service is the URL, user, and password are hard-coded in the agreement, and I do not know how to un-hard-code them; I would like to use an external property instead.
We have many agreements, and several environments (e.g. DEV, EDU, TST, PRD) each with its URL, user, and password. When we migrate the agreements to the other environments, we have to manually update each value in each agreement, it is a maintenance nightmare.
As a workaround, I mass SQL UPDATE the values in MEC’s table PR_Process_Property:
SELECT REPLACE(PropValue, 'https://DEV:8082', 'https://TST:8083') FROM PR_Process_Property WHERE (PropKey='Service Endpoint') SELECT REPLACE(PropValue, 'john1', 'john2') FROM PR_Process_Property WHERE (PropKey='User') SELECT REPLACE(PropValue, 'password123', 'secret123') FROM PR_Process_Property WHERE (PropKey='Password')
Note: Use UPDATE instead of SELECT.
That is my new setup for MEC to do HTTPS outbound.
- HTTP channels in MEC (part 1) – HTTP in MEC
- HTTP channels in MEC (part 2) – HTTPIn
- HTTP channels in MEC (part 3) – HTTPSyncIn + HTTPSyncOut
- HTTP channels in MEC (part 4) – HTTPOut
- HTTP channels in MEC (part 5) – HTTPSOut + proxies
- HTTP channels in MEC (part 6) – HTTPS inbound
- HTTP channels in MEC (parts 3,6 bis) – HTTPS inbound re-visited
- HTTP channels in MEC (part 5 bis) – HTTPS outbound re-visited
- Calling SOAP web services from MEC