Cxf HTTPS client example
I need a Cxf client which can deal with HTTPS wsdl url. The cxf documentation isn't really big, so i would appreciate some help.
Is there any example of what i want ? google isn't my friend today :(
Thx for helping me.
EDIT1: I just don't know how to do this. When i try :
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setAddress("https://mysite/view/ext-services/dpDataService?wsdl");
factory.setServiceClass(DPDataService.class);
DPDataService client = (DPDataService) factory.create();
client.getAllHostServiceMetric("1", "1");
I have the error :
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could not find conduit initiator for transport
EDIt2:
with :
factory.setWsdlURL
i have the error :
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
EDIt3:
I create a keystore and add the certificate, then i set the property:
System.setProperty("javax.net.ssl.trustStore", "myKeyStore");
System.setProperty("javax.net.ssl.trustStorePassword", "password");
But now the error is Exception in thread "main" org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for se开发者_如何学Crvice {http://unknown.namespace/}
i see that the console say : reating Service {http://unknown.namespace/}
maybe i forgot something.
EDIT4 : Many news :
It seems that the https is no longer a problem. but i still need help :)
So here with this code :
JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance();
Client client = factory.createClient("https://url/services?wsdl");
Object[] res = client.invoke("getSomething", "param");
I have the error :
Caused by: org.xml.sax.SAXParseException: Both jaxb:version and version are present
Another code :
ClientProxyFactoryBean
=> some error
with : JaxWsProxyFactoryBean + setWsdlURL
Could not find definition for service {http://unknown.namespace/}DPDataServiceService.
精彩评论