jax-wsglassfish-3java-metro-frameworkjax-ws-customization

How to customize the JAXWS mapping of an SOAP operation whose name is reserved in Java


I'm trying to compile a wsdl from a partner with JAX-WS 2.2.6 embedded in GlassFish 3.1.2.2 and get the following compilation error:

 [wsimport] [ERROR] Invalid operation "Void", it's java reserved word, can't generate java method. Use customization to change the operation name.

So I tried to map this operation name to another Java method name via a custom JAXWS binding file:

<?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>

but it doesn't seem to recognize this method element:

 [wsimport] [ERROR] invalid extension element: "jaxws:method" (in namespace "http://java.sun.com/xml/ns/jaxws")

I'm a bit at loss as this is the correct namespace and is exactly as documented in section 9.2.7.1 of https://jax-ws.java.net/nonav/2.2.6/docs/ch03.html#standard-customizations

It's not an xpath issue as if I alter the node, then I get another error that the "XPath evaluation results in an empty target node".

Any idea? Thanks!


Solution

  • I had the same problem but helped to change xPath. Replace wsdl:binding by wsdl:portType

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