apache的CXF現在幾乎成了Java領域構建Web Service的首選類庫,並且它也確實簡單易用,下面就通過幾篇系列文章做一下簡單介紹。
當然首先想到的當然還是那個Hello World示例。這個系列文章中用到的例子都是基於Maven構建的工程,下面是我的pom.XML文件內容
1 2 下一頁>> 內容導航 第 1 頁:pom.XML文件內容 第 2 頁:HelloWorld的具體例子
- <project XMLns="http://maven.apache.org/POM/4.0.0" XMLns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.googlecode.garbagecan.cxfstudy</groupId>
- <artifactId>cxfstudy</artifactId>
- <packaging>war</packaging>
- <version>1.0-SNAPSHOT</version>
- <name>cxfstudy Maven Webapp</name>
- <url>http://maven.apache.org</url>
- <propertIEs>
- <cxf.version>2.2.7</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-transports-http-jetty</artifactId>
- <version>${cxf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-ws-security</artifactId>
- <version>${cxf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-ws-policy</artifactId>
- <version>${cxf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-bundle-jaxrs</artifactId>
- <version>${cxf.version}</version>
- </dependency>
- <dependency>
- <groupId>Javax.ws.rs</groupId>
- <artifactId>JSr311-api</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.5.8</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-jdk14</artifactId>
- <version>1.5.8</version>
- </dependency>
- <dependency>
- <groupId>commons-httpclIEnt</groupId>
- <artifactId>commons-httpclIEnt</artifactId>
- <version>3.0</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>1.4</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencIEs>
- <build>
- <finalName>cxfstudy</finalName>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- <resource>
- <directory>src/main/Java</directory>
- <includes>
- <include>**</include>
- </includes>
- <excludes>
- <exclude>**/*.Java</exclude>
- </excludes>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
- <configuration>
- <contextPath>/</contextPath>
- <connectors>
- <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
- <port>9000</port>
- </connector>
- </connectors>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </project>