Announcement Announcement Module
Collapse
No announcement yet.
full blown spring-web services tutorial Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #2
    For HttpInvoker,

    At Server Side
    1. Put the following in web.xml
    Code:
    	<servlet>
    		<servlet-name>remoting</servlet-name>
    		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    		<load-on-startup>3</load-on-startup>
    	</servlet>	
    	<servlet-mapping>
    		<servlet-name>remoting</servlet-name>
    		<url-pattern>/remoting/*</url-pattern>
    	</servlet-mapping>
    2. Create your service
    - create the interface (e.g. UserService)
    - create the implementing class (e.g. UserServiceImpl)

    3. Export your service (define it WEB-INF/remoting-servlet.xml)
    Code:
    	<!-- ******************************************** -->
    	<!-- User                                         -->
    	<!-- ******************************************** -->
    	<bean name="/UserService-httpinvoker" class="org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter">
    		<property name="service"><ref bean="userService"/></property>
    		<property name="serviceInterface">
    			<value>com.wms.valueobjects.users.UserService</value>
    		</property>
    	</bean>
    At client side
    Code:
    	<bean id="userService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
    		<property name="serviceUrl">
    			<value>https&#58;//localhost&#58;8443/wms/remoting/UserService-httpinvoker</value>
    		</property>
    		<property name="serviceInterface">
    			<value>com.wms.valueobjects.users.UserService</value>
    		</property>
    		<property name="httpInvokerRequestExecutor">
    			<bean class="org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor"/>
    		</property>			
    	</bean>
    To use simply
    Code:
    UserService service = &#40;UserService&#41;context.getBean&#40;"userService"&#41;;
    service.findUser&#40;new Integer&#40;5&#41;&#41;;
    ...
    cheers

    Comment


    • #3
      Hello,

      Can you post a code example where the client side does not use Spring?

      Thanks.

      Comment

      Working...
      X