3 Replies Latest reply on May 2, 2014 6:15 AM by Neelmohan Choudhry

    Cannot bind web services to public IP

    bernhardh Newbie



      we recently moved our SOAP web services stack from a Glassfish application server to JBoss AS 7 on an Amazon EC2 instance.

      Everything works perfectly with the existing .NET web service clients. The problem, however, comes when trying to create a new web service client from the web service's WSDL. When trying to make a web service call after generating the client-side code from the WSDL, an error is issued that reports that the service cannot be accessed at "localhost" - while the service is in fact running on a remote server (new web service clients accessing a locally-hosted web service work fine).


      When I inspect the WSDL as it is served by JBoss AS, I believe I can see the problem. The WSDL ends with:



        <wsdl:service name="IdentityService">

          <wsdl:port binding="tns:IdentityServiceSoapBinding" name="IdentityServicePort">

            <soap:address location="http://localhost:8080/identity/IdentityService"/>





      Note that the location attribute refers to "localhost". This is wrong - it should be the server's public IP address or any one of its domain names.

      As far as I can gather JBoss AS binds web services to localhost by default. I've tried binding the web services to the server's public IP-address, for instance, by running


      ./standalone.sh -b [public IP]


      Then, when the application server starts up, all of the web services' deployment statuses go to "failed". In the server log I cannot find any indication as to why the web services fail to deploy. When I start JBoss AS without specifying the binding address, the web services deploy successfully.


      With Glassfish we never had to specify a binding address. When the web service is deployed on Glassfish and its WSDL is retrieved, the location attribute of the soap:address tag always contains the address through which the WSDL was accessed (when it's accessed through the public IP, it starts with "http://[public IP]:8080..."; when it's accessed through a domain name, it starts with "http://[domain name used]:8080...").

      Our existing web service clients work fine, because they have been generated with the correct WSDL, when the web services were still hosted on Glassfish.

      If I could configure our JBoss AS server to return the WSDL with the correct address like that, that would be severely awesome. Otherwise, I would like to know how to bind the web services to a specified IP address, and why it currently doesn't work.


      Any ideas?