【问题标题】:Apache CXF Enum gives jaxbexceptionApache CXF Enum 提供 jaxbexception
【发布时间】:2011-12-08 08:25:30
【问题描述】:

我创建了一个 CXF 网络服务,所有方法都可以工作,除了参数是枚举的方法。我已经使用 wsdl2java 命令生成了我的 javaclient 代码。

public enum OrderDirection {
    DESC, ASC;

    public String value() {
        return name();
    }
}

当我尝试运行时,例如 getAllUsers(orderBy, OrderDirection.DESC);我得到一个例外:

[javax.xml.bind.JAXBException: class com.tdr.wsclient.OrderDirection nor any of its super class is known to this context.]

OrderDirection 枚举的 wsdl 定义如下所示:

  <xs:simpleType name="orderDirection">
    <xs:restriction base="xs:string">
      <xs:enumeration value="DESC"/>
      <xs:enumeration value="ASC"/>
    </xs:restriction>
  </xs:simpleType>

【问题讨论】:

    标签: java soap cxf


    【解决方案1】:

    这是我的界面中的错误。我在一次酸痛的旅行中这样定义了我的枚举:

    List<User> getAllUsers(String orderBy, Enum<OrderDirection> direction);
    

    应该是这样的:

    List<User> getAllUsers(String orderBy, OrderDirection direction);
    

    【讨论】:

      猜你喜欢
      • 2012-04-03
      • 1970-01-01
      • 2014-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多