拥有 JAXB-RI 和 CXF。首先是 WSDL。我想要一个生成的类来实现 Serializable
.我现在有以下有效的绑定(bind) xml(SEI 类名称已更改)
<jaxws:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema" ...>
<bindings node="wsdl:definitions/wsdl:portType[@name='Foo']">
<!-- change the generated SEI class -->
<class name="IFooService" />
</bindings>
</jaxws:bindings>
不,在这种情况下,我应该在哪里添加什么。我试过:
<xsd:annotation>
<xsd:appinfo>
<jaxb:globalBindings>
<xjc:serializable uid="12343" />
</jaxb:globalBindings>
</xsd:appinfo>
</xsd:annotation>
和
<jxb:globalBindings>
<jxb:serializable/>
</jxb:globalBindings>
内外<bindings>
标签 - Serializable
没有添加,或者根本没有生成类(没有任何错误)。
另见 this thread
那么,具体怎么做
最佳答案
我通过两种方式让它工作:
使用仅 JAXB 的第二个绑定(bind)文件,如 his answer 中所示的 Pascal。
通过指定另一个
<bindings>
处理整个命名空间的标签:<bindings node="wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='http://www.yoursite.com/services/mynamespace']"> <jxb:globalBindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <jxb:serializable /> </jxb:globalBindings> </bindings>
关于java - JAXB 生成的可使用 JAX-WS 绑定(bind)序列化的类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4791891/