Spring HttpInvokerProxyFactoryBean 远程调用示例

Spring    HTTP  远程调用

 

A. 提供服务的应用

 

web.xml  文件中:

 <servlet>
  <servlet-name>remote</servlet-name>
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  <load-on-startup>5</load-on-startup>
 </servlet>
 <servlet-mapping>
     <servlet-name>remote</servlet-name>
     <url-pattern>/remote/*</url-pattern>
   </servlet-mapping>

 

 remote-servlet.xml 文件中

<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

 <bean name="/SsoService"      class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
        <property name="service"><ref bean="ssoService"/></property>
        <property name="serviceInterface">
            <value>com.openid.security.service.SsoService</value>
        </property>
 </bean>
</beans>

 

B.调用服务的应用

 

 <bean id="ssoService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
  <property name="serviceUrl">
   <value>http://192.168.0.18:8000/security/remote/SsoService</value>
  </property>
  <property name="serviceInterface">
   <value>com.openid.security.service.SsoService</value>
  </property>
 </bean>

 

 

你可能感兴趣的:(spring,bean,xml,servlet,Security)