title: HTTP transport error: Connection refused when accessing web service from Glassfish
body: <p>I have two applications running on Glassfish 4.1 server: one that provides jax-ws webservice, and other that uses it. Everything is fine as long as i use <code>localhost</code> or <code>127.0.0.1</code> as endpoint in client app. But when i try to install webservice on remote machine and access it, i receive an error in client app:
  <code>com.sun.xml.ws.client.ClientTransportException: HTTP transport error: java.net.ConnectException: Connection refused: connect</code></p>
  
  <p>However, i <strong>can</strong> access remote wsdl from browser/SoapUI/Netbeans. Service port binding section of wsdl contains valid host:port.</p>
  
  <p>What i tried to do:</p>
  
  <ul>
  <li><p>Setting endpoint in client app using</p>
  
  <pre><code>(BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);
  </code></pre></li>
  <li>Redo jax-ws import from remote machine, so now even in local wsdl i have remote hostname;</li>
  <li>Changed inject annotation to <code>@WebServiceRef(wsdlLocation = "http://remotehost:remoteport/svc/port?wsdl")</code></li>
  <li>Checked that glassfish listener is configured to IP <code>0.0.0.0</code></li>
  </ul>
  
  <p>So far, nothing helps. Furthermore, i experiencing same behaviour when i simply change endpoint from <code>localhost</code> to actual host name or IP of this very same machine.</p>
  
  <p>Here's the exception log (partial):</p>
  
  <pre><code>com.sun.xml.ws.client.ClientTransportException: HTTP transport error: java.net.ConnectException: Connection refused: connect
  at com.sun.xml.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:131)
  at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:223)
  at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:145)
  at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:139)
  at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
  at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
  at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
  at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
  at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:136)
  at com.sun.enterprise.security.webservices.ClientSecurityPipe.processSecureRequest(ClientSecurityPipe.java:198)
  at com.sun.enterprise.security.webservices.ClientSecurityPipe.process(ClientSecurityPipe.java:186)
  at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:119)
  at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:1136)
  at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:1050)
  at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:1019)
  at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:877)
  at com.sun.xml.ws.client.Stub.process(Stub.java:463)
  at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:191)
  at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
  at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:92)
  at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:161)
  at com.sun.proxy.$Proxy386.processRequest(Unknown Source)
  </code></pre>
  
  <p>Any help would be appreciated!</p>