Cxf HTTPS客户端示例

时间:2010-05-10 15:31:21

标签: java https client cxf

我需要一个可以处理HTTPS wsdl url的Cxf客户端。 cxf文档不是很大,所以我希望得到一些帮助。

有什么我想要的例子吗?谷歌今天不是我的朋友:(

帮助我帮助我。


EDIT1: 我只是不知道该怎么做。 当我尝试:

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");

我有错误:

 Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could not find conduit initiator for transport 

EDIT2:

with:

factory.setWsdlURL

我有错误:

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:

我创建了一个密钥库并添加了证书,然后我设置了属性:

System.setProperty("javax.net.ssl.trustStore", "myKeyStore");
System.setProperty("javax.net.ssl.trustStorePassword", "password");

但现在错误是线程“main”org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {http://unknown.namespace/}

中的异常

我看到控制台说:reating Service {http://unknown.namespace/}

也许我忘记了什么。


EDIT4:很多新闻:

似乎https不再是问题。 但我仍然需要帮助:))

所以这里有这段代码:

JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance();
        Client client = factory.createClient("https://url/services?wsdl");
Object[] res = client.invoke("getSomething", "param");

我有错误:

Caused by: org.xml.sax.SAXParseException: Both jaxb:version and version are present

另一个代码:

ClientProxyFactoryBean

=>一些错误

with:JaxWsProxyFactoryBean + setWsdlURL

Could not find definition for service {http://unknown.namespace/}DPDataServiceService.

0 个答案:

没有答案