cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache CXF Documentation > Embedding CXF inside Spring
Date Wed, 14 Sep 2011 02:40:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/2042/9/1/_/styles/combined.css?spaceKey=CXF20DOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Embedding+CXF+inside+Spring">Embedding
CXF inside Spring</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~dkulp">Daniel
Kulp</a>
    </h4>
        <br/>
                         <h4>Changes (2)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >The only module cxf-all won&#39;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
which is specified in the &quot;classpath:META-INF/cxf/cxf-extension-http-jetty.xml&quot;
xml file, and you may not always want to do this. <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >This [mailing list <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">thread|http://www.nabble.com/Need-clarification-on-cxf-servlet.xml-config-file.-td19598828.html#a19602024]</span>
<span class="diff-added-words"style="background-color: #dfd;">thread|http://cxf.547215.n5.nabble.com/Need-clarification-on-cxf-servlet-xml-config-file-td559570.html]</span>
provides more information on CXF Spring files that may need to be imported in your web.xml.
<br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">
<br> <br>{note:title=Changes in CXF 2.4.x} <br>The above is applicable for
CXF versions 2.3.x and older.  Starting in CXF 2.4.0, the extensions are loaded internally
by CXF automatically and you do not need to import all the cxf-extension-*.xml file.   You
only need to import classpath:META-INF/cxf/cxf.xml. <br> <br>{note} <br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <p>You can embed CXF within an existing Spring application. Since all XML configuration
files are Spring xml files, the two approaches should be equivalent. </p>

<p>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:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
&lt;beans xmlns=<span class="code-quote">"http://www.springframework.org/schema/beans"</span>
	<span class="code-keyword">xmlns:xsi</span>=<span class="code-quote">"http://www.w3.org/2001/XMLSchema-instance"</span>
	<span class="code-keyword">xmlns:jaxws</span>=<span class="code-quote">"http://cxf.apache.org/jaxws"</span>
	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"&gt;

	<span class="code-tag">&lt;import resource=<span class="code-quote">"classpath:META-INF/cxf/cxf.xml"</span>
/&gt;</span>
	<span class="code-tag">&lt;import resource=<span class="code-quote">"classpath:META-INF/cxf/cxf-extension-soap.xml"</span>
/&gt;</span>
	<span class="code-tag">&lt;import resource=<span class="code-quote">"classpath:META-INF/cxf/cxf-servlet.xml"</span>
/&gt;</span>
  ...
<span class="code-tag">&lt;/beans&gt;</span>
</pre>
</div></div>

<p>To include all the CXF modules you can use cxf-all or a wildcard expression:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
&lt;beans xmlns=<span class="code-quote">"http://www.springframework.org/schema/beans"</span>
	<span class="code-keyword">xmlns:xsi</span>=<span class="code-quote">"http://www.w3.org/2001/XMLSchema-instance"</span>
	<span class="code-keyword">xmlns:jaxws</span>=<span class="code-quote">"http://cxf.apache.org/jaxws"</span>
	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"&gt;

	<span class="code-tag">&lt;import resource=<span class="code-quote">"classpath:META-INF/cxf/cxf.xml"</span>
/&gt;</span>
	<span class="code-tag">&lt;import resource=<span class="code-quote">"classpath*:META-INF/cxf/cxf-extension-*.xml"</span>
/&gt;</span>
  ...
<span class="code-tag">&lt;/beans&gt;</span>
</pre>
</div></div>

<p>The only module cxf-all 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 which is specified in the "classpath:META-INF/cxf/cxf-extension-http-jetty.xml"
xml file, and you may not always want to do this.</p>

<p>This <a href="http://cxf.547215.n5.nabble.com/Need-clarification-on-cxf-servlet-xml-config-file-td559570.html"
class="external-link" rel="nofollow">mailing list thread</a> provides more information
on CXF Spring files that may need to be imported in your web.xml.</p>


<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/warning.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><b>Changes in CXF 2.4.x</b><br
/>The above is applicable for CXF versions 2.3.x and older.  Starting in CXF 2.4.0, the
extensions are loaded internally by CXF automatically and you do not need to import all the
cxf-extension-*.xml file.   You only need to import classpath:META-INF/cxf/cxf.xml.</td></tr></table></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Embedding+CXF+inside+Spring">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=62417&revisedVersion=7&originalVersion=6">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Embedding+CXF+inside+Spring?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message