简体   繁体   English

如何在Web上部署Web服务

[英]how to deploy web service on the web

I want to deploy a java webservice from eclipse,to run on my localhost without eclipse 我想从Eclipse部署Java Web服务,以便在没有Eclipse的本地主机上运行

this is my webservice: 这是我的网络服务:

import javax.jws.WebMethod;

import javax.jws.WebService;

@WebService
public class HelloWeb {

@WebMethod
public String sayGreeting(String name) {

    return "Greeting " + name + "!";

}

} }

i did the following: after writing this, i rightclicked on the helloweb file, and clicked "create web service" and got the following image: 我执行了以下操作:编写此代码后,我右键单击helloweb文件,然后单击“创建Web服务”,并得到以下图像:

在此处输入图片说明

after clicking finish the service begins running in the internal web explorer 单击完成后,服务开始在内部Web资源管理器中运行

but i want it to run when eclipse is closed 但是我希望它在月食关闭时运行

how do i do that? 我怎么做? what am i missing? 我想念什么?

it looks like your using Eclipse to manage your server (and so it shows in an internal browser). 看起来您使用Eclipse来管理服务器(因此显示在内部浏览器中)。 The IDE puts all the files in the correct directories relative to your server's root. IDE将所有文件放置在相对于服务器根目录的正确目录中。 You dont however need to use an IDE to use a web-server like Tomcat or whatever other webserver you wish to use. 但是,您不需要使用IDE即可使用Web服务器(例如Tomcat)或您要使用的任何其他Web服务器。 If the server is setup correctly (see here for Tomcat http://tomcat.apache.org/tomcat-7.0-doc/setup.html )and your running the app from the Terminal in mac or from command prompt in windows you just need to have the server started to run the app on this port.You can then access your service in a browser on the server's port (im assuming a service is just like a webapp). 如果服务器设置正确(请参阅此处的Tomcat http://tomcat.apache.org/tomcat-7.0-doc/setup.html ),并且您可以从Mac中的终端或Windows中的命令提示符运行应用程序以便服务器开始在此端口上运行应用程序。然后,您可以在服务器端口上的浏览器中访问服务(假设服务就像Web应用程序一样)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM