07-01-2017 09:42 AM - edited 03-01-2019 06:25 AM
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>
Solved! Go to Solution.
07-14-2017 07:47 PM
This problem was solved by changing the certificate on the REST target to match the hostname which were using in the cloupia script.
07-01-2017 10:07 AM
I would use VIX or powershell to change your web service
07-01-2017 06:51 PM
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
07-03-2017 04:20 AM
I am not sure how I can help you with an external system syntax problem.
07-14-2017 07:47 PM
This problem was solved by changing the certificate on the REST target to match the hostname which were using in the cloupia script.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide