开发了一个web服务,下面是步骤
1)创建Web服务端点接口。
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
//Service Endpoint Interface
@WebService
@SOAPBinding(style = Style.RPC)
public interface HelloWorld{
@WebMethod String getHelloWorldAsString(String name);
}import javax.jws.WebService;
//Service Implementation
@WebService(endpointInterface = "com.abc.ws.HelloWorld")
public class HelloWorldImpl implements HelloWorld{
@Override
public String getHelloWorldAsString(String name) {
return "Hello World JAX-WS " + name;
}
}进口javax.xml.ws.Endpoint;进口com.abc.ws.HelloWorldImpl;
//Endpoint publisher
public class HelloWorldPublisher{
public static void main(String[] args) {
Endpoint.publish("http://localhost:9999/ws/hello", new HelloWorldImpl());
}
}现在,我还通过这个URL“http://localhost:9999/ws/hello?wsdl””访问生成的WSDL ()文档来测试部署的web服务。
但我的疑问是,随着我对云世界的熟悉,我想将我的web服务部署到云上,比如amazon,这样如果我向世界上的任何人提供wsdl,他就可以通过他的浏览器访问我的wsdl,因为我的web服务部署在云上。
请告诉我如何做到这一点!
发布于 2015-01-27 18:58:21
当您将应用程序部署到云中的真正服务器时,这种方法将无法工作,因为您无法执行main方法来发布web服务。
当应用程序在服务器上启动时,您需要配置一些东西来发布web服务。
例如,使用Spring在Tomcat上运行Service,您需要注入Web并使用SimpleJaxWsServiceExporter bean发布它,这些配置是在您的application-context.xml上实现的,或者类似的配置。
在您的例子中,看看这个链接,它是如何使用JAX发行版发布WSDL服务的一个示例。
对于测试,可以将WAR应用程序部署到Openshift。
希望它能帮上忙,最好的问候。
https://stackoverflow.com/questions/12465026
复制相似问题