如何自定义名称以Java保留的SOAP操作的JAXWS映射

时间:2013-11-25 22:53:06

标签: jax-ws glassfish-3 java-metro-framework jax-ws-customization

我正在尝试使用嵌入在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-customizations

第9.2.7.1节所述

这不是一个xpath问题,好像我改变了节点,然后我得到另一个错误,“XPath评估导致一个空的目标节点”。

有什么想法吗? 谢谢!

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,但帮助改变了xPath。将wsdl:binding替换为wsdl:portType

wsdl:definitions/wsdl:portType[@name='xxx']/wsdl:operation[@name='yyy']