cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
517
Views
0
Helpful
4
Replies
Cisco Employee

skip hostname validation in httpmethod

Hi,

I am working on a UCSD integration with a custom Web service using Rest API. The target rest server is running on IIS on windows 2012r2.

It has a selfsigned certificate generated for the computer host name. However the web service running on that server is published using a different host header (other than the hostname) and is only accessible via host header.

E.g hostheader : mylab

       hostname: my_lab.mydom.local

The api can be called  through postman after ignoring the ssl warnings. However, we are not able to make a successful connection via cloupia script. We used fiddler to capture the error and found that it is because of hostname mismatch. (we are calling the web service using host header but the certificate is assigned to hostname). We need help in bypassing the hostname validation since this is a lab environment.

Any help will be appreciated.

Following is a sample code we are using:

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------@@@@@@@@

var httpsClient = CustomEasySSLSocketFactory.getIgnoreSSLClient("vmclab","443");

    httpsClient.getParams().setCookiePolicy("default");

    httpsClient.getParams().setAuthenticationPreemptive(true);

    var tableURL = "/APP/APIs/VMName/VMName.php"

    var httpMethod = new PostMethod(tableURL);

     httpsClient.executeMethod(httpMethod);

    if (statuscode != 200)

    {

        logger.addError("Unable to get the sys_id from the Service Request HTTP response code: " + statuscode);

        logger.addError("Response = "+httpMethod.getResponseBodyAsString());

         httpMethod.releaseConnection();

        // Set this task as failed.

        ctxt.setFailed("Request failed.");

        ctxt.exit()

    } else {

        var responseBody = String(httpMethod.getResponseBodyAsString());

        //logger.addInfo("REST API Executed successfully, RAW result: " + responseBody);

        return responseBody;

    }

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

and

this is the exact error

java.lang.RuntimeException: java.net.SocketException: Connection reset, selectedContext=<None>

Everyone's tags (4)
1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: skip hostname validation in httpmethod

This problem was solved by changing the certificate on the REST target to match the hostname which were using in the cloupia script.

4 REPLIES 4
Cisco Employee

Re: skip hostname validation in httpmethod

I would use VIX or powershell to change your web service

Cisco Employee

Re: skip hostname validation in httpmethod

Hi Orf,

Thanks for your reply. The web service is hosted and maintained by customer and we do not have access to modify the same.

We just need a workaround time being to avoid hostname validation. I did search online for this and there seems to be a way to do this but I am unable to get exact syntax for this.

Thanks,

Vijay

Cisco Employee

Re: skip hostname validation in httpmethod

I am not sure how I can help you with an external system syntax problem.

Cisco Employee

Re: skip hostname validation in httpmethod

This problem was solved by changing the certificate on the REST target to match the hostname which were using in the cloupia script.

CreatePlease to create content
Content for Community-Ad
August's Community Spotlight Awards
This widget could not be displayed.