Question

I have just successfully used a wsimport/xjc plugin named xew with maven, using this post.

Using Maven for this at my company is currently not an option, so I'm trying to use the wsimport utility from the Java 7 SDK.

How do I tell wsimport to include the xew xjc plugin when importing my WSDL?

My current command line is:

wsimport -Xdebug -s src\main\java -d target\classes -extension -B-extension -B-classpath target\dependency\*:. -B-Xxew:instantiate lazy -B-Xxew:delete src\main\java\test.wsdl

It won't eat the -B parameters yet though: no such JAXB option: -Xxew. The xew plugin and jaxb-xjc.jar are in the working directory and on the system CLASSPATH.

Was it helpful?

Solution

I went along and used Ant to convert my WSDL to code. For this, I downloaded jaxws-ri version 2.2.8 and came up with the following Ant script, which works. Now I can use the maven-antrun-plugin to call on the script.

<project>

    <property name="jaxws.home" location="lib/jaxws-ri" />

    <path id="jaxws.classpath">
        <fileset dir="${jaxws.home}/lib" includes="jaxws-tools.jar" />
    </path>

    <taskdef classpathref="jaxws.classpath" name="wsimport" classname="com.sun.tools.ws.ant.WsImport" />

    <wsimport keep="true" sourcedestdir="src/main/java" destdir="target/classes" extension="true" wsdl="src/main/java/test.wsdl">
        <xjcarg value="-cp" />
        <xjcarg file="lib/commons-logging-api-1.1.jar" />
        <xjcarg value="-cp" />
        <xjcarg file="lib/jaxb-xew-plugin-1.1.jar" />
        <xjcarg value="-Xxew" />
        <xjcarg value="-Xxew:instantiate lazy"/>
        <xjcarg value="-Xxew:delete"/>
    </wsimport>

</project>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top