mardi 20 août 2013

@ Your web service sir !

With Java 7, we cannot imagine how simple is to make a web services server

//My OneLine Server ! 
package ws;


public class ServerLauncher {

    public static void main(String[] args) {
        Endpoint.publish("http://localhost:29057/WS", new HelloImpl());

package ws;

public class Mister {
    public String name;
//My Service
package ws;

import javax.jws.WebService;

public class HelloImpl {

    public String hello (Mister m)
        if (""))
            {return "Hello Nobdy";}
            {return "Hello " +;}

then use your best SoaopUI and test !
then you can enrich the sample with more annotation

you can easily genereate a client using wsimport based on the wsdl there (http://localhost:29057/WS?wsdl)

be careful with the generation, it generate server interfaces ... but annotation has to be cut/copy into the implementation as they are not inherited ...