开发者

Web Services using jdk 1.6

Hi All I am new to web services. I have written a java class. But I am not getting how to deploy it. I mean do i need web server or app server . As this is simple java class i can not make WAR file to deploy it . So what is the method to deploy it and which server should i use. I am using JDK 1.6

  import javax.jws.WebService;
    import javax.jws.soap.SOAPBinding;
    import javax.jws.soap.SOAPBinding.Style;
    import javax.xml.ws.Endpoint;

    @WebService
    public class WiseQuoteServer {
    @SOAPBinding(style = Style.RPC)
    public String getQuote(String category) {
        if (category.equals("fun")) {
            return "5 is a sufficient approximation of infinity.";
        }
        i开发者_StackOverflowf (category.equals("work")) {
            return "Remember to enjoy life, even during difficult situatons.";
        } else {
            return "Becoming a master is relatively easily. Do something well and then continue to do it for the next 20 years";
        }
    }

    public static void main(String[] args) {
        WiseQuoteServer server = new WiseQuoteServer();
        Endpoint endpoint = Endpoint.publish(
                "http://localhost:9191/wisequotes", server);


The best answer to your question would be the tutorial of JAX-WS

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜