Publish CXF Webservice using Domain Name instead of "localhost" How to Publish CXF Webservice using Domain Name instead of "localhost" example: I want to Change String address = "http://localhost:9000/helloWorld"; TO String address = "http://neoxmu.kmdns.net:9000/helloWorld"; but java throws exceptions:java.net.BindException: Cannot assign requested address: bind Code: DeployHelloWorldService.java package com.neoxmu.service.deploy; import java.io.*; import java.net.*; import javax.xml.ws.Endpoint; import com.neoxmu.service.HelloWorldService; public class DeployHelloWorldService { public static void deployService() { System.out.println("Server start ……"); HelloWorldService service = new HelloWorldService(); String address = "http://localhost:9000/helloWorld"; Endpoint.publish(address, service); } public static void main(String[] args) throws InterruptedException, IOException { deployService(); System.out.println("server ready ……"); Thread.sleep(1000 * 1200); System.out.println("server exiting"); System.exit(0); } HelloWorldService.java package com.neoxmu.service; import javax.jws.WebParam; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; import javax.jws.soap.SOAPBinding.Style; @WebService @SOAPBinding(style = Style.RPC) public class HelloWorldService { public String sayHello(@WebParam(name = "name") String name) { return name + " say: Hello World "; } } HelloWorldServiceClient.java package com.neoxmu.client; import java.io.IOException; import java.io.InputStreamReader; import java.io.LineNumberReader; import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; import com.neoxmu.service.IHelloWorldService; public class HelloWorldServiceClient { public static void main(String[] args) throws IOException { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(IHelloWorldService.class); factory.setAddress("http://localhost:9000/helloWorld"); //factory.setAddress("http://neoxmu.kmdns.net:9000/helloWorld"); IHelloWorldService service = (IHelloWorldService) factory.create(); System.out.println("[result]" + service.sayHello("neoxmu")); }
Is there any service configured on port 9000 ? Should the URL http://neoxmu.kmdns.net:9000/helloWorld be accessible from the browser ? If yes, it is not working at this time.