我需要在 WebSphere Application Server (Liberty Profile) 上运行 Web 服务,以便获取 wsdl 并使用它在 SoapUI 上进行测试。 我正在 Eclipse Luna 上使用 WebSphere Developer Tools。
我有这个网络服务的代码,如下:
Communicate.java
package xpto;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public interface Communicate {
@WebMethod String initiate(String var);
}
CommunicateImpl.java
package xpto;
import javax.jws.WebService;
@WebService(endpointInterface = "xpto.Communicate")
public class CommunicateImpl implements Communicate {
@Override
public String initiate(String var){
System.out.println("Communicating");
return "S";
}
}
现在,我应该如何运行 Web 服务并获取 wsdl 文件?
最佳答案
您可以在 Eclipse 中检查您的 Web 服务名称。展开您的 Web 项目,然后展开 JAX-WS Web Services > Web Services
。您的服务可能称为 CommunicateImplService
,因此 wsdl 应该可以通过以下方式访问: http://host:port/context/serviceName?wsdl
在您的情况下可能是 CommunicateImplService? wsdl
。另请确保您的项目已添加到服务器。
关于Java WebService - WebSphere 应用程序服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28153099/