Web Services
  Home arrow Web Services arrow Page 4 - Using EJBs with Axis
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WEB SERVICES

Using EJBs with Axis
By: Sams Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 5
    2006-05-25

    Table of Contents:
  • Using EJBs with Axis
  • Using EJBs from Axis
  • The Session Bean
  • The Deployment Unit
  • Exposing the EJBs via Axis

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using EJBs with Axis - The Deployment Unit


    (Page 4 of 5 )

    Once the EJBs are written, you should deploy and test them before attempting to Web service–enable them. Typically, the EJBs might already exist. In some circumstances, the EJBs may not offer the right service interface, in which case a layer of stateless session beans can be implemented to offer a clean interface that can then be Web service enabled. The EJBs are packaged in an EJB JAR, which is then packaged in an Enterprise Application aRchive (EAR file) g.

    The EJBs must have appropriate XML DDs. The tags containing the deployment information for each bean are shown in the following snippets. Here's the DD fragment for the entity bean:

    <entity id="SkatesEntity">
    <ejb-name>SkatesEntity</ejb-name>
    <local-home>
    com.skatestown.ejb.SkatesEntityLocalHome
    </local-home>
    <local>com.skatestown.ejb.
    SkatesEntityLocal</local> <ejb-class> com.skatestown.ejb.SkatesEntityBean </ejb-class> <persistence-type>Container</persistence-type> <prim-key-class>java.lang.String</prim-key-class> <reentrant>False</reentrant> <cmp-version>2.x</cmp-version> <abstract-schema-name>SKATES</abstract-schema-
    name> <cmp-field id="pc"> <field-name>productCode</field-name> </cmp-field> <cmp-field id="desc"> <field-name>description</field-name> </cmp-field> <cmp-field id="prc"> <field-name>price</field-name> </cmp-field> <primkey-field>productCode</primkey-field> </entity>

    And here's the session bean fragment from the DD:

    <session id="SkatesService">
    <ejb-name>SkatesService</ejb-name>
    <home>com.skatestown.ejb.SkatesServiceHome</home>
    <remote>com.skatestown.ejb.SkatesService</remote>
    <ejb-class>
    com.skatestown.ejb.SkatesServiceBean
    </ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    <ejb-local-ref id="entref">
    <description>
    Reference to SkatesEntity
    </description>
    <ejb-ref-name>skateEnt</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <local-home>
    com.skatestown.ejb.SkatesEntityLocalHome
    </local-home>
    <local>com.skatestown.ejb.
    SkatesEntityLocal</local> <ejb-link>SkatesEntity</ejb-link> </ejb-local-ref> </session>

    As you'll see from looking at the session bean DD, it includes a reference from the session bean to the entity bean. This is the point at which the "java:comp/env/skateEnt" is defined.

    The EJBs are now packaged into a JAR file together with the DD. The JAR contents are as follows:

    >jar tf skatesejb.jar
    META-INF/ejb-jar.xml
    com/skatestown/ejb/Product.class
    com/skatestown/ejb/SkatesEntityBean.class
    com/skatestown/ejb/SkatesEntityLocal.class
    com/skatestown/ejb/SkatesEntityLocalHome.class
    com/skatestown/ejb/SkatesService.class
    com/skatestown/ejb/SkatesServiceBean.class
    com/skatestown/ejb/SkatesServiceHome.class
    META-INF/MANIFEST.MF

    More Web Services Articles
    More By Sams Publishing


       · This article is an excerpt from the book "Building Web Services with Java: Making...
     

    Buy this book now. This article is excerpted from chapter 7 of the book Building Web Services with Java: Making sense of XML, SOAP, WSDL, and UDDI, written by Steve Graham et al. (Sams; ISBN: 0672326418). Check it out today at your favorite bookstore. Buy this book now.

    WEB SERVICES ARTICLES

    - Getting Started with Flex
    - Automated Billing and Faxing for the Web
    - An Introduction to Web Services
    - The Foundations of Web Services: From Novice...
    - Web Services Reengineering: Finishing Touches
    - Fault Handling with Web Services
    - Flow and Web Services
    - Process Lifecycles and Web Services
    - Business Processes and Web Services
    - Orchestrating Web Services
    - Notifications and Resources in the WS-Resour...
    - WS Notification and WS Topics in the WS Reso...
    - Introducing the Implied Resource Pattern
    - Web Services and Stateful Resources
    - Deploying an EJB Application






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT