Connection refused while looking up web service - Websphere

This is a discussion on Connection refused while looking up web service - Websphere ; Hi All, When I generate a web service client for my web service, the WSDL and the client code generated has a hardcoded URL of "localhost: /URL of web service" But when this web service is deployed on some other ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: Connection refused while looking up web service

  1. Connection refused while looking up web service

    Hi All,

    When I generate a web service client for my web service, the WSDL and the client code generated has a hardcoded URL of "localhost:/URL of web service"

    But when this web service is deployed on some other server where "localhost" is not a valid name, then we get the following error

    I tried using setEndpoint before calling the proxy for web service. That doesnt work as the proxy class has a final variable with the hardcoded URL.

    Any clues what the normal thing to do is in such situation??

    WSWS3713E: Connection to the remote host localhost failed.Received the following error: Connection refused
    at com.tu.extranet.businessDelegate.UserBD.getUserPro file(UserBD.java:79)
    at com.tu.extranet.ui.actions.ViewLandingPageAction.e xecute(ViewLandingPageAction.java:46)
    at org.apache.struts.action.RequestProcessor.processA ctionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:763)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.ser vice(ServletWrapper.java:1282)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.han dleRequest(ServletWrapper.java:673)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispat cher.forward(WebAppRequestDispatcher.java:265)
    at org.apache.struts.action.RequestProcessor.doForwar d(RequestProcessor.java:1069)
    at org.apache.struts.action.RequestProcessor.processF orwardConfig(RequestProcessor.java:455)
    at org.apache.struts.action.RequestProcessor.process( RequestProcessor.java:279)
    at org.apache.struts.action.ActionServlet.process(Act ionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(Acti onServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:763)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.ser vice(ServletWrapper.java:1282)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.han dleRequest(ServletWrapper.java:673)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleReques t(WebApp.java:2905)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequ est(WebGroup.java:220)
    at com.ibm.ws.webcontainer.VirtualHost.handleRequest( VirtualHost.java:204)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest (WebContainer.java:1829)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.read y(WCChannelLink.java:84)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.handleDiscrimination(HttpInboundLink.java:469)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.handleNewInformation(HttpInboundLink.java:408)
    at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCa llback.complete(HttpICLReadCallback.java:101)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.reque stComplete(WorkQueueManager.java:566)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attem ptIO(WorkQueueManager.java:619)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager.worke rRun(WorkQueueManager.java:952)
    at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worke r.run(WorkQueueManager.java:1039)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:1455)
    Caused by: WSWS3713E: Connection to the remote host localhost failed.Received the following error: Connection refused
    at com.ibm.ws.webservices.engine.xmlsoap.builders.Web ServicesFaultProcessor.createFault(WebServicesFaul tProcessor.java:411)
    at com.ibm.ws.webservices.engine.xmlsoap.SOAPFault.ge tFault(SOAPFault.java:486)
    at com.ibm.ws.webservices.engine.SOAPPart.getFault(SO APPart.java:1090)
    at com.ibm.ws.webservices.engine.SOAPPart.getFault(SO APPart.java:747)








  2. Re: Connection refused while looking up web service

    amit_tare@hotmail.com wrote:

    > Hi All,
    >
    > When I generate a web service client for my web service, the WSDL and the client code generated has a hardcoded URL of "localhost:/URL of web service"
    >
    > But when this web service is deployed on some other server where "localhost" is not a valid name, then we get the following error
    >
    > I tried using setEndpoint before calling the proxy for web service. That doesnt work as the proxy class has a final variable with the hardcoded URL.
    >

    Hi,

    The WSDL is always an artifact published by the server side deployer.
    When they deploy the application, they need to update the WSDL with the
    right end point address so that non-local clients can talk to the
    webservice. Once this is published, you will need to generate your
    clients based on the WSDL.

    Or, if you know what you are doing, simply edit your client code to
    change all references to "localhost" to whatever is published in the WSDL.

    Its possible that you are both the application developer and the server
    side deployer. But that doesnt change anything. The client code has to
    use the end-point published in the WSDL. You may have developed the
    WSDL, but its the server deployer that determines the publicly visible
    end point address.

    Regards,
    Kenneth


  3. Re: Connection refused while looking up web service

    Thanks for the reply.

    But can setEndpoint be used as a solution for the URL where the web service will be ultimately deployed. So you could have a entry in properties file which is the URL needed and at runtime, the client proxy first does a setEndpoint which overrides the entry in wsdl.

    Can this solution work? I tried implementing this, but setEndpoint would not change the original address as mentioned in the wsdl.

    I am using RAD6.0 as my dev environment. Also am using client proxy to access my web service. The problem is that the generated client proxy code has a final static string with the url hardcoded. So probably thats why the setEndpoint is not working. Any thoughts?

    When is setEndpoint used?

    Thanks,
    Amit

  4. Re: Connection refused while looking up web service

    amit_tare@hotmail.com wrote:
    > Thanks for the reply.
    >
    > But can setEndpoint be used as a solution for the URL where the web service will be ultimately deployed. So you could have a entry in properties file which is the URL needed and at runtime, the client proxy first does a setEndpoint which overrides the entry in wsdl.
    >
    > Can this solution work? I tried implementing this, but setEndpoint would not change the original address as mentioned in the wsdl.
    >
    > I am using RAD6.0 as my dev environment. Also am using client proxy to access my web service. The problem is that the generated client proxy code has a final static string with the url hardcoded. So probably thats why the setEndpoint is not working. Any thoughts?
    >
    > When is setEndpoint used?
    >

    Amit,

    I'm not sure what the "setEndpoint" is that you are referring to, but
    it seems to me that you are wanting a client side process to change
    server side application configuration. In other words, administration.
    Use the admin console for that. If you arent given access to the admin
    console, your client shouldnt be allowed to change that server property
    either.

    If you want to dynamically point your client to the right end point,
    you can use resource references. Here is an example using an old version
    of WAS:

    http://www-128.ibm.com/developerwork...08_flurry.html

    Regards,
    Kenneth


  5. Re: Connection refused while looking up web service

    Yeah, basically I want to dynamically point the client to a end point.

    And the solution the link suggests to use a URL resource configured in the WSAD. But that would also require changing the client generated code (ServiceLocator class which is generated by the web service wizard). Is that a good idea to change the client generatd classes? That way everytime the web service is generated, the client will be overwritten and hence one needs to do the change to use a URL source again in the code.

  6. Re: Connection refused while looking up web service

    amit_tare@hotmail.com wrote:

    > Yeah, basically I want to dynamically point the client to a end point.
    >
    > And the solution the link suggests to use a URL resource configured in the WSAD. But that would also require changing the client generated code (ServiceLocator class which is generated by the web service wizard). Is that a good idea to change the client generatd classes? That way everytime the web service is generated, the client will be overwritten and hence one needs to do the change to use a URL source again in the code.

    Hi,

    I dont remember the specifics of the webservice code generator, but the
    recent code-generator output that I've encountered from IBM has
    @generated tags for every method thats generated by tooling. Methods
    without this tag are not removed / modified by tooling if the code is
    regenerated again.

    This means that it may be possible to isolate your code into a section
    which doesnt get touched by code regeneration. No guarantees though -
    like I mentioned its been a while since I played with webservices code
    generators and this may or may not be possible for you.

    Regards,
    Kenneth

+ Reply to Thread