|
Apache CXF example source code file (README.txt)
The Apache CXF README.txt source codeCXF INBOUND RESOURCE ADAPTER MESSAGE DRIVEN BEAN DISPATCHING SAMPLE =================================================================== Please read the "Introduction to the inbound-mdb* Samples" section in the inbound-mdb/README.txt. It contains important information. MDB Invoking Session Bean ------------------------- This sample shows the MDB invoked by the service endpoint facade, which dispatches the request to a targeted Stateless Session Bean. The Stateless Session Bean is where the service implementation resides. It is important to note that the targeted EJB must be a Stateless Session Bean. The MDB is a generic implementation. In fact, the default implementation is supplied by CXF JCA integration. The user does not have to write it. See in etc/ejb-jar.xml, the ejb-class for the MDB is org.apache.cxf.jca.inbound.DispatchMDBMessageListenerImpl. When this implementation class is specified, the messaging-type should be set to org.apache.cxf.jca.inbound.DispatchMDBMessageListener. Also, notice that the messagelistener-type in ra.xml matches the MDB's messaging-type. As you can see in etc/ra.xml file, the activation spec specified is org.apache.cxf.jca.inbound.DispatchMDBActivationSpec so that the target Session Bean's JNDI name can be specified. Like the inbound-mdb sample, this sample does not have a WSDL. CXF will use the service endpoint interface (Greeter) to build a service model as it is defined in the serviceInterfaceClass property in the etc/ejb-jar.xml. In ejb-jar.xml, you will notice that there is a ejb-local-ref, which is required for the MDB to lookup a Local EJB object (reference) of the target Session Bean. To use the dispatching function provided by org.apache.cxf.jca.inbound.DispatchMDBMessageListenerImpl, a ejb-local-ref must be defined in the ejb-jar.xml. The advantage of the approach is that users don't need to update the ra.xml in order to expose a new EJB as Web Service since the service endpoint interface is not exposed to the resource adapter's deployement descriptor. We also define a remote interface for the Session Bean (GreeterBean). It is completely optional. The remote interface is not accessed by the CXF JCA connector. Defining a remote interface would allow a EJB client to invoke the Session Bean from outside the application server. Building and running the sample using Ant ----------------------------------------- From the base directory of this sample (i.e., where this README file is located), the Ant build.xml file can be used to build and run the sample. Build CXF J2C RAR file ---------------------- (Unix) % ant generate.rar (Windows) > ant generate.rar The result RAR file is located in build/lib/cxf.rar Launch the application server ----------------------------- The sample requires an application server (WebSphere 6.1). Make sure you have a running instance of an application server. Deploy the CXF JCA Connector ----------------------------- The CXF JCA Connector must be deployed to the application server before running the sample. The JCA Connector used in this sample can only be shared by the inbound-mdb-dispatch-wsdl sample. If you have deployed a CXF JCA Connector from that sample, you can skip the following steps and goto "Building Message Driven Bean Jar". Otherwise, please make sure there is no other CXF JCA Connector deployed into the application server. Please consult your vendor documentation on Resource Adapter deployment. Here are basic instructions to deploy the connector in WebSphere 6.1. 1. Logon to WebSphere Integrated Solution Console. The default address is: http://<hostname>:9060/ibm/console/login.do 2. Navigate to tree menu: Resources -> Resource adapters -> Resource adapters 3. On the Resource adapters page, click the "Install RAR" button. 4. On the Install RAR File page, select the "Local path" radio button if this sample is located in the same machine that you are running the web browser. Otherwise, select the "Server path" radio button. Specify or browse to the path build/lib/cxf.rar file in this sample. Then, click the "Next" button. 5. On the next page, click the "OK" button to install the Resource Adapter. 6. On the next page, click the "CXF JCA Connector" link to edit the Resource Adatper. 7. On the "Configuration" page, click the "J2C activation specification" link. 8. On the next page, click the "New" button to create a new Activation Specifications. 9. On the next page, enter "MyActivationSpec" in the Name textbox and click the "OK" button. Notice that the JNDI name is optional. If it is omitted, a JNDI name is created for you as eis/<ActivationSpecName> where Other Apache CXF examples (source code examples)Here is a short list of links related to this Apache CXF README.txt source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.