On the client side i have the following spring bean:
<bean id="partneriLogicImpl" class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
<property name="serviceUrl" value="http://localhost:8080/hr.spi.service/hessian/lcspi/lczaj/partneri" />
<property name="serviceInterface" value="hr.spi.logic.lcspi.lczaj.PartneriLogic" />
</bean>
And I'm calling the Hessian web service with:
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContextHessian.xml");
PartneriLogic partneriLogic = (PartneriLogic) context.getBean("partneriLogicImpl");
List<?> partnerList = partneriLogic.dohvatiSveZaExport();
This works just fine until I turn on Spring Security on the server side, after which I get the expected error - "Server returned HTTP response code: 403".
So, how do I configure the username and password on the client side?
According to the API Doc, org.springframework.remoting.caucho.HessianProxyFactoryBean provides two setter method for HTTP basic authentication by default:
Set the username that this factory should use to access the remote service. Default is none.
The username will be sent by Hessian via HTTP Basic Authentication.
Set the password that this factory should use to access the remote service. Default is none.
The password will be sent by Hessian via HTTP Basic Authentication.
how do I configure the username and password on the client side?
In your applicationContext.xml, define your HessianProxyFactoryBean like so:
<bean id="partneriLogicImpl" class="org.springframework.remoting.caucho.HessianProxyFactoryBean">
<property name="serviceUrl" value="http://localhost:8080/hr.spi.service/hessian/lcspi/lczaj/partneri" />
<property name="serviceInterface" value="hr.spi.logic.lcspi.lczaj.PartneriLogic" />
<property name="username" value="${username}" />
<property name="password" value="${password}" />
</bean>