I am trying to create a simple web service in eclipse. First I created an empty java project and added the following three files to the src folder
package com.alfaisaliah; import javax.jws.WebService; import javax.jws.WebMethod; @WebService public interface Greeting { @WebMethod String sayHello(String name); }
- GreetingImp.java
package com.alfaisaliah; import javax.jws.WebService; @WebService(endpointInterface="com.alfaisaliah.Greeting") public class GreetingImp implements Greeting { @Override public String sayHello(String name) { return "Hello " + name; } }
- Wspublisher
package com.alfaisaliah; import javax.xml.ws.Endpoint; public class WSPublisher { public static void main(String[] args){ Endpoint.publish("http://localhost:8081/WS/Greeting", new GreetingImp()); } }
The following tutorial does not specify a server to run a web service! I am wondering if any server needs to be specified. I already have Tomcat v5.5, but I do not use it in this example. Whenever I run this project as a java project, I get some error. Can someone help me determine where my problem is trying to start the web service. Here is the output of the eclipse console
Feb 26, 2012 12:01:00 PM com.sun.xml.internal.ws.model.RuntimeModeler getRequestWrapperClass INFO: Dynamically creating request wrapper Class com.alfaisaliah.jaxws.SayHello Feb 26, 2012 12:01:00 PM com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass INFO: Dynamically creating response wrapper bean Class com.alfaisaliah.jaxws.SayHelloResponse
Also, when I start the project again, it says that the address is already in use
Feb 26, 2012 12:01:00 PM com.sun.xml.internal.ws.model.RuntimeModeler getRequestWrapperClass INFO: Dynamically creating request wrapper Class com.alfaisaliah.jaxws.SayHello Feb 26, 2012 12:01:00 PM com.sun.xml.internal.ws.model.RuntimeModeler getResponseWrapperClass INFO: Dynamically creating response wrapper bean Class com.alfaisaliah.jaxws.SayHelloResponse Exception in thread "main" com.sun.xml.internal.ws.server.ServerRtException: Server Runtime Error: java.net.BindException: Address already in use
I would be grateful for your help to the guys :)
source share