【问题标题】:Java WebService - WebSphere Application ServerJava WebService - WebSphere 应用程序服务器
【发布时间】:2015-03-25 01:00:13
【问题描述】:

我需要在 WebSphere Application Server(Liberty Profile)上运行 Web 服务,这样我才能获取 wsdl 并使用它在 SoapUI 上进行测试。 我在 Eclipse Luna 上使用 WebSphere Developer Tools。

我有这个webservice的代码,如下:

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 文件?

【问题讨论】:

  • @vincent 是的,我做到了。我明白了:错误 404:java.io.FileNotFoundException:SRVE0190E:找不到文件:/Communicate
  • 用 CommunicateImpl 代替 Communicate 怎么样?
  • 是的,也试过了。实际上是要在之前的评论中这么说但忘记了。

标签: java web-services wsdl websphere


【解决方案1】:

您可以在 Eclipse 中检查您的 Web 服务名称。然后展开您的 Web 项目 JAX-WS Web Services > Web Services。您的服务可能称为 CommunicateImplService,因此 wsdl 应该可以通过以下方式访问:http://host:port/context/serviceName?wsdl 在您的情况下可能是 CommunicateImplService?wsdl。还要确保您的项目已添加到服务器。

【讨论】:

    【解决方案2】:

    【讨论】:

    • 您是否运行 wsgen 来生成 Web 服务工件。您的 Websphere 开发人员工具可能会提供运行它的选项。
    【解决方案3】:

    创建一个 WAR 文件。在 WEBSPHERE 上部署它。给出上下文路径名,然后访问 url 中的 web 服务 使用 http://ipadress:port/contextpath/webservice name?wsdl

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-12
      • 1970-01-01
      • 2017-08-30
      • 2011-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多