Announcement Announcement Module
Collapse
No announcement yet.
XFire Client via Spring Remoting Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • XFire Client via Spring Remoting

    I have a couple web applications which expose same web service
    (Xfire). Now I am writing an application which will utilize those web
    services. I use Spring framework to build that application and here is
    the problem.

    If, within my controller I call my method getClientTest() - everything
    works fine: I am able to invoke my service.
    Code:
    private void getClientTest() {
                   logger.debug("Entering getClient()");
                   XFireClientFactoryBean client = new XFireClientFactoryBean();
                   try{
                       client.setServiceClass(Class.forName("com.roh.oculus.ws.xfire.FederatedService"));
                       logger.debug("Instance of class loaded.");
                       client.setWsdlDocumentUrl("http://192.168.0.174:8080/Oculus5/services/FederatedService?wsdl");
                       logger.debug("WSDL document obtained");
                       client.afterPropertiesSet();
                       logger.debug("after properties are set");
                       client.getObject();
                       logger.debug("client obtained");
                       logger.debug("Authenticated
    ?"+((FederatedService)(client.getObject())).authenticateDMSUser("user4"));
                   }catch(java.lang.ClassNotFoundException e){
                       logger.error("Class not found.\n"+e.getMessage());
                   }catch(java.lang.Exception e){
                       logger.error("Some strange exception:\n"+e.getMessage());
                   }
                   logger.debug("Leaving getClient()");
    
           }

    However, if I try to declare a bean of class
    org.codehaus.xfire.spring.remoting.XFireClientFact oryBean, my
    application hangs after server restart (Tomcat 5.5.18). There are no
    any other configuration files except web.xml applicationContext.xml
    and xml config for my controller globalization-servlet.xml.


    applicationContext.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans>
    
           <bean id="fedsrv"
    class="org.codehaus.xfire.spring.remoting.XFireClientFactoryBean">
                   <property name="serviceClass">
                           <value>com.roh.oculus.ws.xfire.FederatedService</value>
                   </property>
                   <property name="wsdlDocumentUrl">
                           <value>
                                   http://66.11.8.174:8080/Oculus5/services/FederatedService?wsdl
                           </value>
                   </property>
           </bean>
    
    </beans>
    web.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web
    Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>
    <web-app>
           <context-param>
                   <param-name>contextConfigLocation</param-name>
                   <param-value>
                           /WEB-INF/applicationContext.xml
                           classpath:org/codehaus/xfire/spring/xfire.xml
                   </param-value>
           </context-param>
           <context-param>
                   <param-name>log4jConfigLocation</param-name>
                   <param-value>/WEB-INF/log4j.properties</param-value>
           </context-param>
           <listener>
                   <listener-class>
                           org.springframework.web.util.Log4jConfigListener
                   </listener-class>
           </listener>
           <listener>
                   <listener-class>
                           org.springframework.web.context.ContextLoaderListener
                   </listener-class>
           </listener>
           <servlet>
                   <servlet-name>globalization</servlet-name>
                   <servlet-class>
                           org.springframework.web.servlet.DispatcherServlet
                   </servlet-class>
                   <load-on-startup>1</load-on-startup>
           </servlet>
           <servlet>
                   <servlet-name>xfire</servlet-name>
                   <servlet-class>
                           org.springframework.web.servlet.DispatcherServlet
                   </servlet-class>
           </servlet>
           <servlet-mapping>
                   <servlet-name>xfire</servlet-name>
                   <url-pattern>/xfire/*</url-pattern>
           </servlet-mapping>
           <servlet-mapping>
                   <servlet-name>globalization</servlet-name>
                   <url-pattern>*.htm</url-pattern>
           </servlet-mapping>
           <welcome-file-list>
                   <welcome-file>index.jsp</welcome-file>
           </welcome-file-list>
    </web-app>
    log4j output
    Code:
    .............................................................
    [19 11:32:24.843] DEBUG [BeanWrapperImpl] - Invoked write method
    [public void org.codehaus.xfire.spring.remoting.XFireClientFactoryBean.setServiceClass(java.lang.Class)]
    with value of type [java.lang.Class]
    [19 11:32:24.843] DEBUG [BeanWrapperImpl] - About to invoke write
    method [public void
    org.codehaus.xfire.spring.remoting.XFireClientFactoryBean.setWsdlDocumentUrl(java.lang.String)]
    on object of class
    [org.codehaus.xfire.spring.remoting.XFireClientFactoryBean]
    [19 11:32:24.843] DEBUG [BeanWrapperImpl] - Invoked write method
    [public void org.codehaus.xfire.spring.remoting.XFireClientFactoryBean.setWsdlDocumentUrl(java.lang.String)]
    with value of type [java.lang.String]
    [19 11:32:24.843] DEBUG [DefaultListableBeanFactory] - Invoking
    BeanPostProcessors before initialization of bean 'fedsrv'
    [19 11:32:24.843] DEBUG [DefaultListableBeanFactory] - Invoking
    afterPropertiesSet() on bean with name 'fedsrv'
    Please, guide me on my error. Where is the mistake? Why is my server
    just hangs after invoking afterPropertiesSet() on bean with name 'fedsrv'....

  • #2
    Could you provide a stack trace / thread dump to help identify where the hang is? On a Sun JVM you can do this via Ctrl-Break (Windows) or 'kill -3 <pid>' (*nix).

    Comment


    • #3
      Thank's for participating. The issue I had was due to the fact that service publishing application and client application were running within same instance of tomcat. So in order to configure my client bean I had to specify additional property
      Code:
      <bean id="fedsrv"
      class="org.codehaus.xfire.spring.remoting.XFireClientFactoryBean">
                      <property name="serviceClass">
                              <value>com.roh.oculus.ws.xfire.FederatedService</value>
                      </property>
                      <property name="wsdlDocumentUrl"
      value="http://66.11.8.174:8080/Oculus5/services/FederatedService?wsdl"/>
                      <property name="url"
      value="http://66.11.8.174:8080/Oculus5/services/FederatedService" />
                      <property name="lookupServiceOnStartup" value="false"/>                        
              </bean>

      More info: http://envoisolutions.com/xfire/api/...tartup(boolean)
      http://www.nabble.com/XFire-Client-v....html#a7950543

      Comment


      • #4
        Could you send me an example of xfire web service and an client consuming the web service? Please send me your code to sousa1981 AT yahoo DOT com DOT br.

        Regards,

        Marcos de Sousa

        Comment


        • #6
          I can not send any code. Provide the error messages and people can help you understand and solve the issue.

          Comment


          • #7
            Originally posted by seego View Post
            I can not send any code. Provide the error messages and people can help you understand and solve the issue.
            OK. Thanks.

            Now I know our to complete deal with XFire. I learned it.

            For all: You may not send code to people, but could post working code and idea to people.

            Cheers,

            Marcos de Sousa

            Comment


            • #8
              how to design client to call .net service ?

              I want to design a client for a webservice which is designed In .net.

              WSDL: .net webservice WSDL url looks like
              ------

              Code:
              http://abc.net/Service.svc?wsdl
              Can any one give tips how to design client using Java, Spring and Xfire ?

              Thanks,
              Dev.

              Comment

              Working...
              X