![](/img/trans.png)
[英]Do I need stax-api-1.0.x in my web app when using JDK 1.6?
[英]Web Services using jdk 1.6
大家好我是Web服务的新手。 我写了一个Java类。 但是我没有得到如何部署它。 我的意思是我需要Web服务器还是应用程序服务器。 由于这是简单的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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.