<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    My WebService Client always gets "Connection refused" Exception
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/virtuellesnugat">Matthias M.</a> in <i>JBoss Web Services</i> - <a href="https://community.jboss.org/message/758006#758006">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hello everybody,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I'm facing the "Connection refused" execption when I try to use my JAX-WS based webservice on my JBoss AS 7.1.1. </p><p>The Service itself seem to work properly, because the wsdl is generated and accessible via Browser and SoapUI. </p><p>In SoapUI I've added my services and they work fine.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The server-side is implemented this way: </p><p>{code} </p><p>@Stateless </p><p>@WebService ( </p><p>&#160;&#160;&#160; portName = "AppointmentFacadePort", </p><p><span>&#160;&#160;&#160; targetNamespace = "</span><a class="jive-link-external-small" href="http://facade.appointment.wsServe.mmoell.de/" target="_blank">http://facade.appointment.wsServe.mmoell.de/</a><span>") </span></p><p>@SOAPBinding (style = Style.DOCUMENT, use = Use.LITERAL) </p><p>public class AppointmentFacade { </p><p>{/code}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I guess everything else is set anyway. But I'm not quite sure how to handle the "wsdlLocation" attribute of the @WebService Annotation.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I've tried many ways to implement the ws-client, but everytime I get the connection refused Exception. So I've checked the following:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><ul><li style="text-align: start;">&#160;&#160;&#160; the firewall doesn't block my requests (Browser, SoapUI, and remote calls via JNDI lookup succeed)</li><li style="text-align: start;">&#160;&#160;&#160; I'm not using a proxy</li><li style="text-align: start;">&#160;&#160;&#160; I'm using a host entry "master.de" which points to the correct address (everything else still works, and using the real ip doesn't help)</li></ul><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>So let's take a look at the client-side implementations I've tried:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>- using the generated classes by consuming the wsdl (I've used jboss' wsconsume tool and jdk's wsimport tool):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>{code} </p><p>AppointmentFacadeService serv = new AppointmentFacadeService(); </p><p>AppointmentFacade port = serv.getPort(AppointmentFacade.class); </p><p>System.out.println(port.getDateByString("05.09.2012 12:55")); </p><p>{/code}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>- another approach: </p><p>{code} </p><p><span>QName serviceName = new QName("</span><a class="jive-link-external-small" href="http://facade.appointment.wsServe.mmoell.de/" target="_blank">http://facade.appointment.wsServe.mmoell.de/</a><span>", "AppointmentFacadeService"); </span></p><p><span>String serviceURL = "</span><a class="jive-link-external-small" href="http://master.de:8080/wsServe/AppointmentFacade" target="_blank">http://master.de:8080/wsServe/AppointmentFacade</a><span>"; </span></p><p>URL wsdlURL = new URL(serviceURL&#160; + "?wsdl"); </p><p>Service service = Service.create(wsdlURL, serviceName); </p><p>AppointmentFacade proxy = (AppointmentFacade)service.getPort(AppointmentFacade.class); </p><p>System.out.println(proxy.getDateByString("05.09.2012 12:55")); </p><p>{/code}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I tried a few more variations (for example the eclipse ws-client wizard), but the connection was still refused everytime. </p><p>Exception Stack Trace I get, no matter which client-approach I use: </p><p>{code} </p><p>Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: java.net.ConnectException: Connection refused: connect</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at com.sun.xml.internal.ws.client.Stub.process(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at $Proxy29.getDateByString(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at de.mmoell.wsServe.client.Main.main(Main.java:25)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Caused by: java.net.ConnectException: Connection refused: connect</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at java.net.DualStackPlainSocketImpl.connect0(Native Method)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at java.net.AbstractPlainSocketImpl.connect(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at java.net.PlainSocketImpl.connect(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at java.net.SocksSocketImpl.connect(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at java.net.Socket.connect(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at java.net.Socket.connect(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at sun.net.NetworkClient.doConnect(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at sun.net.www.http.HttpClient.openServer(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at sun.net.www.http.HttpClient.openServer(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at sun.net.www.http.HttpClient.&lt;init&gt;(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at sun.net.www.http.HttpClient.New(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at sun.net.www.http.HttpClient.New(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&#160;&#160;&#160; ... 15 more</p><p> {/code}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Has anyone an idea how to solve this problem? I'm trying to solve it for weeks now, but I won't succeed. </p><p>Any help would be greatly appreciated!</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Best regards, Matthias</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/758006#758006">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>