在能运行的spingmvc下进行配置
1、web.xml
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>*.*</url-pattern>
</servlet-mapping>
2、spring-servlet.xml
<!-- hessian -->
<bean id="httpRequestHandlerAdapter" class="org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter"/>
<bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"/>
<bean id="ccWService" class="com.cloudcc.ccwebsvc.CCWServiceImpl"/>
<bean name="/ccwservice" class="org.springframework.remoting.caucho.HessianServiceExporter">
<property name="service" ref="ccWService"/>
<property name="serviceInterface" value="com.cloudcc.ccwebsvc.CCWService"/>
</bean>
3、pom.xml;
<dependency>
<groupId>com.caucho</groupId>
<artifactId>hessian</artifactId>
<version>4.0.7</version>
</dependency>
提示:
HTTP Status 405 - HessianServiceExporter only supports POST requests
则表示配置成功。5、调用:
try{
String url = "http://localhost:8080/cloudcc_global_service/ccwservice";
HessianProxyFactory factory = new HessianProxyFactory();
CCWService cCWService = (CCWService) factory.create(CCWService.class,url);
cCWService.checkOrgEnterLogs();
}catch (Exception e) {
log.error("执行今日登录校准检查出现异常:"+e.getMessage());
e.printStackTrace();
}