Hi,
wsdl2java generate code have Service (java .net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[]) is per jaxws 2.2 spec, however java6 build-in jaxws 2.1 api which cause compile error

You have 2 options to work around it

1. endorsed jaxws2.2 and jaxb2.2 api in your jdk, take a look at [1] to get more details 2. as you're using cxf 2.3.3, you can use a new flag for wsdl2java tool introuducd from cxf 2.3.3
wsdl2java -frontend jaxws21
to generate code which is jaxws2.1 api compatible.

Freeman
[1]http://cxf.apache.org/docs/23-migration-guide.html
On 2011-4-14, at 上午2:04, Shelli Orton wrote:

Hi,

I'm brand new to CXF and am trying to create a client from WSDL. I have used Metro and Axis in the past. I downloaded apache-cxf-2.3.3 and used
wsdl2java to generate the client stubs.  I use Maven and set it up my
pom with this:

   <properties>
       <cxf.version>2.3.3</cxf.version>
   </properties>
   <dependencies>
       <dependency>
           <groupId>org.apache.cxf</groupId>
           <artifactId>cxf-rt-frontend-jaxws</artifactId>
           <version>${cxf.version}</version>
       </dependency>
       <dependency>
           <groupId>org.apache.cxf</groupId>
           <artifactId>cxf-rt-transports-http</artifactId>
           <version>${cxf.version}</version>
       </dependency>
       <dependency>
           <groupId>org.apache.cxf</groupId>
           <artifactId>cxf-rt-ws-security</artifactId>
           <version>${cxf.version}</version>
       </dependency>
   </dependencies>
   <build>
       <plugins>
           <plugin>
               <inherited>true</inherited>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-compiler-plugin</artifactId>
               <configuration>
                   <source>1.5</source>
                   <target>1.5</target>
                   <optimize>true</optimize>
                   <debug>true</debug>
               </configuration>
           </plugin>
       </plugins>
   </build>

When I build the project, I get these errors:

[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile
(default-compile) on project client-cxf: Compilation failure:
Compilation failure:
[ERROR]
\Devel\Projects\Client-CXF\src\main\java\my\webservice \ServiceRuntimeExc
eption.java:[38,149] cannot find symbol
[ERROR] symbol  : method required()

and

[ERROR]
\Devel\Projects\Client-CXF\src\main\java\my\snmpv2\MyService.java: [76,8]
cannot find symbol
[ERROR] symbol  : constructor
Service (java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFe
ature[])
[ERROR] location: class javax.xml.ws.Service

The wsdl2java generated code producing the error is:

It appears that the problems are related to the fact that the generated
code uses Java 6 features ("require" element for XmlElementRef, new
constructors for Service) yet the CXF Maven dependencies are for Java 5.

Is there a way to specify that the generated code should be Java 5
compliant?

Thanks!

Shelli




---------------------------------------------
Freeman Fang

FuseSource
Email:[email protected]
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
Connect at CamelOne May 24-26
The Open Source Integration Conference








Reply via email to