cxf accept the one-way server-side SSL authentication
Advertisements
http://old.nabble.com/jaxws-ssl-client-that-accepts-all-certificates-td16826257.html
http://cwiki.apache.org/CXF20DOC/client-http-transport-including-ssl-support.html
The first is the official wiki, this certification process to add structure and detail through the configuration of the CXF support for SSL
The second parameter to which this configuration
package com.cxf.client;
import java.util.Iterator;
import java.util.List;
import javax.net.ssl.TrustManager;
import javax.xml.namespace.QName;
import org.apache.cxf.configuration.jsse.TLSClientParameters;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.transport.http.HTTPConduit;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public final class Client {
private Client() {
}
public static void main(String args[]) throws Exception {
ClassPathXmlApplicationContext context
= new ClassPathXmlApplicationContext(new String[] {"com/cxf/client/client-beans.xml"});
ICardInfoWebService client = (ICardInfoWebService)context.getBean("client");
//-------------------------------------------------------
org.apache.cxf.endpoint.Client proxy = ClientProxy.getClient(client);
HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
TLSClientParameters tls= new TLSClientParameters();
tls.setTrustManagers( new TrustManager[]{ new TrustAllX509TrustManager()});
tcp.setDisableCNCheck(true);// Accept the server-side authentication
conduit.setTlsClientParameters(tcp);
//-------------------------------------------------------
List<TxnDtlAccountVo> list = client.findTxnDtlAccountInfo(txnDtlAccountVo);
}
}
Configuration file com / cxf / client / client-beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- START SNIPPET: beans -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd">
<bean
factory-bean="clientFactory" factory-method="create"/>
<bean>
<property name="serviceClass" value="com.cxf.client.ICardInfoWebService"/>
<property name="address" value="https://127.0.0.1:8443/manage/services/myWebService"/>
</bean>
</beans>
Related Posts of cxf accept the one-way server-side SSL authentication
-
Servlet brief introduction
Servlet brief introduction: Servlet is a small application server Are used to complete the B / S architecture, the client requests the response to treatment Platform independence, performance, able to run thread Servlet API for Servlet provides the s ...
-
First Hibernate Example
Curd a simple example. Source does not contain the dependent libraries, or playing too much of the package. PO object Note: One must have the default constructor 2 non-final modified. Otherwise useless lazy loading. UserDAOImpl category code, and other co
-
Spring2.0 + hibernate3.1 + log4j + mysql demo
applicationContext.xml Non-attachment jar package, necessary friends can send an email to todd.liangt @ gmail.com
-
Struts2 + hibernate + spring problem user log in
dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q












