【问题标题】:wsgen generating WSDL using @WebMethod but ignoring @WebParamwsgen 使用 @WebMethod 生成 WSDL 但忽略 @WebParam
【发布时间】:2012-09-17 05:22:50
【问题描述】:

我正在使用 @WebService@WebMethod@WebParam 注释从 Java 类生成 WSDL。 WSDL 已生成,并包括@WebService@WebMethod 的输出,但@WebParam 注释似乎被忽略了。

这是一个解决此问题的方法声明:

@WebMethod(action = "jmsServiceInitialise")
public boolean jmsServiceInitialise(
        @WebParam(name = "queue") String queueName, 
        @WebParam(name = "channel") String channel, 
        @WebParam(name = "hostname") String hostName, 
        @WebParam(name = "port") String port, 
        @WebParam(name = "requiresresponse") boolean requiresResponse) {
    log.info("jmsServiceInitialise " + queueName + ": started");
    // etc
    return returnValue;
}

WSDL 文件没有提及任何参数,但方法是存在的。该方法可以作为web服务调用,但是String参数值都是null

我最初在 Eclipse 中遇到了这个问题,但后来在命令行(Windows,JAX-WS RI 2.2.4-b01)复制了 wsgen 的问题并得到了相同的结果。

我错过了什么?

谢谢。

【问题讨论】:

    标签: java wsdl wsgen


    【解决方案1】:

    在方法中添加@WebResult注解,在@WebMethod注解之后

    制作@WebMethod(operationName = "jmsServiceInitialise") 而不是 action

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多