Announcement Announcement Module
Collapse
No announcement yet.
Need help in integrate XFire 1.26 and Spring 2.5 using jsr181 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help in integrate XFire 1.26 and Spring 2.5 using jsr181

    Hi there,

    I want to integrate XFire 1.26 and Spring 2.5 using jsr181 to definite web services

    Below is my work:

    Endpoint interface:

    Code:
    @WebService(targetNamespace = "http://dtkb.kbnn.vn/hethong/services")
    @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.BARE)
    public interface HeThongWs {
    	@WebMethod(operationName = "login")
    	@WebResult(name = "UserResponse")
    	public User login(@WebParam(name = "UserRequest") User _user);
    }
    Implement class (hiding some services from base service class):

    Code:
    @WebService(serviceName = "services/HeThongService", targetNamespace = "http://dtkb.kbnn.vn/hethong/services", endpointInterface = "vn.kbnn.dtkb.hethong.services.HeThongWs")
    public class HeThongWsImpl implements HeThongWs {
    	private HeThongService heThongService;
    	
    	public HeThongWsImpl() {}
    	
    	public HeThongWsImpl(HeThongService _heThongService) {
    		this.heThongService = _heThongService;
    	}
    
    	public User login(User _user) {
    		return this.heThongService.login(_user);
    	}
    }
    web.xml:

    Code:
    <context-param>
       	<param-name>contextConfigLocation</param-name>
       		<param-value>
       			/WEB-INF/applicationContext.xml
       		</param-value>
    	</context-param> 
      	 	
      	<!-- listerners -->    
    	<listener>
    		<listener-class>vn.kbnn.dtkb.web.ContextLoaderListener</listener-class>
    	</listener>
    		
      	<!-- servlets -->
      	<servlet>
        	<servlet-name>ws</servlet-name>
        	<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        	<load-on-startup>1</load-on-startup>
      	</servlet>
    
      	<servlet-mapping>
        	<servlet-name>ws</servlet-name>
        	<url-pattern>/services/*</url-pattern>
      	</servlet-mapping>
    ws-servlet.xml:

    Code:
    	<import resource="classpath:org/codehaus/xfire/spring/xfire.xml" />
    
    	<!-- config annotation -->
     	<bean id="webAnnotations" class="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations" lazy-init="false" />
     	
     	<bean id="handlerMapping" class="org.codehaus.xfire.spring.remoting.Jsr181HandlerMapping" lazy-init="false">
            <property name="typeMappingRegistry">
                <ref bean="xfire.typeMappingRegistry" />
            </property>
            <property name="xfire">
            	<ref bean="xfire" />
            </property>
           	<property name="webAnnotations">
                <ref bean="webAnnotations" />
           	</property>
           	<property name="urlPrefix" value="/" />
     	</bean>
    
    <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    		<property name="urlMap">
    			<map>
    				<entry key="/">
    					<ref bean="handlerMapping"/>
    				</entry>
    			</map>
    		</property>
    	</bean>
    
     	<bean name="heThongWs" class="vn.kbnn.dtkb.hethong.services.HeThongWsImpl">
    		<constructor-arg ref="heThongService"/>	
     	</bean>
    applicationContext.xml:
    Code:
    	<bean name="heThongService"
    		class="vn.kbnn.dtkb.hethong.services.HeThongServiceImpl">
    		<property name="heThongDao" ref="heThongDao" />
    	</bean>
    My problem is:

    When ApplicationContext init, it injected class HeThongService to class HeThongWsImpl already but when client call http://localhost:8080/DTKB2/services/HeThongWs?wsdl the HeThongWsImpl class is called but its heThongService is null. Seem the handler create new class instead of look from ApplicationContext.

    Do I miss a step???

    What is exact behind the scene (what is controller class which handler request, what class handler request and call web service implement class)???

    I can do other solution by making HeThongWsImpl implement implements ApplicationContextAware then getBean("heThongService") but this way is a unmanaged beans solution.

    Please help me!!!

    Thanks you

  • #2
    This is the forum for the Spring Integration project rather than integration of project X with Spring. You might be more successful in the web forum or on the XFire user list.

    Comment

    Working...
    X