【问题标题】:Web Services using jdk 1.6使用 jdk 1.6 的 Web 服务
【发布时间】:2011-04-22 07:07:58
【问题描述】:

大家好 我是网络服务的新手。我写了一个java类。 但我不知道如何部署它。我的意思是我需要网络服务器或应用程序服务器。由于这是简单的 java 类,我无法制作 WAR 文件来部署它。那么部署它的方法是什么以及我应该使用哪个服务器。我正在使用 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.";
        }
        if (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);

【问题讨论】:

    标签: java web-services


    【解决方案1】:

    您的问题的最佳答案是tutorial of JAX-WS

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-09
      相关资源
      最近更新 更多