Skip to main content
Kofax

Import is a reserved word in Java error when importing the KIC WSDL into custom Java KIC Web Service client

19736

QAID # 19736 Published 

Question / Problem:

I am creating a Java Web Service client for Kofax Import Connector - Web Services, (KIC-WS).

When attempting to import the WSDL file included with the KIC package, an error occurs stating that "Import" is a reserved word in Java:

C:\Jars>wsimport -keep -verbose wsclient.jar mywsdl.wsdl parsing WSDL...
[ERROR] Invalid operation "Import", it's java reserved word, can't generate java
method. Use customization to change the operation name.
line 331 of file:/C:/Jars/mywsdl.wsdl

Answer / Solution:

To generate the client JAR files:

wsimport -keep http:/localhost:25086/file/import?wsdl -b Binding.xml

Contents of Binding.xml:

<jaxws:bindings
    wsdlLocation="http://localhost:25086/file/import.wsdl?wsdl"
    xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    <jaxws:bindings
        node="wsdl:definitions/wsdl:portType[@name='importPortType']/wsdl:operation[@name='Import']">
        <jaxws:method name="ImportToKofaxCapture" />
    </jaxws:bindings>
</jaxws:bindings>

The signature of the Import call changes in the Java client. Note below the difference between the C# and Java versions:

  • C#
    • ImportResponse resp = <object of type importService>.Import(<object of type Import>);
  • Java
    • ImportResponse resp = <object of type ImportPortType>.ImportToKofaxCapture(<object of type Import, empty byte array (byte[])>);

Applies to:

Product Version
KIC 2.3