我的外部绑定文件中的XPath表达式无法定向到我的XML模式中导入到我的WSDL中的元素。将外部JAXB绑定文件应用于从WSDL导入的模式元素
如果我执行内联绑定自定义,所有内容都会运行,但我真的希望拥有外部绑定文件,这样我就不会意外覆盖(刷新)包含我的自定义项的文件。
我约束力文件的开头:
<jaxb:bindings
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
version="2.1">
<jaxb:bindings schemaLocation="../wsdl/localhost_7001/ExampleSessionBean/ExampleSessionBeanService.wsdl#types?schema1">
<jaxb:bindings node="//xs:schema[@targetNamespace='urn:myExample']">
我的WSDL包含:
<types>
<xsd:schema>
<xsd:import namespace="urn:myExample" schemaLocation="http://localhost:7001/ExampleSessionBean/ExampleSessionBeanService?xsd=1"/>
</xsd:schema>
<xsd:schema>
<xsd:import namespace="http://ejbs/" schemaLocation="http://localhost:7001/ExampleSessionBean/ExampleSessionBeanService?xsd=2"/>
</xsd:schema>
</types>
不管我做什么的XPath找不到的XSD东西:import'ed模式。我得到的错误是:
[ERROR] XPath evaluation of "//xs:schema[@targetNamespace='urn:myExample']" results in empty target node
我试过访问XS:通过索引号,而不是命名空间的架构,并且也不管用。看起来我的XPath表达式无法到达导入架构的元素......有无论如何解决这个问题?
这是一个在NetBean 7.2下开发的Java SE 7项目。我使用NetBeans来完成我所有的wsimport工作,但是这个命令的输出对于RI/Metro来说看起来相当标准。
编辑: 我想如果我使用SCD,我可以得到一个外部绑定文件的工作。此XPath示例不起作用:
<bindings node="//xsd:schema[@targetNamespace='urn:myExample']">
<bindings node="//xs:complexType[@name='myType']">
<class name="MyClass"/>
</bindings>
</bindings>
但是这个SCD示例的确如此。
<bindings scd="x-schema::tns" xmlns:tns="urn:myExample">
<bindings scd="~tns:myType">
<class name="MyClass"/>
</bindings>
</bindings>
这是一个众所周知的事情,XPath在使用wsimport时不能在xjb文件中工作,但是SCD会这样吗?
我尝试这样做。但是现在我得到下面的错误'SCD“〜tns:myelement”没有匹配任何模式组件' – wib 2015-09-11 06:01:19