2011-04-22 72 views
0

嗨全部 我是网络服务新手。我写了一个java类。 但我没有得到如何部署它。我的意思是我需要网络服务器或应用服务器。由于这是简单的java类,我不能让WAR文件来部署它。那么部署它的方法是什么以及我应该使用哪个服务器。我使用JDK 1.6

使用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); 

回答