|
Page Edited :
CXF20DOC :
Configuration
Configuration has been edited by Andrea Smyth (May 22, 2007). Content:Supplying a Configuration file to CXFCXF can discover XML configuration files which you have written. The default location that CXF will look for a configuration for is "/cxf.xml" on the classpath. If you wish to override this location, you can specify a command line property: -Dcxf.config.file=some_other_config.xml. A CXF configuration file is really a Spring <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <!-- Configuration goes here! --> </beans> If you are new to Spring or do not desire to learn more about it, don't worry, you won't have to. The only piece of Spring that you will see is the <beans> element outlined above. Simply create this file, place it on your classpath, and add the configuration for a component you wish to configure (see below). What can I configure and how do I do it?If you want to change CXF's default behaviour, enable specific functionality or fine tune a component's behaviour, you can in most cases do so without writing a single line of code, simply by supplying a Spring configuration file. The following sections explain how you can enable and/or configure the various components in CXF:
Embedding CXF inside SpringYou can also embed CXF within an existing Spring application. Since all XML configuration files are Spring xml files, the two approaches should be equivalent. CXF includes Spring configuration files which configure the various CXF modules. You will want to import these into your application. Here is an example that imports the core CXF components, the SOAP binding, and the servlet transport: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd"> <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> ... </beans> To include all the CXF modules you can use a wildcard _expression_: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schema/jaxws.xsd"> <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath*:META-INF/cxf/cxf-extension-*.xml" /> ... </beans> The only module this won't include is the servlet transport. If you want to include the servlet transport you must specify it specifically. This is because it will tell CXF to no longer use the standalone HTTP transport, and you may not always want to do this. Advanced ConfigurationIf you are writing your own component for CXF, please see Configuration for Developers page. |
Unsubscribe or edit your notifications preferences
