0

我尝试使用 JavaSE 1.6 在 Eclipse 中编译一个 webservice 项目。

在项目中,我使用了很多从 WSDL 创建的类。

The error message is:

cannot find symbol
    [javac] symbol  : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
    [javac] location: class javax.xml.ws.Service

源代码(从 WSDL 编译的类:

/**
 * This class was generated by the JAX-WS RI.
 * JAX-WS RI 2.2.4-b01
 * Generated source version: 2.2
 * 
 */

.....

    public IfaceService(WebServiceFeature... features) {
       **super(__getWsdlLocation(), IFACESERVICE_QNAME, features);**
    }


I read in another tread there are problems with JAX-WS version 2.1 in some cases. Therefore I tried different versions in the ivy config file.

    <info organisation="de.os.osvk.ech" module="my Project"
        status="integration" revision="0.1">
    </info>
    <dependencies>  
        <dependency org="com.google.inject" name="guice" rev="3.0"/>
        <dependency org="com.google.inject.extensions" name="guice-servlet" rev="3.0"/>

        <dependency org="org.glassfish.ha" name="ha-api" rev="3.1.8">
            <artifact name="ha-api" ext="jar" type="jar"/>
            <exclude org="com.sun.enterprise" module="hk2"/>
        </dependency>
        <dependency org="com.sun.xml.ws" name="jaxws-tools" rev="2.2.7"/> 
        <dependency org="javax.ws.rs" name="jsr311-api" rev="1.1.1"/>
        <dependency org="com.sun.jersey" name="jersey-core" rev="1.7" />
        <dependency org="javax.transaction" name="jta" rev="1.1"/>
        <dependency org="javax.xml.ws" name="jaxws-api" rev="2.1.1"></dependency>
        <dependency org="org.quartz-scheduler" name="quartz" rev="1.7.3" conf="*->*,!sources">
            <exclude org="javax.ejb" />
            <exclude org="javax.mail" />
            <exclude org="javax.servlet" />
            <exclude org="org.apache.openejb" />
            <exclude org="junit" />
            <exclude org="javax.jms" /> 
        </dependency> 

        <dependency org="xalan" name="xalan" rev="2.7.1"/>
        <dependency org="org.eclipse.jetty" name="jetty-servlet" rev="7.4.4.v20110707"/>
    </dependencies> 
</ivy-module>

javax.xml.ws or jaxax.xml.binding我必须针对哪些版本使用 zu compile JAX-WS RI 2.2.4-b01 (Java code from WSDL)

4

3 回答 3

0

dependency org="javax.xml.ws" name="jaxws-api" rev="2.1.1"是可疑的 - 你可能需要 2.2.x。但是,Java SE 6 包含旧版本的 JAX-WS API。您可能需要阅读https://weblogs.java.net/blog/ramapulavarthi/archive/2009/04/tip_for_using_j.html

于 2013-06-17T12:46:57.017 回答
0

在%JAVA_HOME%\jre\lib\endorsed中单独添加webservices-api-2.2.jar为我解决了问题。

于 2014-05-22T10:56:12.857 回答
0

You should use jdk1.6.0_35 to generate WSDL.

于 2013-10-02T10:10:27.880 回答