You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "C. Manchet" <ce...@orange-ftgroup.com> on 2008/12/09 17:54:40 UTC

How to configure HTTP conduit when using JaxWsProxyFactory and Spring injection for WS client creation ?

I configure functionality as SSL or HTTP keep-alive for my Webservice client
in a a cxf.xml file placing in the classpath :
	  <http:conduit name="{urn:Securite}SecuriteSOAP11port.http-conduit">
	      <http:tlsClientParameters secureSocketProtocol="SSL">	     	  
	        <sec:trustManagers>
	          <sec:keyStore type="JKS" password="xxxxxx"
	               file="E:/temp/key/yyyyyy.jks"/>
	        </sec:trustManagers>
	      ...


I use an other Spring context application file where I create a client bean
from my service interface via the JaxWsProxyFactory bean. But the HTTP
conduit configuration is not loaded.

It works if a use the API on the proxy, but It's complex and the Spring
injection is less interesting in this case. Example :
		String[] configLocations = {"classpath:beans.xml"};
		ApplicationContext applicationContext = new
FileSystemXmlApplicationContext( configLocations);
		MyPortType portType =
(MyPortType)applicationContext.getBean("myPortTypeProxy");
		Client client = ClientProxy.getClient(portType);
		HTTPConduit httpConduit = (HTTPConduit) client.getConduit();

		TLSClientParameters tlsParams = new TLSClientParameters();
		httpConduit.setTlsClientParameters(tlsParams);
		    
		String keystorePassword = "xxxxx";		    
		File truststore = new File("yyyy.jks");
		KeyStore keyStore = KeyStore.getInstance("JKS");
		keyStore.load(new FileInputStream(truststore),
keystorePassword.toCharArray()); 
    
		TrustManagerFactory trustFactory = 
		  
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); 
		trustFactory.init(keyStore); 
		TrustManager[] tm = trustFactory.getTrustManagers();
		tlsParams.setTrustManagers(tm); 
		...


Is there an other solution ?
-- 
View this message in context: http://www.nabble.com/How-to-configure-HTTP-conduit-when-using-JaxWsProxyFactory-and-Spring-injection-for-WS-client-creation---tp20918677p20918677.html
Sent from the cxf-user mailing list archive at Nabble.com.