GlassFish 3.1.2.2 に埋め込まれた JAX-WS 2.2.6 を使用してパートナーから wsdl をコンパイルしようとすると、次のコンパイル エラーが発生します。
[wsimport] [ERROR] Invalid operation "Void", it's java reserved word, can't generate java method. Use customization to change the operation name.
そこで、カスタム JAXWS バインディング ファイルを介して、この操作名を別の Java メソッド名にマップしようとしました。
<?xml version="1.0" encoding="utf-8"?>
<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
wsdlLocation="https://partner.com/BasicOperationsService?wsdl">
<jaxws:bindings node="wsdl:definitions/wsdl:binding[@name='BasicHttpBinding_BasicOperations']/wsdl:operation[@name='Void']">
<jaxws:method name="voidTx"/>
</jaxws:bindings->
</jaxws:bindings>
しかし、このメソッド要素を認識していないようです:
[wsimport] [ERROR] invalid extension element: "jaxws:method" (in namespace "http://java.sun.com/xml/ns/jaxws")
これは正しい名前空間であり、 https: //jax-ws.java.net/nonav/2.2.6/docs/ch03.html#standard- のセクション 9.2.7.1 に記載されているとおりであるため、少し迷っています。カスタマイズ
ノードを変更したかのように xpath の問題ではなく、「XPath 評価の結果、ターゲット ノードが空になります」という別のエラーが発生します。
何か案が?ありがとう!