Java – wsimport generates incorrect code

I use wsimport to generate my java stub file To do this, I used an ant build file in Eclipse:

<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
    <classpath>
        <fileset dir="../lib">
            <include name="jaxws-tools.jar" />
        </fileset>
    </classpath>
</taskdef>

<target name="generate">
    <wsimport wsdl="../wsdl/KNowledgebase.wsdl"
              destdir="../bin"
              sourcedestdir="../gen"
              keep="true"
              xendorsed="true">
    </wsimport>
</target>

The task runs without any errors It creates different java files, as well as knowledgebase Java and knowledgebaseport java. In the knowledge base In Java, there are the following constructors:

public KNowledgebase(WebServiceFeature... features) {
    super(__getWsdlLocation(),KNowLEDGEBASE_QNAME,features);
}

For them, I get an error "constructor service (...) is undefined" I imported the current Jax WS jar file Is my build process corrupted, is the wrong jar used, or where is the error?

Solution

The service object is provided by the Java EE SDK It adds a new constructor between Java EE 5 and Java EE 6 It seems that the wsimport you are using is from the Java EE 6 JDK and the compiler is using the Java EE 5 SDK?

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>