当前位置:网站首页>Sslhandshakeexception: no subject alternative names present - sslhandshakeexception: no subject alternative names present
Sslhandshakeexception: no subject alternative names present - sslhandshakeexception: no subject alternative names present
2022-06-24 21:36:00 【Bustling city 】
problem :
I am invoking HTTPS SOAP web service through java code. I passed java Code calls HTTPS SOAP Web service .I have already imported self-signed certificate in jre cacerts keystore. I am already in jre cacerts Self signed certificate imported in keystore .Now I am getting : Now I get :
com.sun.xml.internal.ws.com.client.ClientTransportException: HTTP transport error: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present
The hostname of the service URL is not matching that of the CN provided in cert. service URL The host name of the is the same as cert Provided in CN The hostname of does not match .I read about a workaround of defining a custom Hostname verifier here . I ad locum Read about how to define a custom hostname validator .But i cant able to make where I should implement the workaround in my code. But I can't implement the solution in my code .
public SOAPMessage invokeWS(WSBean bean) throws Exception { SOAPMessage response=null; try{ /** Create a service and add at least one port to it. **/ String targetNameSpace = bean.getTargetNameSpace(); String endpointUrl = bean.getEndpointUrl(); QName serviceName = new QName(targetNameSpace, bean.getServiceName()); QName portName = new QName(targetNameSpace, bean.getPortName()); String SOAPAction = bean.getSOAPAction(); HashMap<String, String> map = bean.getParameters(); Service service = Service.create(serviceName); service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointUrl); /** Create a Dispatch instance from a service. **/ Dispatch dispatch = service.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE); // The soapActionUri is set here. otherwise we get a error on .net based // services. dispatch.getRequestContext().put(Dispatch.SOAPACTION_USE_PROPERTY, new Boolean(true)); dispatch.getRequestContext().put(Dispatch.SOAPACTION_URI_PROPERTY, SOAPAction); /** Create SOAPMessage request. **/ // compose a request message MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage message = messageFactory.createMessage(); // Create objects for the message parts SOAPPart soapPart = message.getSOAPPart(); SOAPEnvelope envelope = soapPart.getEnvelope(); SOAPBody body = envelope.getBody(); SOAPElement bodyElement = body.addChildElement(bean.getInputMethod(), bean.getPrefix(), bean.getTargetNameSpace()); ...more code to form soap body goes here // Print request message.writeTo(System.out); // Save the message message.saveChanges(); response = (SOAPMessage)dispatch.invoke(message); } catch (Exception e) { log.error("Error in invokeSiebelWS :"+e); } return response;}
Please ignore WSBean parameter as the namespaces and other wsdl attributes are coming from this bean. Please ignore WSBean Parameters , Because of namespaces and other wsdl Attributes come from this bean.And if this exception can solved with some different workarounds, pls do suggest. If this exception can be solved by some different solutions , Please advise .
Solution :
Reference resources : https://stackoom.com/en/question/h2bF边栏推荐
- Handwritten RPC the next day -- review of some knowledge
- Kernel Debugging Tricks
- 关于Unity中的transform.InverseTransformPoint, transform.InverseTransofrmDirection
- Go coding specification
- data link layer
- 推荐模型之多任务模型:ESMM、MMOE
- 一文理解OpenStack网络
- 基于STM32的物联网下智能化养鱼鱼缸控制控制系统
- JMeter basic learning records
- PHP script calls command to get real-time output
猜你喜欢
About transform InverseTransformPoint, transform. InverseTransofrmDirection
CondaValueError: The target prefix is the base prefix. Aborting.
memcached全面剖析–5. memcached的应用和兼容程序
Docking of arkit and character creator animation curves
EditText controls the soft keyboard to search
一文理解OpenStack网络
(to be optimized and modified) vivado DDR4 SDRAM (MIG) (2.2) IP core learning record
Simple analysis of WordPress architecture
基于STM32的物联网下智能化养鱼鱼缸控制控制系统
虚拟货币7个月蒸发2万亿美元,“马斯克们”终结15万人暴富梦
随机推荐
Common self realization functions in C language development
Three more days
Interpretation of ebpf sockops code
Intelligent fish tank control system based on STM32 under Internet of things
Ebpf XDP mount point analysis
memcached全面剖析–2. 理解memcached的內存存儲
how to install clustershell
基于STM32的物联网下智能化养鱼鱼缸控制控制系统
TDengine可通过数据同步工具 DataX读写
Oauth1.0 introduction
Capture the whole process of accessing web pages through Wireshark
Docking of arkit and character creator animation curves
Blender's landscape
Functional analysis of ebpf tracepoint
Dynamic routing protocol rip, OSPF
Appium introduction and environment installation
一文理解OpenStack网络
Understanding openstack network
基于C语言实现的足球信息查询系统 课程报告+项目源码+演示PPT+项目截图
go_ keyword