简体   繁体   English

在服务器上部署Java SE6独立Web服务

[英]Deploying Java SE6 stand alone web service on a server

Follwing the steps as outlined here: Standalone web service 遵循此处概述的步骤: 独立的Web服务

I created a test web service that works great on my local machine. 我创建了一个测试Web服务,该服务在我的本地计算机上运行良好。 Since this is 'stand alone' I copied the same root folder on to a 'server' that I use and published the service on the server (as if it is my local machine). 由于这是“独立的”,因此我将相同的根文件夹复制到了我使用的“服务器”上,并在服务器上发布了该服务(就像它是我的本地计算机一样)。 When I access the wsdl using localhost as the domain name, it works fine on the server. 当我使用localhost作为域名访问wsdl时,它在服务器上工作正常。 However, when I try the url from a different macihne on the network giving the server's domain name instead of localhost, I get a 'can not be displayed' error in IE. 但是,当我尝试从网络上提供服务器域名而不是localhost的另一个Macihne获取URL时,在IE中出现“无法显示”错误。

My question is, should this even be possible? 我的问题是,这是否有可能? Or is there anything specific that needs to be done. 还是有什么需要做的具体事情。 Since this is a 'stand alone' solution, we should not require 'another' container like tomcat correct? 因为这是一个“独立”解决方案,所以我们不应该要求像tomcat这样的“另一个”容器正确吗?

To be honest, until your post, I had no idea there was a builtin, lightweight, HTTP Server in the JDK. 老实说,直到您发表文章,我都不知道JDK中有一个内置的,轻量级的HTTP Server。 I've always used glassfish for my web service needs. 我一直都使用glassfish来满足我的Web服务需求。

I can't say for sure, but if you look closely at the example code you'll see: 我不能肯定地说,但是如果您仔细查看示例代码,将会看到:

Endpoint endpoint = Endpoint.publish("http://localhost:8080/calculator", calculator);

I suspect that this limits you to "localhost" as opposed to the host machine. 我怀疑这会将您限制为“ localhost”,而不是主机。 Try changing it so that it represents the name of the server and try again from another machine (naturally making sure it can get through the firewall as well). 尝试对其进行更改,使其代表服务器的名称,然后从另一台计算机重试(自然确保它也可以通过防火墙)。 Something like: 就像是:

Endpoint endpoint = Endpoint.publish("http://myserver:8080/calculator", calculator);

Rebuild it and try again. 重建它,然后再试一次。 Other than that, you'd need to create a proper war file and deploy to glassfish, tomcat, etc. 除此之外,您还需要创建一个适当的war文件并将其部署到glassfish,tomcat等。

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

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