我必须做自定义 JAXB 外部映射文件。已经有关于这个的红色教程并且找不到任何合适的 JAXB 自定义示例。我的场景是我有两个 WSDL 文件,主 WSDL 和辅助 WSDL,它们包含在主文件中。在辅助 WSDL 文件中是一个complexType
定义,它有一个我想要自定义的名称。顺便说一句,该 complexType 的名称是objectFactory
. 所以现在你知道我真正需要的外部定制是什么了。
我已经走了这么远,当我运行 wsimport path-to-my-main-wsdl -b customBindings.jaxb
输出就像
[ERROR] XPath evaluation of "//xs:complexType[@name='objectFactory']" results in empty target node
line 2 of file:/customBindings.jaxb
文件customBindings.jaxb
看起来像
<jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jxb:bindings schemaLocation="path-to-my-secondary-wsdl#types?schema1" node="//xs:complexType[@name='objectFactory']">
<jxb:class name="MyObjectFactory" />
</jxb:bindings>
</jxb:bindings>
在我的customBindings.jaxb
文件的第二行是两个属性schemaLocation
和node
. 属性是否schemaLocation
需要指向主 WSDL 或辅助 WSDl?并且属性node
是想要的 complexType 的确切路径(XPath)还是这样?XPath(node
属性)中的名称空间是什么,它必须是xs
什么?实际上这types
和schema1
代表schemaLocation
什么?
谢谢