I am trying to consume SSL secured Spring/Java Hessian Service.
Problem: No where I could find an example how can I setup SSL to pass my client certificate :(
Any help here is most appreciated.
Server Setup
@Bean(name = "/booking")
RemoteExporter bookingService() {
HessianServiceExporter exporter = new HessianServiceExporter();
exporter.setService(new CabBookingServiceImpl());
exporter.setServiceInterface( CabBookingService.class );
return exporter;
}
Client Setup
@Configuration
public class HessianClient {
@Bean
public HessianProxyFactoryBean hessianInvoker() {
HessianProxyFactoryBean invoker = new HessianProxyFactoryBean();
invoker.setServiceUrl("https://super.server/booking");
invoker.setServiceInterface(CabBookingService.class);
return invoker;
}
}
decided on runtime
based on System.property. Following is the sample code from HessianProxyFactory.classClass HessianProxyFactory{
protected HessianConnectionFactory createHessianConnectionFactory(){
String className= System.getProperty(HessianConnectionFactory.class.getName());
HessianConnectionFactory factory = null;
try {
if (className != null) {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Class<?> cl = Class.forName(className, false, loader);
factory = (HessianConnectionFactory) cl.newInstance();
return factory;
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return new HessianURLConnectionFactory();
}
}