- Create one simple maven base project in Eclipse.
- Save your wsdl file in the resource directory with WSDL extension. Make sure about the extension
- Copy following build and dependencies tag.
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>src/main/java</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/TestService.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-tools-common</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-simple</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
</dependencies>
<properties>
<cxf.version>2.7.7</cxf.version>
</properties>
- build maven project “mvn clean install -DskipTests”
- Use service class to get ServiceImplPort class. Then call your method. E.g. testService.getTestServiceImplPort().getTest();
- In your portlet pom file. Add dependency for your maven project your have created in first step.
- Build your portlet with maven. Jar file for the services will be copied in the lib of portlet war file.
To Read more about CXF, Please visit
http://cxf.apache.org/docs/using-cxf-with-maven.html
0 comments:
Post a Comment