JBoss Community

Re: My WebService Client always gets "Connection refused" Exception

created by Matthias M. in JBoss Web Services - View the full discussion

After I found out, thanks to wireshark, that the client tried to address localhost instead of the specified location, I knew what happened:

 

In the generated wsdl was the following part included:

{code:xml}

<wsdl:service name="AppointmentFacadeService">

    <wsdl:port binding="tns:AppointmentFacadeServiceSoapBinding" name="AppointmentFacadePort">

        <soap:address location="http://localhost:8080/wsServe/AppointmentFacade"/>

    </wsdl:port>

</wsdl:service>

{code:xml}

 

As my server is running on a vm, it's pretty obvious what caused the problem.

 

I was able to solve it by editing the standalone-full.xml

{code:xml}

<subsystem xmlns="urn:jboss:domain:webservices:1.1">

    <modify-wsdl-address>true</modify-wsdl-address>

    <wsdl-host>192.168.178.121</wsdl-host>

    <endpoint-config name="Standard-Endpoint-Config"/>

    <endpoint-config name="Recording-Endpoint-Config">

        <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">

            <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>

        </pre-handler-chain>

    </endpoint-config>

</subsystem>

{code:xml}

 

This way, the above mentioned part of the wsdl was changed to this:

{code:xml}

<wsdl:service name="AppointmentFacadeService">

    <wsdl:port binding="tns:AppointmentFacadeServiceSoapBinding" name="AppointmentFacadePort">

        <soap:address location="http://192.168.178.121:8080/wsServe/AppointmentFacade"/>

    </wsdl:port>

</wsdl:service>

{code:xml}

 

And now my java se client addresses the correct service, though it picked the correct url to retrieve the wsdl.

 

I still got two questions left:

  1. Why was SoapUI able to call the correct service? I know, I had to edit the interface endpoint by changing the url. But which method can I use to change it manually on client side in the java code?
  2. It seems to be a very bad style to hardcode the machine's url into the configuration file in order to get the expected wsdl created. Is there a constant I can use like "{jboss-external-ipv4-address}"?

 

Best regards, Matthias

Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community