Quick WebService in Java 6
To write a quick JAX-WS webservice in Java 6:
package test;
import javax.xml.ws.Endpoint;
@javax.jws.WebService
public class MyWebService{
@javax.jws.WebMethod
public String getQuote(String name){
return "1234.56";
}
public static void main(String[] arg){
Endpoint end = Endpoint.create(new MyWebService());
end.publish("http://localhost:1000/MyWebService");
}
}
To compile and run:
$ apt -d bin/ MyWebService.java $ java -cp bin test.MyWebService