Highlighted
Established Member..
Established Member..
391 views

Testing RestAPI with WebHTTP - problem with SSL

Jump to solution

Hello,

 

I am trying to run a very simple test using the WebHTTP protocol to send an XML message to an API.  The test itself is working correctly when run against a URL that is not using SSL.  However, when running against the URL which *is* using SSL, I am getting the following error message:

 

Error -27774: Server "[my server name]" shut connection during attempt to negotiate SSL session

 

This test was created manually, without recording anything.  I have tried getting the PEM certificate and including it in the test, in both the "Recording Settings" dialog, as well as using web_set_certificate_ex function in the test. 

 

Here is my code:

 

Action()
{
    lr_start_transaction("001 Do Something");
    
    web_set_certificate_ex("CertFilePath=certFile.pem",
        "CertFormat=PEM",
        "KeyFilePath=certFile.pem",
        "KeyFormat=PEM",
        "CertIndex=1",
        LAST);
    
    web_add_header("Accept", "application/xml");
    web_add_header("source-id", "234");
    web_add_header("Content-Type", "application/xml");
    
    web_custom_request("Custom Request",
        "URL={url}/api/v1/productName/productFunction",
        "Method=POST",
        "Resource=0",
        "EncType=application/xml",
        "Mode=HTTP",
        "Body=[xmlMessageHere]",
        LAST); 
    
    lr_end_transaction("001 Do Something",LR_AUTO);
    
    return 0;
}

0 Likes
1 Solution

Accepted Solutions
Highlighted
Established Member..
Established Member..

Re: Testing RestAPI with WebHTTP - problem with SSL

Jump to solution

Hello,

 

I solved my own problem.  I added web_set_sockets_option("SSL_VERSION","TLS"); to the vuser_init() section and moved the web_set_certificate_ex to the vuser_init() section and now the test is running correctly.

 

Thanks!

Damien

View solution in original post

0 Likes
1 Reply
Highlighted
Established Member..
Established Member..

Re: Testing RestAPI with WebHTTP - problem with SSL

Jump to solution

Hello,

 

I solved my own problem.  I added web_set_sockets_option("SSL_VERSION","TLS"); to the vuser_init() section and moved the web_set_certificate_ex to the vuser_init() section and now the test is running correctly.

 

Thanks!

Damien

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.