What you need to run this example:
- JDK 1.6
- Eclipse .
- Be Excited ;)
Developing WebService End Point
1) Open Eclipse, and create a java project "WS-Server".2) Create WS-Service Endpoint Interface:
01.package juma.mohammad;02. 03.import javax.jws.WebMethod;04.import javax.jws.WebService;05. 06.@WebService07.public interface Greeting {08.@WebMethod String sayHello(String name);09.}01.package juma.mohammad;02. 03.import javax.jws.WebService;04. 05.@WebService(endpointInterface = "juma.mohammad.Greeting")06.public class GreetingImpl implements Greeting {07. 08.@Override09.public String sayHello(String name) {10.return "Hello, Welcom to jax-ws " + name;11.}12. 13.}01.package juma;02. 03.import javax.xml.ws.Endpoint;04. 05.import juma.mohammad.GreetingImpl;06. 07.public class WSPublisher {08.public static void main(String[] args) {09.Endpoint.publish("http://localhost:8080/WS/Greeting",new GreetingImpl());10.}11.}Wow.. check your service wsdl http://localhost:8080/WS/Greeting?wsdl
http://java.dzone.com/articles/jax-ws-hello-world
No comments:
Post a Comment