我必须做自定义JAXB外部映射文件。
关于此的已经为tutorial红色,并且找不到任何合适的JAXB定制示例。我的情况是,我有两个WSDL文件,主WSDL和辅助WSDL,它们包含在主WSDL文件中。在辅助WSDL文件中,有一个complexType定义,该定义具有我要自定义的名称。该complexType的BTW名称为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文件的第二行是两个属性schemaLocationnode。属性schemaLocation是否需要指向主WSDL或辅助WSDl?并且属性node是想要的complexType的精确路径(XPath)还是这样? XPath(node属性)中的名称空间又是什么,必须是xs还是什么?而typesschema1schemaLocation中实际上代表什么呢?
谢谢

最佳答案

在研究同一个问题时,我遇到了您的问题。

在此页面上找到一些模糊的提示:http://jaxb.java.net/guide/Dealing_with_errors.html

该页面底部建议“空目标节点”消息的原因。

关于binding - ws jaxb定制外部映射,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7031904/

10-14 08:47