CXF是开发webservice很流行的框架,http://cxf.apache.org/download.html是CXF官网下载地址,下载解压以后会发现lib中有很多包,在项目中不知道该使用哪些包,其实在lib中有一个文件WHICH_JARS,该文件将在什么情况下使用哪些包都说的很清楚了,下面就是2.7.18版本下的该文件内容:
This directory includes the CXF jar, the CXF manifest jar, the required
dependencies, and many optional dependencies. The "modules" directory
contains the cxf.jar split up into smaller pieces if you wish to use only
specific parts of CXF.
The 'manifest jar' is a jar containing only a MANIFEST.MF with a classpath
that calls in all the other jar.
Jars marked with a [6] at the end are optional for Java 6 (update 4 or
later is supported) as the functionality provided by those jars are
provided in the JDK.
Some users may prefer to use axis2-saaj.jar rather than saaj-impl.jar. Both are
supported.
The following jars are required for all CXF usage:
- cxf.jar
- commons-logging.jar
- geronimo-activation.jar (Or the Sun equivalent) [6]
- geronimo-annotation.jar (Or the Sun equivalent) [6]
- geronimo-javamail.jar (Or the Sun equivalent) [6]
(MAY be able to remove javamail if you don't use any MTOM/SAAJ type things)
- neethi.jar
- jaxb-api.jar [6]
- jaxb-impl.jar (this is a [6] for normal runtime, but is required for
tooling and the dynamic clients)
- xmlschema-core.jar
- woodstox-core-asl.jar
- stax2-api-3.0.1.jar
- wsdl4j.jar
上述这些包即为构建webservice时所需的最少包,在项目实现client时经过测试可以调试通过,以下是实际项目中所用到的CXF项目包(client):
Note: woodstox and stax2-api can be removed if you set the
"org.apache.cxf.stax.allowInsecureParser” system property to true. This
is NOT recommended as it opens up various DOS attacks.
The following jars are required for XML catalog support:
- xml-resolver.jar
For Java2WSDL and WSDL2Java:
- The above jars
- jaxb-xjc.jar
- velocity.jar
- commons-collections.jar
- commons-lang.jar
- cxf-xjc*.jar (optional, these are xjc extensions for providing enhanced
JAXB code generation)
For JAX-WS support:
- geronimo-jaxws_2.2_spec-1.0.jar (Or the Sun equivalent) [6]
- saaj-api.jar [6]
- saaj-impl.jar [6]
- asm.jar (semi-optional, helps with performance of wrapper types and is
required when adding JAXB annotations onto the SEI methods and
parameters.)
For XML Configuration support:
- aopalliance.jar
- spring-beans.jar
- spring-context.jar
- spring-core.jar
- FastInfoset.jar
For hosting web services within WARs while using Spring-based CXFServlet:
- spring-web.jar
For standalone HTTP support:
- geronimo-servlet.jar
- jetty-*.jar
- sl4j.jar & sl4j-jdk14.jar (optional - but improves logging)
For Aegis support:
- jdom.jar (optional, if you want to map xsd:anyType to JDOM)
For XmlBeans databinding support:
- xmlbeans.jar
For WS-Security support:
- bcprov-jdk15.jar (optional depending on algorithms used)
- wss4j.jar
- xmlsec.jar
- ehcache-core.jar
For SAML support in WS-Security
- joda-time.jar
- opensaml.jar
- openws.jar
- xmltooling.jar
For JAX-RS support:
- abdera* (optional: for AtomPub support, but also needed for the
Management log browser console)
- commons-codec.jar (Needed for Abdera)
- jaxen.jar (Needed for Abdera)
- axiom* (Needed for Abdera)
- javax.ws.rs-api.jar
- jettison.jar (Needed for JSON services only)
- oauth*.jar (Needed for OAuth support)
For JMS transport
- geronimo-jms.jar (Or the Sun equivalent)
- spring-jms.jar
- spring-tx.jar
For the UDP transport
- mina-core.jar
For the Async HTTP client transport
- commons-codec.jar
- httpasyncclient.jar
- httpcore.jar
- httpclient.jar
- httpcore-nio.jar
For CORBA support:
- antlr.jar
For JavaScript functionality:
- js.jar
For schema validation with the Aegis data binding.
- msv-core.jar (version 2011.1)
- xsdlib.jar (version 2010.1)
- isorelax.jar (version 20030108)
- relaxngDatatype.jar (version 20020414)
For the WS-Notification Service:
- cxf-services-wsn-api.jar
- cxf-services-wsn-core.jar
For the CXF Security Token Service:
- cxf-services-sts-core.jar
For the WS-Discovery Service
- cxf-ws-discovery-api.jar
- cxf-ws-discovery-service.jar