Creating a JBossWS CXF client using HTTPS WSDL url triggers "Failed to create service." exception
slbanal May 2, 2013 7:21 PMHi,
I am currently developing a web service which uses HTTPS with WS-Security (Authentication/Signing) support. The client works using normal HTTP wsdl URL while using https causes the client to throw exception below.
I was able to test service https WSDL URL by using a browser and by using JaxWsProxyFactoryBean API to create the client (essentially just to avoid the Service.create(...) call), setting TLSClientParameters in http-conduit and it works fine. But, when https is used as WSDL url in the client it throws an exception.
- HTTPS tests works using a browser. Firefox prompts me to add the certificate in exception list when I browse HTTPS WSDL url. i believe because I am using a self-signed certificate. So, I assumed it is working fine.
- HTTPS works using JaxWsProxyFactoryBean but without WS-Security policy in WSDL. Fails to work if WS-Security (Authentication/Signing) is enabled since client is not adding the appropriate headers/certificate tokens in the SOAP request.
- WS-Security without HTTPS works using Service.create(wsdlUrl, serviceQName). Integration of HTTPS doesn't work due to exception thrown during create call. Stack trace below.
Is there a configuration i have to enable/code for the CXF Bus for this to work? I saw a similar issue posted here: http://stackoverflow.com/questions/15755293/apache-cxf-wsdl-download-via-ssl-tls?rq=1 but I am somewhat hesitant on using such a solution that adds a custom ResourceResolver
in ResourceManager
of CXF Bus.
Stacktrace exception:
javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:149)
at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:98)
at javax.xml.ws.Service.<init>(Service.java:56)
at javax.xml.ws.Service.create(Service.java:680)
...
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:94)
at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:203)
at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)
... 22 more
..... handshake error