Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Cxf HTTPS客户端示例_Java_Https_Client_Cxf - Fatal编程技术网

Java Cxf HTTPS客户端示例

Java Cxf HTTPS客户端示例,java,https,client,cxf,Java,Https,Client,Cxf,我需要一个Cxf客户端,它可以处理HTTPS wsdl url。 cxf文档不是很大,所以我希望能得到一些帮助 有我想要的例子吗?谷歌今天不是我的朋友:( 谢谢你帮我 编辑1: 我只是不知道怎么做。 当我尝试时: JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setAddress("https://mysite/view/ext-services/dpDataService?wsdl"); factor

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

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

谢谢你帮我


编辑1: 我只是不知道怎么做。 当我尝试时:

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 
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
Caused by: org.xml.sax.SAXParseException: Both jaxb:version and version are present

编辑2:

与:

factory.setWsdlURL

Could not find definition for service {http://unknown.namespace/}DPDataServiceService.
我有一个错误:

 Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could not find conduit initiator for transport 
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
Caused by: org.xml.sax.SAXParseException: Both jaxb:version and version are present

编辑3:

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

System.setProperty("javax.net.ssl.trustStore", "myKeyStore");
System.setProperty("javax.net.ssl.trustStorePassword", "password");
但现在,线程“main”
org.apache.cxf.service.factory.ServiceConstructionException中出现异常:找不到服务的定义{http://unknown.namespace/}

我看到控制台显示:创建服务{}

也许我忘了什么


编辑4:许多新闻:

看来https不再是一个问题。 但我仍然需要帮助:)

因此,以下代码:

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

 Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could not find conduit initiator for transport 
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
Caused by: org.xml.sax.SAXParseException: Both jaxb:version and version are present
另一个代码:

ClientProxyFactoryBean
=>一些错误

使用:
JaxWsProxyFactoryBean+setWsdlURL

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

在CXF中使用HTTP和SSL(HTTPS)的方式应该与使用HTTP的方式相同。有什么特别的东西不适合你吗?有了更多的经验,这似乎是ws-security,但我没有解决它。Sopaui工作得很好…:(