Skip to main content

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

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2011-03-24

I'm trying to compile a wsdl from a partner with JAX-WS 2.2.6 embedded in GlassFish 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=""

  <jaxws:bindings node="wsdl:definitions/wsdl:binding[@name='BasicHttpBinding_BasicOperations']/wsdl:operation[@name='Void']">
    <jaxws:method name="voidTx"/>


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

 [wsimport] [ERROR] invalid extension element: "jaxws:method" (in namespace "")

I'm a bit at loss as this is the correct namespace and is exactly as documented in section of

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!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2010-03-11

Instead of customize the binding/operation, try change the customization target node to be the portType operation as the following example: Service Endpoint Interface Methods

wsimport will generate a method named add instead of the default addNumbers in this example:

<!-- wsdl:portType operation customization -->
<bindings       node="wsdl:definitions/wsdl:portType[@name='AddNumbersImpl']/wsdl:operation[@name='addNumbers']">
    <!-- change java method name from addNumbers() to add() -->
    <method name="add">
        <javadoc>Adds the numbers</javadoc>