Highlighted
Valued Contributor.. Valued Contributor..
Valued Contributor..
741 views

How to consume REST api over SSL connection

Jump to solution

Hi experts,

 I have a case where i need to consume a restful api web service from within SM over a https connection, i tried to use doHTTPRequest but i faced the following error 


Process panel process.option in RAD display encountered error in line 1 (display,process.option)
Cannot evaluate expression (display,process.option)
Cannot evaluate expression (display,process.option)
Cannot evaluate expression (display,process.option)
Bad arg(2) oper = (display,process.option)
Cannot evaluate expression (display,process.option)
Cannot evaluate expression (display,process.option)
Bad arg(2) oper = (display,process.option)
Cannot evaluate expression (display,process.option)
Script line 0: ERROR uncaught exception: Error: Error calling method: doHttpRequest in class: com/hp/ov/sm/server/utility/HttpClient Exceptio
n (java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.securi
ty.ssl.SSLContextImpl$DefaultSSLContext)) at char 1
Error calling method: doHttpRequest in class: com/hp/ov/sm/server/utility/HttpClient Exception (java.net.SocketException: java.security.NoSuchAlgorithmExceptio
n: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext))

I used the following code to fulfill the requirement:
function SMAnsibleInteg()
{
var cRequestUrl="https://xxxxxxxxxxxxxxx";
var httpHeaders = new Array();
httpHeaders = lib.smis_RestClient.createBasicAuthHttpHeaders("en","Username","Password");
//var Headers = getRequestHeader(); .
var rawJSON = lib.smis_RestClient.doRESTGetRequest(cRequestUrl, httpHeaders);
print("Result " + rawJSON );//var rcRequest = doHTTPRequest("GET", cRequestUrl, httpHeaders, null,10,10);
//print(HTTPRequest);
}

Appreciate your help regarding this case. 

the integration here is between Windows (SM Server) & Linux REDHAT (Ansible) over secured connection using doHTTPRequest

Labels (1)
Tags (1)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: How to consume REST api over SSL connection

Jump to solution

Hello Mohamed,
Thanks for your question.

I am not sure which SM version you have in your environment, but I am sharing you the Web Services Guide so you can learn how to consume REST using SSL.

Please find it attached to my reply.

BR!

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution. If you are satisfied with anyone’s response please remember to give them a LIKE by clicking on the Thumb and show your appreciation.

View solution in original post

0 Likes
1 Reply
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: How to consume REST api over SSL connection

Jump to solution

Hello Mohamed,
Thanks for your question.

I am not sure which SM version you have in your environment, but I am sharing you the Web Services Guide so you can learn how to consume REST using SSL.

Please find it attached to my reply.

BR!

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution. If you are satisfied with anyone’s response please remember to give them a LIKE by clicking on the Thumb and show your appreciation.

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.