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 > Using CXF-JCA RAR in Application Server
Date Fri, 02 Dec 2011 14:49: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/Using+CXF-JCA+RAR+in+Application+Server">Using
CXF-JCA RAR in Application Server</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~dkulp">Daniel
Kulp</a>
    </h4>
        <br/>
                         <h4>Changes (1)</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" >#    <br># jndi_name: The JNDI
name that an external client uses to contact the bean. <br></td></tr>
            <tr><td class="diff-changed-lines" ># ServiceName: The string form
of the QName for the <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">Artix</span>
service in the WSDL file. <br></td></tr>
            <tr><td class="diff-unchanged" ># @url_to_wsdl: The string form of
a URL that identifies the WSDL file. <br># <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="UsingCXF-JCARARinApplicationServer-DeployCXFJCARAR."></a>Deploy
CXF-JCA RAR.</h1>
<p>cxf-integration-jca module has implemented the JCA1.5 outbound connection. You can
see samples in $CXF_HOME/samples/integration/jca.</p>

<style type='text/css'>/*<![CDATA[*/
div.rbtoc1322837287944 {margin-left: 1.5em;padding: 0px;}
div.rbtoc1322837287944 ul {list-style: disc;margin-left: 0px;padding-left: 20px;}
div.rbtoc1322837287944 li {margin-left: 0px;padding-left: 0px;}

/*]]>*/</style><div class='rbtoc1322837287944'>
<ul>
    <li><a href='#UsingCXF-JCARARinApplicationServer-DeployCXFJCARAR.'>Deploy
CXF-JCA RAR.</a></li>
<ul>
    <li><a href='#UsingCXF-JCARARinApplicationServer-BuildCXFJCARAR'>Build CXF-JCA
RAR</a></li>
    <li><a href='#UsingCXF-JCARARinApplicationServer-DeployRARtoJBOSS.'>Deploy
RAR to JBOSS.</a></li>
<ul>
    <li><a href='#UsingCXF-JCARARinApplicationServer-DeploythestandaloneRAR.'>Deploy
the standalone RAR.</a></li>
    <li><a href='#UsingCXF-JCARARinApplicationServer-DeploytheRARinEAR.'>Deploy
the RAR in EAR.</a></li>
</ul>
    <li><a href='#UsingCXF-JCARARinApplicationServer-DeployRARtoWeblogic.'>Deploy
RAR to Weblogic.</a></li>
<ul>
    <li><a href='#UsingCXF-JCARARinApplicationServer-PackageRARinanEAR.'>Package
RAR in an EAR.</a></li>
</ul>
    <li><a href='#UsingCXF-JCARARinApplicationServer-DeployRARtoWebSphere.'>Deploy
RAR to WebSphere.</a></li>
</ul>
    <li><a href='#UsingCXF-JCARARinApplicationServer-UsingJCAConnection.'>Using
JCA Connection.</a></li>
<ul>
    <li><a href='#UsingCXF-JCARARinApplicationServer-GetConnectionfromManagedConnectionFactory.'>Get
Connection from ManagedConnectionFactory.</a></li>
    <li><a href='#UsingCXF-JCARARinApplicationServer-UsingCXFJCARARtoaccesstheStatelessSessionBean.'>Using
CXF-JCA RAR to access the Stateless Session Bean.</a></li>
<ul>
    <li><a href='#UsingCXF-JCARARinApplicationServer-Activatetheejbservant.propertiesfile.'>Activate
the ejb_servant.properties file.</a></li>
</ul>
</ul>
</ul></div>

<h2><a name="UsingCXF-JCARARinApplicationServer-BuildCXFJCARAR"></a>Build
CXF-JCA RAR</h2>
<p>    The jca rar package structure would be:</p>
    <div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>    |---META-INF
    |---META-INF/ra.xml
    |---cxf-api-2.1.jar
    |---cxf-integration-jca-2.1.jar
    |---.....
    </pre>
</div></div>

<p>Refer to this <a href="https://svn.apache.org/repos/asf/incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound/build.xml"
class="external-link" rel="nofollow">build.xml</a> "generate.rar" target for building
rar detail.</p>

<h2><a name="UsingCXF-JCARARinApplicationServer-DeployRARtoJBOSS."></a>Deploy
RAR to JBOSS.</h2>

<h3><a name="UsingCXF-JCARARinApplicationServer-DeploythestandaloneRAR."></a>Deploy
the standalone RAR.</h3>
<p><b>(Note: This has been tested against JBoss4.0.5)</b></p>

<ol>
	<li>You need to put below jars in the $JBOSS_HOME/lib/endorsed.
	<ul>
		<li>geronimo-activation_1.1_spec-1.0-M1.jar</li>
		<li>geronimo-annotation_1.0_spec-1.1.jar</li>
		<li>geronimo-ws-metadata_2.0_spec-1.1.1.jar</li>
		<li>jaxb-api-2.1.jar</li>
		<li>jaxb-impl-2.1.4.jar</li>
		<li>jaxb-xjc-2.1.4.jar</li>
		<li>jsr181-api-1.0-MR1.jar</li>
		<li>saaj-api-1.3.jar</li>
		<li>saaj-impl-1.3.jar</li>
		<li>stax-api-1.0.1.jar</li>
		<li>stax-utils-20060502.jar</li>
	</ul>
	</li>
	<li>Copy the rar to the $JBOSS_HOME/server/default</li>
	<li>Create the cxfj2ee_1_5-ds.xml as below, and copy it to $JBOSS_HOME/server/default
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
&lt;!DOCTYPE connection-factories
    PUBLIC <span class="code-quote">"-//JBoss//DTD JBOSS JCA Config 1.5//EN"</span>
    <span class="code-quote">"http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd"</span>&gt;
<span class="code-tag">&lt;connection-factories&gt;</span>
  <span class="code-tag">&lt;no-tx-connection-factory&gt;</span>
    <span class="code-tag">&lt;jndi-name&gt;</span>CXFConnector<span
class="code-tag">&lt;/jndi-name&gt;</span>
    <span class="code-tag">&lt;rar-name&gt;</span>cxf.rar<span class="code-tag">&lt;/rar-name&gt;</span>
    <span class="code-tag">&lt;connection-definition&gt;</span>org.apache.cxf.connector.CXFConnectionFactory<span
class="code-tag">&lt;/connection-definition&gt;</span>
  <span class="code-tag">&lt;/no-tx-connection-factory&gt;</span>
<span class="code-tag">&lt;/connection-factories&gt;</span>
</pre>
</div></div></li>
</ol>


<p>You can refer to jca sample's <a href="https://svn.apache.org/repos/asf/incubator/cxf/trunk/distribution/src/main/release/samples/integration/jca/inbound/README.txt"
class="external-link" rel="nofollow">README</a> for detail.</p>

<h3><a name="UsingCXF-JCARARinApplicationServer-DeploytheRARinEAR."></a>Deploy
the RAR in EAR.</h3>
<p><b>(Note: This has been tested against JBoss4.0.5 and JBoss4.2.1)</b></p>
<ul>
	<li>Having application.xml
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;?xml version=<span class="code-quote">"1.0"</span>
encoding=<span class="code-quote">"UTF-8"</span>?&gt;</span>
<span class="code-tag">&lt;application&gt;</span>
	<span class="code-tag">&lt;display-name&gt;</span>cxf-jca<span class="code-tag">&lt;/display-name&gt;</span>
	<span class="code-tag">&lt;module&gt;</span>
		<span class="code-tag">&lt;connector&gt;</span>cxf.rar<span class="code-tag">&lt;/connector&gt;</span>
	<span class="code-tag">&lt;/module&gt;</span>
<span class="code-tag">&lt;/application&gt;</span>
</pre>
</div></div></li>
</ul>


<ul>
	<li>Having jboss-app.xml to configure the classloader.
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;?xml version=<span class="code-quote">"1.0"</span>
encoding=<span class="code-quote">"UTF-8"</span>?&gt;</span>
<span class="code-tag">&lt;jboss-app&gt;</span>
	<span class="code-tag">&lt;loader-repository&gt;</span>
		apache.cxf:loader=cxf.ear
		<span class="code-tag">&lt;loader-repository-config&gt;</span>
			java2ParentDelegation=true
		<span class="code-tag">&lt;/loader-repository-config&gt;</span>
	<span class="code-tag">&lt;/loader-repository&gt;</span>
	<span class="code-tag">&lt;module&gt;</span>
		<span class="code-tag">&lt;service&gt;</span>cxf-ds.xml<span class="code-tag">&lt;/service&gt;</span>
	<span class="code-tag">&lt;/module&gt;</span>
<span class="code-tag">&lt;/jboss-app&gt;</span>
</pre>
</div></div></li>
</ul>


<ul>
	<li>Having cxf-ds for jca outbound in JBoss.
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
 <span class="code-tag">&lt;?xml version=<span class="code-quote">"1.0"</span>
encoding=<span class="code-quote">"UTF-8"</span>?&gt;</span>
<span class="code-tag">&lt;connection-factories&gt;</span>
  <span class="code-tag">&lt;no-tx-connection-factory&gt;</span>
    <span class="code-tag">&lt;jndi-name&gt;</span>CXFConnector<span
class="code-tag">&lt;/jndi-name&gt;</span>
    <span class="code-tag">&lt;rar-name&gt;</span>cxf.ear#cxf.rar<span
class="code-tag">&lt;/rar-name&gt;</span>
    <span class="code-tag">&lt;connection-definition&gt;</span>org.apache.cxf.connector.CXFConnectionFactory<span
class="code-tag">&lt;/connection-definition&gt;</span>
  <span class="code-tag">&lt;/no-tx-connection-factory&gt;</span>
<span class="code-tag">&lt;/connection-factories&gt;</span>
</pre>
</div></div>
<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td>The rar name should be full name,
which is ear-name#rar-name, instead of rar-name alone.</td></tr></table></div></li>
	<li>put the application.xml and jboss-app.xml in the META-INF folder.</li>
	<li>put the cxf.rar and the cxf-ds.xml in an EAR.</li>
</ul>


<ul>
	<li>
	<ul>
		<li>For the JBoss4.0.5, Need to put the <b>geronimo-ws-metadata_2.0_spec-1.1.1.jar</b>
in the <b>$JBOSS_HOME/lib/endorsed</b> folder.<br/>
   Make sure the cxf.rar library does not contain <b>xml-apis.jar and xml-resolver.jar</b>.</li>
		<li>For the JBoss4.2.1, Doesn't need to put any jars in the endorsed folder, but need
to make sure cxf.rar library<br/>
   does not contain <b>xml-api.jar</b>.</li>
	</ul>
	</li>
</ul>





<h2><a name="UsingCXF-JCARARinApplicationServer-DeployRARtoWeblogic."></a>Deploy
RAR to Weblogic.</h2>
<p><b>(Note: this has been tested against WebLogic9.1)</b></p>

<h3><a name="UsingCXF-JCARARinApplicationServer-PackageRARinanEAR."></a>Package
RAR in an EAR.</h3>
<ul>
	<li>Add a weblogic-ra.xml in the <b>META-INF</b> folder.
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
<span class="code-tag">&lt;weblogic-connector xmlns=<span class="code-quote">"http://www.bea.com/ns/weblogic/90"</span>&gt;</span>
    <span class="code-tag">&lt;outbound-resource-adapter&gt;</span>
        <span class="code-tag">&lt;connection-definition-group&gt;</span>
	   <span class="code-tag">&lt;connection-factory-interface&gt;</span>org.apache.cxf.connector.CXFConnectionFactory<span
class="code-tag">&lt;/connection-factory-interface&gt;</span>
           <span class="code-tag">&lt;connection-instance&gt;</span> 
  
		<span class="code-tag">&lt;jndi-name&gt;</span>CXFConnector<span
class="code-tag">&lt;/jndi-name&gt;</span>
           <span class="code-tag">&lt;/connection-instance&gt;</span>
        <span class="code-tag">&lt;/connection-definition-group&gt;</span>
    <span class="code-tag">&lt;/outbound-resource-adapter&gt;</span>
<span class="code-tag">&lt;/weblogic-connector&gt;</span>
</pre>
</div></div></li>
</ul>


<ul>
	<li>Package the RAR in an EAR with application.xml.</li>
	<li>Put the <b>geronimo-ws-metadata_2.0_spec-1.1.1.jar</b> in the $WebLogic_HOME/$JDK_Home/jre/lib/endorsed</li>
</ul>



<h2><a name="UsingCXF-JCARARinApplicationServer-DeployRARtoWebSphere."></a>Deploy
RAR to WebSphere.</h2>

<p>TBD</p>

<h1><a name="UsingCXF-JCARARinApplicationServer-UsingJCAConnection."></a>Using
JCA Connection.</h1>

<h2><a name="UsingCXF-JCARARinApplicationServer-GetConnectionfromManagedConnectionFactory."></a>Get
Connection from ManagedConnectionFactory.</h2>
<p>Below is the code snippet to get the Connection.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">

        URL wsdl = getClass().getResource(<span class="code-quote">"/wsdl/hello_world.wsdl"</span>);
               
        CXFConnectionRequestInfo cri = <span class="code-keyword">new</span> CXFConnectionRequestInfo(Greeter.class,

                                           wsdl,
                                           serviceName,
                                           portName);
        ManagedConnectionFactory managedFactory = <span class="code-keyword">new</span>
ManagedConnectionFactoryImpl();
        Subject subject = <span class="code-keyword">new</span> Subject();
        ManagedConnection mc = managedFactory.createManagedConnection(subject, cri);     
  
        <span class="code-object">Object</span> o = mc.getConnection(subject,
cri);
</pre>
</div></div>

<p>Also can get the connection without wsdl, but you need to provide the address.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">

        CXFConnectionRequestInfo requestInfo = <span class="code-keyword">new</span>
CXFConnectionRequestInfo();
        requestInfo.setInterface(Greeter.class);
        requestInfo.setAddress(<span class="code-quote">"http:<span class="code-comment">//localhost:9000/SoapContext/SoapPort"</span>);
</span>        
        ManagedConnectionFactory factory = <span class="code-keyword">new</span>
ManagedConnectionFactoryImpl();
        ManagedConnection mc = factory.createManagedConnection(<span class="code-keyword">null</span>,
requestInfo);
        <span class="code-object">Object</span> client = mc.getConnection(<span
class="code-keyword">null</span>, requestInfo);
</pre>
</div></div>

<h2><a name="UsingCXF-JCARARinApplicationServer-UsingCXFJCARARtoaccesstheStatelessSessionBean."></a>Using
CXF-JCA RAR to access the Stateless Session Bean.</h2>
<p>By using cxf-jca RAR, the EIS is able to access the Stateless Session Bean by CXF
Interal API or JAXWS API.<br/>
If you want to deploy the Stateless Session Bean, you need to modify the ejb_servant.properties
file.</p>
<h3><a name="UsingCXF-JCARARinApplicationServer-Activatetheejbservant.propertiesfile."></a>Activate
the ejb_servant.properties file.</h3>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
# Format: 
# jndi_name={namespace}ServiceName@url_to_swdl
#   
# jndi_name: The JNDI name that an external client uses to contact the bean.
# ServiceName: The string form of the QName for the service in the WSDL file.
# @url_to_wsdl: The string form of a URL that identifies the WSDL file.
#
# Example:
# GreeterBean={http://apache.org/hello_world_soap_http}Greeter@file:c:/wsdl/hello_world.wsdl
</pre>
</div></div>
<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td>You can specify the ejb_servant.properties
file location in the $RAR/META-INF/ra.xml "EJBServicePropertiesURL" property value.</td></tr></table></div>
<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/forbidden.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td>You need to deploy
the ejbs before activate the ejb_servant.properties file, otherwise, it won't find the JNDI
name.</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/Using+CXF-JCA+RAR+in+Application+Server">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=67429&revisedVersion=14&originalVersion=13">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CXF20DOC/Using+CXF-JCA+RAR+in+Application+Server?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message