facebook

Web Service Connection Refused

  1. MyEclipse Archived
  2.  > 
  3. Web Services
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #263461 Reply

    Russ
    Member

    I have created a X-Fire Web Service using the top down approach. Everything is working from what I can see. I have deployed the service to JBoss 4.0.5. When the server comes up, I am getting the below error. I have set the port number as 9080 for the web service. I’ve tried to changing it to 8080 so I can use it within JBoss, but this has not worked.

    
    2006-12-14 18:12:15,301 ERROR [org.codehaus.xfire.transport.http.XFireServlet] Error initializing XFireServlet.
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.codehaus.xfire.spring.ServiceBean' defined in class path resource [META-INF/xfire/services.xml]: Initialization of bean failed; nested exception is java.net.ConnectException: Connection refused: connect
    java.net.ConnectException: Connection refused: connect
        at java.net.PlainSocketImpl.socketConnect(Native Method)
    

    Any assistance would be greatly appreciated.

    Russ

    #263462 Reply

    Brian Fernandes
    Moderator

    Russ,

    Were your services working earlier and then suddenly stopped? Do you remember what you changed?

    What does your <service> bean element in the services.xml file look like. Can you ensure that the addresses and the port number specified in the WSDL file are the same as the actual address and port at which the service is available?

    #263464 Reply

    Russ
    Member

    Brian:

    I have not been able to get the Web Service running since I have recreated it within MyEclipse.

    Here is my services.xml file

    
    
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://xfire.codehaus.org/config/1.0">
        <service>
            <name>WebServiceBeanService</name>
            <namespace>http://webservice.prod.dept.company.com</namespace>
            <!-- These were added as a test becasue this was how WSAD did it-->
            <!-- http://localhost:9080/MyWebService/WebServiceBean?WSDL -->
    
                <!-- this is what the tool created when I used the wizard -->
            <!-- file:/C:/WorkSpaceForMyEclipse/MyWebServices/WebContent/WEB-INF/wsdl/WebServiceBean.wsdl -->
            <wsdlURL>http://localhost:9080/MyWebService/WebServiceBean?WSDL</wsdlURL>
            <serviceClass>com.company.dept.prod.webservice.WebServiceBean</serviceClass>
            <implementationClass>com.company.dept.prod.webservice.WebServiceBeanServiceImpl</implementationClass>
            <serviceFactory>org.codehaus.xfire.jaxb2.JaxbServiceFactory</serviceFactory>
            <style>document</style>
            <use>literal</use>
            <scope>application</scope>
        </service>
    </beans>
    

    I can see the WSDL in the WSDL explorer with no problem.

    In regards to the port number. Can you guide to on how to check?

    Thanks for all your help.

    Russ

    #263544 Reply

    Russ
    Member

    When I change the port number number to 8080, like I do when I use Axis, the service NEVER returns. When I do a netstat on my machine, I see the port number is “ESTABLISHED”.

    #263598 Reply

    Brian Fernandes
    Moderator

    Russ,

    1) The first step is to locate the real port at which your service is available. If you deploy a standard web application to JBoss, what port is it available at? If it’s 8080, then 8080 is the port at which the web service will be available. We need to be sure of this at least before moving on. You should be able to check http://<server&gt;:<port>/<app>/services (e.g. http://localhost:8090/MyWebService/services) in your browser and get a list of the deployed web services – if this does not work, there is no point testing the client.

    2) I know you’re generating the WS from a preexisting WSDL file, reference that file in the local file system when you’re creating the WS client, don’t refer to the version on the server (i.e. don’t use http://localhost:9080/MyWebService/WebServiceBean?WSDL) – this will affect the <wsdlURL> element in the services.xml file.

    3) If #2 does not work, try this replacement in your services.xml file
    replace

    <wsdlURL>http://localhost:9080/MyWebService/WebServiceBean?WSDL</wsdlURL>
    <serviceClass>com.company.dept.prod.webservice.WebServiceBean</serviceClass>
    <implementationClass>com.company.dept.prod.webservice.WebServiceBeanServiceImpl</implementationClass>

    with

    <serviceClass>com.company.dept.prod.webservice.WebServiceBeanServiceImpl</serviceClass>

    4) Where in the WSDL file have you specified the location at which the WS is available? I would look at the location attribute of the address element which exists in service > port element.

    5) If none of the above work, can you send the WSDL file you are using to support@genuitec.com ATTN Brian or paste it in this thread?

    #263617 Reply

    Russ
    Member

    Brain:

    Welcome back, we missed you! Hope your holiday was good!

    I’ve worked through your suggestions,so let me share with you some of my discoveries:

    1) We normally high the web application on the port 8080 for JBoss. When I try to check the web application using the recommended URL, I receive a HTTP Status code of 400. The URL http://localhost:8080/MyWebService/ is about ass far as I can go before I start getting the 404 error code.

    2/3) I’ve reverted back to the way the product generates the WSDLURL tag using the file. I’ve also commented out the <WsdlURL> and <Implementationclass> tags. When I do this and try to test the url (http://localhost:8080/MyWebService/services) I receive a 500 http status code:

    
        [2006-12-19 09:34:34,718][main] [ERROR] [Error initializing XFireServlet.]
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.codehaus.xfire.spring.ServiceBean' defined in class path resource [META-INF/xfire/services.xml]: Initialization of bean failed; nested exception is org.codehaus.xfire.annotations.AnnotationException: Service class cannot be abstract: com.company.dept.prod.webservice.WebServiceBean
    org.codehaus.xfire.annotations.AnnotationException: Service class cannot be abstract: com.company.dept.prod.webservice.WebServiceBean
    

    4) I did verify the address in the WSDL. I am using

    
        http:localhost:8080/MyWebServices/services/WebServiceBean
      

    Thanks for your help.

    Russ

    #263623 Reply

    Brian Fernandes
    Moderator

    Russ,

    You used the service interface in the <serviceClass> element and not the implementation class as I instructed 🙂

    <serviceClass>com.company.dept.prod.webservice.WebServiceBeanServiceImpl</serviceClass>

    This is necessary if only the serviceClass element is specified.

    You said you used

    http:localhost:8080/MyWebServices/services/WebServiceBean 

    , it should be

    http://localhost:8080/MyWebServices/services/WebServiceBean

    – is this a typo in your WSDL file or just here in the thread?

    What is the name of your service? (See the <service name = “xyz”> element).

    http://localhost:8080/MyWebService/services should work before moving on.

    #263646 Reply

    Russ
    Member

    Brian:

    My typing is not so good…. Must be the Holiday Season…. 🙂

    I retried using the Impl class and that did not work…..

    The URL was a typo in this thread only….. 🙁

    The Name of the service in the the WSDL and services.xml file is WebServiceBeanService

    #263718 Reply

    Brian Fernandes
    Moderator

    Russ,

    Your WSDL file seemed to e just fine. I still need to examine it in detail, but as a test, I generated code using the WSDL you sent in the package com.foo in a new WS project.
    I slightly modified the services.xml file to the following:

    
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://xfire.codehaus.org/config/1.0">
    
    
        <service>
            <name>WebServiceBeanService</name>
            <namespace>http://your.namespace.here</namespace>        
            <serviceClass>com.foo.WebServiceBeanServiceImpl</serviceClass>
            <serviceFactory>org.codehaus.xfire.jaxb2.JaxbServiceFactory</serviceFactory>
            <style>document</style>
            <use>literal</use>
            <scope>application</scope>
        </service>
    </beans>
    

    I then deployed this to tomcat 5 and was able to see the expected page at http://localhost:<tomcatport>/MyApp/services and access the WSDL file as well from the link on that page.

    I’ll try replicating this with JBoss to see if that requires any special configuration.

    #264021 Reply

    Russ
    Member

    Brain:

    Okay, I made the changes to the services file like you said. We have gotten pass any server errors, but I still can not proceed with hitting the WebService client from My Eclipse. I am still getting the below error:

    
       IWAB0135E An unexpected error has occurred. 404 Not Found
       

    I can see the log file roll with activity from the service when I click on the Go button, but I see nothing in the logs that tells me we are getting to the web service. when I got out of MyEclipse and try to hit the web services, it still can not find the anything pass http://localhost:8080/MyWebService. For example, http://localhost:8080/MyWebService/services/ can not be found.

    I don’t know if this helps, but the JNDI tree looks like this:

    
       java:comp namespace of the MyProject.ear/MyWebService.war application:
      +- UserTransaction[link -> UserTransaction] (class: javax.naming.LinkRef)
      +- env (class: org.jnp.interfaces.NamingContext)
      |   +- security (class: org.jnp.interfaces.NamingContext)
      |   |   +- realmMapping[link -> java:/jaas/other] (class: javax.naming.LinkRef)
      |   |   +- subject[link -> java:/jaas/other/subject] (class: javax.naming.LinkRef)
      |   |   +- securityMgr[link -> java:/jaas/other] (class: javax.naming.LinkRef)
      |   |   +- security-domain[link -> java:/jaas/other] (class: javax.naming.LinkRef)
    
      

    Thanks for reading my post.

    Russ

    #264054 Reply

    Brian Fernandes
    Moderator

    Russ,

    What does your web.xml file look like? Are you currently deploying to JBoss or Tomcat?

    My web.xml currently looks like this:

    
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app
        xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        version="2.4"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
        <servlet>
            <servlet-name>XFireServlet</servlet-name>
            <servlet-class>
                org.codehaus.xfire.transport.http.XFireConfigurableServlet
            </servlet-class>
            <load-on-startup>0</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>XFireServlet</servlet-name>
            <url-pattern>/services/*</url-pattern>
        </servlet-mapping>
    </web-app>
    

    This is usually created and configured automatically by MyEclipse. I can’t figure out why you can’t see anything under MyWebService/services/ – if you are using a WAR, can you try an exploded deployment to test and see if that helps? Is this is a simple standalone WS project or an EAR based application?

    #264180 Reply

    Russ
    Member

    Brian:

    This is my web.xml which is generated when the project is created.

    
    <?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>
      <servlet>
        <servlet-name>XFireServlet</servlet-name>
        <display-name>XFire Servlet</display-name>
        <servlet-class>org.codehaus.xfire.transport.http.XFireConfigurableServlet</servlet-class>
        <init-param>
           <param-name>config</param-name>
           <param-value>services.xml</param-value>
        </init-param>
      </servlet>
      
      <servlet-mapping>
        <servlet-name>XFireServlet</servlet-name>
        <url-pattern>/servlet/XFireServlet/*</url-pattern>
      </servlet-mapping>
      
      <servlet-mapping>
        <servlet-name>XFireServlet</servlet-name>
        <url-pattern>/services/*</url-pattern>
      </servlet-mapping>
      
      <welcome-file-list>
            <welcome-file>index.html</welcome-file>
            <welcome-file>index.htm</welcome-file>
            <welcome-file>index.jsp</welcome-file>
            <welcome-file>default.html</welcome-file>
            <welcome-file>default.htm</welcome-file>
            <welcome-file>default.jsp</welcome-file>
      </welcome-file-list>
    </web-app>
    

    The only thing I’ve added is the welcome file list.

    Let me know what you think.

    Russ

    #264182 Reply

    Brian Fernandes
    Moderator

    Russ,

    Our wizards do not generate a web.xml file like the one you pasted above – are you sure you haven’t modified it manually?

    Could you replace your web.xml with this and try again?

    
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app
       xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       version="2.4"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
       <servlet>
          <servlet-name>XFireServlet</servlet-name>
          <servlet-class>
             org.codehaus.xfire.transport.http.XFireConfigurableServlet
          </servlet-class>
          <load-on-startup>0</load-on-startup>
       </servlet>
       <servlet-mapping>
          <servlet-name>XFireServlet</servlet-name>
          <url-pattern>/services/*</url-pattern>
       </servlet-mapping>
    
      <welcome-file-list>
          <welcome-file>index.html</welcome-file>
          <welcome-file>index.htm</welcome-file>
          <welcome-file>index.jsp</welcome-file>
          <welcome-file>default.html</welcome-file>
          <welcome-file>default.htm</welcome-file>
          <welcome-file>default.jsp</welcome-file>
      </welcome-file-list>
    </web-app>
Viewing 13 posts - 1 through 13 (of 13 total)
Reply To: Web Service Connection Refused

You must be logged in to post in the forum log in