外部バインディングファイルのXPath式は、WSDLにインポートされたXMLスキーマの要素をターゲットにできません。
インラインバインディングのカスタマイズを行うとすべてが実行されますが、カスタマイズを含むファイルを誤って上書き(更新)しないように、外部バインディングファイルが必要でした。
バインディングファイルの開始:
<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されたスキーマで何も見つけることができません。私が得るエラーは次のとおりです。
[ERROR] XPath evaluation of "//xs:schema[@targetNamespace='urn:myExample']" results in empty target node
名前空間の代わりにインデックス番号でxs:schemaにアクセスしようとしましたが、それも機能しません。XPath式がインポートされたスキーマの要素に到達できないようです...これを修正する方法はありますか?
これは、NetBean7.2で開発されているJavaSE7プロジェクトです。それが重要な場合は、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>
これは、wsimportを使用しているときにXPathがxjbファイルで機能しないが、SCDは機能するという既知のことですか?