RESTFUL web service with server certificate using UHTTP
Author: firstname.lastname@example.org (fearandir)
Good morning everyone. Currently, we are working with a bunch of restful web services that NOW are implemented over a secure, encrypted HTTPS connection using a SERVER SIDE certificate. Not client certificate required. The authentication is made, providing the user and password inside the SOP header. You can see the encoded user and pass:
newinstance "UHTTP", VUHTTP getitem/id VS_URL, PSI_IN, "ENDPOINT" VSSECURITY = $encode("BASE64","%%VS_USER:%%VS_PASS") putitem/id PSO_HEAD, "Authorization", "%%VS_AUTH %%VSSECURITY" PNO_STATUS = VUHTTP->Send(VS_URL,"GET","","",PSO_HEAD,PSO_BODY,PSO_RESP)
I got a funny $STATUS=0. The SEND help page do not cover this returned status... So i followed the secure https connections guideline:
Add the certificate information into a file called ca-bundle.crt
Put this file in the Uniface \usys folder.
And downloaded the CURL manual. Inside the manual the -H and -d parameters are specified.
- The “-d” option allows us to pass data to the remote server
- The “-H” option allows you to add an HTTP header to the request.
So... Maybe the Uniface CURL implementation do not includes this feature? Thanks in advance, Sergio