I am trying to access a WSDL with the java application located at https://www.example.com:5242/calculator/calculatorport?wsdl but getting the above mentioned Error. But when i enter the same URL in the browser i am able to access the WSDL .
Full stacktrace follows:-
javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://www.example.com:5242/calculator/calculatorport?wsdl. It failed with:
HTTPS hostname wrong: should be <www.example.com>.
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:163)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:145)
at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:267)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:230)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:178)
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:93)
at javax.xml.ws.Service.<init>(Service.java:67)
at com.webservices.calculator.CalculatorService.<init>(CalculatorService.java:46)
at com.testcl.Transfer.calculate(Transfer.java:118)
at com.testcl.Transfer.run(Transfer.java:213)
at java.lang.Thread.run(Thread.java:738)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:908)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:931)
at java.lang.Thread.run(Thread.java:738)
Caused by: java.io.IOException: HTTPS hostname wrong: should be <www.example.com>
at com.ibm.net.ssl.www2.protocol.https.c.b(c.java:69)
at com.ibm.net.ssl.www2.protocol.https.c.afterConnect(c.java:148)
at com.ibm.net.ssl.www2.protocol.https.d.connect(d.java:12)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1207)
at com.ibm.net.ssl.www2.protocol.https.b.getInputStream(b.java:32)
at java.net.URL.openStream(URL.java:1022)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:805)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:263)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:130)
What could be the issue ,Any help would be appreciated.
EDIT:
The solution mentioned in the similar question is invalid in my case as the Certificate issued is of the CN www.example.com
only.