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\ServiceRuntimeException.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.WebServiceFeature[])
[ERROR] location: class javax.xml.ws.Service
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?