95-702 OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 14:Enterprise Java Beans.

Slides:



Advertisements
Similar presentations
12 Copyright © 2005, Oracle. All rights reserved. Implementing Business Tasks with Session EJBs.
Advertisements

11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
6/1/20151 Luca Simone Software Engineering 2 a.a. 2001/2002.
1 Softsmith Open Learning - EJB 21-Nov Enterprise Java Beans Introduction –Application ServerApplication Server –Java 2 Enterprise EditionJava.
Organizational Communication Technologies 1 Enterprise Java Beans Overview.
Copyright W. Howden1 Lecture 19: Intro to O/O Components.
JAX-RPC The Java API for XML Remote Procedure Calls Notes from The J2EE Tutorial 1.4 From Sun Microsystems.
Organizational Communication Technologies 1 Enterprise Java Beans Detail.
Chapter 10 EJB Concepts of EJB Three Components in Creating an EJB Starting/Stopping J2EE Server and Deployment Tool Installation and Configuration of.
EJB Fundamentals Celsina Bignoli
EJB. Component Characteristics An enterprise Bean typically contains business logic that operates on the enterprise’s data. An enterprise Bean’s instances.
Brad Rippe Fullerton College. What you need to get started? JDK 1.3 standard for compilation J2EE - SDK1.2.1 App Server - An EJB Container/Web Container.
1 l Enterprise Computing -- 3-tier and multi-tier applications l Enterprise JavaBeans n EJB Features n Types of EJBs l Example – A Currency Converter n.
1 Session Bean Chuyên đề Lập trình Java & J2EE Chương 14 Biên soạn: Th.S Nguyễn văn Lành.
J2EE Part 2: Enterprise JavaBeans CSCI 4300 Images and code samples from jGuru EJB tutorial,
Enterprise Java Beans - (EJB)
EJB Enterprise Java Bean.
Seminar: Enterprise JavaBeans. Agenda Agenda Java™ 2 Platform Java™ 2 Platform Java™ 2 Platform,Enterprise Edition(J2EE) Java™ 2 Platform,Enterprise Edition(J2EE)
Module 6 Message-Driven Beans. History Introduced in EJB 2.0 –Supports processing of asynchronous messages from a JMS provider Definition expanded in.
Entity Beans BMP Celsina Bignoli
Advanced Java Session 7 New York University School of Continuing and Professional Studies.
Container-Managed Persistence (CMP) Entity Beans Lesson 3A / Slide 1 of 42J2EE Server Components Objectives In this lesson, you will learn to: Identify.
Java Message Service Sangeetha Chavala. What is Messaging? Method of Communication between software components/applications peer-to-peer facility Not.
Enterprise JavaBeans Umer Farooq CS6704: Design Patterns & Component FrameworksFebruary 25, 2002.
1 Stateful Session Beans Stateless Session Beans Michael Brockway Sajjad Shami Northumbria University School of Computing, Engineering & Information Sciences.
Distributed Systems 1 Master of Information System Management Distributed Systems Persistence.
Enterprise Java Bean Matt. 2 J2EE 3 J2EE Overview.
1 SOA and Enterprise Computing Enterprise Java Beans.
The Triad of Beans I Oleh: Dini Addiati ( ) Fahrurrozi Rahman ( Y) Irfan Hilmy ( ) Salman Azis A ( ) Aziiz Surahman.
Presented By Pradeep K Sahu. What will be the Contents of the Seminar ? What is EJB ? EJB Architecture Types of EJB Session Entity Why EJB ? Writing a.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
Message-Driven Beans and EJB Security Lesson 4B / Slide 1 of 37 J2EE Server Components Objectives In this lesson, you will learn about: Identify features.
Enterprise Java Bean Computer Networks Natawut Nupairoj, Ph.D. Department of Computer Engineering Chulalongkorn University.
J2EE Structure & Definitions Catie Welsh CSE 432
Session Beans -) stateless -) stateful. Session Beans A session bean represents a single client inside the J2EE server. To access an application that.
A TUTORIAL TO USING EJBs by SHREERAM IYER 09/17/2001.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 5: JMS.
1 Architectural Overview For application developers, assembling enterprise beans requires little or no expertise in the complex system-level issues that.
© jGuru.com Enterprise JavaBeans Fundamentals.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Introduction to Spring Remoting Simplifying.
Creating competitive advantage Copyright © 2003 Enterprise Java Beans Presenter: Wickramanayake HMKSK Version:0.1 Last Updated:
JMS (Java Messaging Service)
EJB Overview: Constraint Types and Enforcement in JBoss Elissa Newman Fluid Meeting 6/3/04.
Entity Beans & Persistence Chris Alexander CS 486 Spring 2001.
OCT 1 Master of Information System Management Distributed Systems Lecture 19: Enterprise Java Beans.
Session Beans Based on: Patel, Brose, Silverman, Mastering Enterprise JavaBeans 3.0.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Enterprise Java Beans N.V.RAJASEKHAR REDDY. Definition of EJB EJBs are the components that are the set of classes and interfaces deployed within a container.
Copyright © 2002 ProsoftTraining. All rights reserved. Enterprise JavaBeans.
Enterprise Java Beans Ye Zhou CS6704 Presentation Virginia Tech.
13 Copyright © 2004, Oracle. All rights reserved. Managing Persistent Data in the Business Tier Entity EJBs.
©NIIT Introducing Enterprise JavaBeans (EJB) Lesson 1A / Slide 1 of 43J2EE Server Components Objectives In this lesson, you will learn about: The features.
Enterprise JavaBeans: Fundamentals. EJB Fundamentals(c)CDAC(Formerly NCST)2 Contents Introduction Technology Overview EJB Architecture EJB Specification.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
Middleware Technology (J2EE/EJB) EJB Fundamentals.
Advanced Java Session 7 New York University School of Continuing and Professional Studies.
Enterprise JavaBeans™ Trademark of Sun Microsystems, Inc.
Java Message Service Introduction to JMS API. JMS provides a common way for Java programs to create, send, receive and read an enterprise messaging system’s.
14 Copyright © 2004, Oracle. All rights reserved. Achieving State Management in the Business Tier.
©NIIT Session Beans Lesson 1B/ Slide 1 of 37J2EE Server Components Objectives In this lesson, you will learn to: Describe the characteristics of session.
Entity Bean Chuyên đề Lập trình Java & J2EE Chương 15
Luca Simone Software Engineering 2 a.a. 2001/2002
Objectives In this lesson, you will learn to:
Understanding and Designing with EJB
Enterprise Java Beans Bina Ramamurthy 1/13/2019 B.Ramamurthy.
Understanding and Designing with EJB
Enterprise Java Beans Bina Ramamurthy 4/5/2019 B.Ramamurthy.
Knowledge Byte In this section, you will learn about:
Presentation transcript:

OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 14:Enterprise Java Beans

OCT 2 Master of Information System Management Advanced Java 2 Platform How to Program by Deitel, Deitel, & Santry Thinking in Enterprise Java Bruce Eckel et. Al. EJB 3.0 API Sun documentation Java Enterprise In A Nutshell Farley, Crawford & Flanagan Some Useful Resources

OCT 3 Master of Information System Management From The Java EE Tutorial Servlets JSP ’ s Axis2 HTML Session beans Entity beans Message Driven Beans

OCT 4 Master of Information System Management From The Java EE Tutorial

OCT 5 Master of Information System Management From The Java EE Tutorial

OCT 6 Master of Information System Management SOAP and Java EE Slide from JAXM/JMS tutorial at Sun Microsystems

OCT 7 Master of Information System Management Slide from JAXM/JMS tutorial at Sun Microsystems

OCT 8 Master of Information System Management Benefits of Enterprise Beans(1) Simplify development of large, distributed applications. The developer can concentrate on business problems. The EJB container handles transaction management, security, and authorization. Portable – may be moved to other Java EE containers.

OCT 9 Master of Information System Management Benefits of Enterprise Beans(2) Scalable – the components may be distributed across many machines. Support for Location Transparency – the client need not be concerned with the location of the bean. Support for Transaction management - ensures data integrity (over concurrent access of shared resources). Promotes thin clients and web services.

OCT 10 Master of Information System Management Main Concept: Interposition Application stub skeleton examine security credentials start or join transaction call any necessary persistence functions trigger various callbacks call business logic more work with transactions, persistence and callbacks send back result or an exception EJB Container

OCT 11 Master of Information System Management Enterprise Java Beans Part of Java EE Enterprise Application Technologies Currently at EJB3.0 (simplifies code with annotations) Server-Side EJB objects may offer a remote view (via a remote procedure call protocol) a local view (direct procedure call) or both Managed EJB container services are more involved than the plain old JVM Components distributed in binary format and are configurable

OCT 12 Master of Information System Management Server-Side Implications In order to pull off the RPC trick we need: A naming service -- e.g. RMI clients make requests on the rmiregistry RPC proxies -- communications code along with the appropriate interface

OCT 13 Master of Information System Management Managed: EJB Container Services Object Persistence and Synchronization Declarative Security Control Declarative Transaction Control Concurrency Management Scalability Management The programmer need not worry about the details. Think “ JVM on steroids ”.

OCT 14 Master of Information System Management EJB Types Entity Beans Session Beans Message-Driven Beans

OCT 15 Master of Information System Management EJB Types Entity Beans Session Beans Message-Driven Beans } } RMI-based server side components Accessed using distributed object Protocols (RMI IIOP) New since EJB 2.0 Asynchronous server side component that responds to JMS asynchronous messages (Think provider like JAXM)

OCT 16 Master of Information System Management Entity Beans Represent real world entities (customers, orders, etc.) Persistent Objects typically stored in a relational database using CMP (Container Managed Persistence) or BMP (Bean Managed Persistence) The client sees no difference between CMP and BMP beans CMP promotes component portability (more reliant on the container to handle detail) CMP uses its own Query Language EJB QL CMP relies on an Abstract Schema in the deployment descriptor

OCT 17 Master of Information System Management Session Beans Are an extension of the client application Manage processes or tasks Are not persistent Often employ several different kinds of entity beans Implement business logic Come in two types (which can be more easily shared?) –Stateless session beans (no memory between calls) purchase(severalIems,creditCardNo); –Stateful session beans (remember earlier calls) addToCart(item); purchase(creditCardNo);

OCT 18 Master of Information System Management Message-Driven Beans Work in cooperation with Java Messaging System (JMS). JMS is an abstraction API on top of Message- Oriented Middleware (MOM) – like JDBC is an abstraction API on top of SQL databases or like JAXR is an abstraction API on registries or like JNDI is an abstraction API on directories. Each MOM vendor implements things differently. MDB’s allow the developer to program using the publish-subscribe messaging model based on asynchronous, distributed message queues. The MOM vendor need only provide a service provider for JMS (IBM’s MQSeries or Progress’ SonicMQ).

OCT 19 Master of Information System Management Message-Driven Beans Are like session beans Have no persistent state Coordinate tasks involving other session beans or entity beans Listen for asynchronous messages Unlike Session beans, provide no remote interface describing the methods that can be called

OCT 20 Master of Information System Management Message-Driven Beans Are receivers of MOM messages coming through the JMS API. Usually take action when a message is received. Unlike session and entity beans, Message-Driven Beans expose no remote or local view. They are not called directly by a client.

OCT 21 Master of Information System Management Implementing Entity and Session Beans Defining the component interfaces: – You may choose to define all or only some of these depending on how you want your bean used. – local interfaces do not require RMI overhead. Define a bean class. For entity beans define a primary key.

OCT 22 Master of Information System Management Implementing Entity and Session Beans Define the component interfaces –The remote interface specifies how the outside world can access the bean’s business methods –The remote home interface specifies how the outside world can access the bean’s life- cycle methods (for creating, removing and finding) –The local interface specifies how the inside world (same EJB container) can access the bean’s business methods –The local home interface specifies how the inside world can access the bean’s life-cycle methods

OCT 23 Master of Information System Management Implementing Entity and Session Beans Implement the bean –Fill in the code for the business and life- cycle methods. –It’s not normal to directly implement the interfaces as we do in standard Java (though you must provide many of the methods). The calls to methods are not normal Java calls. They first go through the container. –Session beans implement javax.ejb.SessionBean. –Entity beans implement javax.ejb.EntityBean. –Both beans extend javax.ejb.EnterpriseBean

OCT 24 Master of Information System Management For Entity Beans Define a primary key class: –Required for entity beans. –Provides a pointer into the database. –Must implement Java.io.Serializable. The EJB instance represents a particular row in the corresponding database table. The home interface for the entity EJB represents the table as a whole (has finder methods.)

OCT 25 Master of Information System Management Implementing a Message- Driven Bean Has no local, local home, remote, or remote home interfaces to define. The container will call the onMessage() method when an asynchronous message arrives. (Like JAXM message provider.) Extends the EnterpriseBean class and implements the javax.ejb.MessageDrivenBean and javax.jms.MessageListener interfaces

OCT 26 Master of Information System Management Implementing a Message- Driven Bean Two basic messaging-system models (1) point-to-point model allows messages to be sent to a message queue to be read by exactly one message consumer. (2) publish/subscribe model allows components to publish messages on a topic to a server to be read by zero or more subscribers. Subscribers register for a topic.

OCT 27 Master of Information System Management In Both Messaging Models The messages hold: -- a header containing the destination and the sending time. -- message properties to allow the receiver to select which messages they would like to receive. These may be set by the sender. -- the message body itself.

OCT 28 Master of Information System Management Point-to-point on the Client Side import javax.jms.*; QueueConnection qCon; QueueSession qSes; QueueSender qSen; Through JNDI get access to a QueueSender. Build messages and send them to the queue. The queue is responsible for transporting the message to another queue on the server.

OCT 29 Master of Information System Management Point-To-Point on the Server Side import javax.jms.*; QueueConnection qCon; QueueSession qSes; QueueReceiver qRec; Through JNDI get access to a QueueSender. Build a MessageListener with an onMessage method.

OCT 30 Master of Information System Management Entity Beans Revisited Each entity bean has a unique identifier called its primary key The primary key can be used by the client to locate the bean Each bean represents a row in its table Rows may have columns that reference other entity beans (students take courses) These relationships may be managed by the bean or by the container (container managed relationships)

OCT 31 Master of Information System Management Relationships OrderEJB CusomerEJB 1 Many 1 Many LineItemEJB ProductEJB Many 1 A relationship field is like a foreign key in a database. If a b then a “knows about” or “holds a pointer to” b.

OCT 32 Master of Information System Management Entity Bean Life Cycle (From Sun) Does not exist Pool of available instances -- Ready to have business methods called -- Has an identity setEntityContext unsetEntityContext ejbActivate ejbPassivate Client calls create and container calls ejbCreate and ejbPostCreate Client calls remove and container calls ejbRemove Client initiates Container initiates

OCT 33 Master of Information System Management A Typical Entity Bean Needs: A Home interface defining the create and finder methods. A Component interface defining the business methods a client may call. An implementation of the Component interface. Deployment descriptors.

OCT 34 Master of Information System Management A Home Interface import javax.ejb.*; // From Eckel import java.util.Collection; import java.rmi.RemoteException; public interface MovieHome extends EJBHome { public Movie create(Integer id, String title) throws RemoteException, CreateException; public Movie findByPrimaryKey(Integer id) throws RemoteException, FinderException; }

OCT 35 Master of Information System Management A Component Interface import javax.ejb.*; // From Eckel import java.rmi.RemoteException; /** * A movie, with id and title. * * Note that there is no setId() method in the * interface, to prevent clients from arbitrarily * changing a movie's primary key. */ public interface Movie extends EJBObject { public Integer getId() throws RemoteException; public String getTitle() throws RemoteException; public void setTitle(String title) throws RemoteException; }

OCT 36 Master of Information System Management The Container Implements the component interface (From Eckel)

OCT 37 Master of Information System Management import javax.ejb.CreateException; // From Eckel import javax.ejb.EntityBean; import javax.ejb.EntityContext; public abstract class MovieBean implements EntityBean { // Container notifications methods public Integer ejbCreate(Integer id, String title) throws CreateException { if (id == null) throw new CreateException("Primary key cannot be null"); if (id.intValue() == 0) throw new CreateException("Primary key cannot be zero"); setId(id); setTitle(title); return null; }

OCT 38 Master of Information System Management public void ejbPostCreate(Integer id, String title) {} // Called by public void ejbLoad() {} // container public void ejbStore() {} public void ejbRemove() {} public void ejbActivate() {} public void ejbPassivate() {} public void setEntityContext(EntityContext ctx) {} public void unsetEntityContext() {} // Business methods provided by container public abstract void setId(Integer id); public abstract String getTitle(); public abstract void setTitle(String title); public abstract Integer getId(); } // From Eckel

OCT 39 Master of Information System Management Deployment Descriptor // From Eckel Movie javatheater.ejb.MovieHome javatheater.ejb.Movie javatheater.ejb.implementation.MovieBean Container java.lang.Integer False 2.x Movie id - title - id

OCT 40 Master of Information System Management Client (From Eckel) import javax.naming.*; import javatheater.ejb.*; public class MovieClient { public static void main(String[] args) throws Exception { javax.naming.Context initial = new javax.naming.InitialContext(); Object objRef = initial.lookup("javatheater/Movie"); MovieHome movieHome = (MovieHome) javax.rmi.PortableRemoteObject.narrow( objRef, MovieHome.class);

OCT 41 Master of Information System Management // Generate a primary key value int pkValue = (int) System.currentTimeMillis() % Integer.MAX_VALUE; // Create a new Movie entity Movie movie = movieHome.create( new Integer(pkValue), "A Bug’s Life" ); // As a test, locate the newly created entity movie = movieHome.findByPrimaryKey(new Integer(pkValue)); // Access the bean properties System.out.println(movie.getId()); System.out.println(movie.getTitle()); // Remove the entity movie.remove(); }

OCT 42 Master of Information System Management Session Beans Revisited Represents a single client inside the J2EE server. Is not persistent. May be stateful (holding the conversational state of one client). May be stateless (the container may assign any bean to any client). Is the only bean that may implement a web service.

OCT 43 Master of Information System Management Life Cycle of Stateful Session Bean Does not exist Ready for business methods to be called Passive From Sun Client calls create. Container calls setSessionContext and then calls ejbCreate Container calls ejbPassivate before passivating After activation the container calls ejbActivate Client calls remove, container calls ejbRemove

OCT 44 Master of Information System Management Life Cycle of a Stateless Session Bean (from Sun) Does not exist Ready setSessionContext ejbCreate ejbRemove

OCT 45 Master of Information System Management A Typical Session Bean Has A Remote Interface defining the business methods a client will call A Home Interface for lifecycle management An enterprise bean class

OCT 46 Master of Information System Management Session Bean Remote Interface(From Sun) import javax.ejb.EJBObject; import java.rmi.RemoteException; import java.math.*; public interface Converter extends EJBObject { public BigDecimal dollarToYen(BigDecimal dollars) throws RemoteException; public BigDecimal yenToEuro(BigDecimal yen) throws RemoteException; }

OCT 47 Master of Information System Management The Home Interface import java.io.Serializable; import java.rmi.RemoteException; import javax.ejb.CreateException; import javax.ejb.EJBHome; public interface ConverterHome extends EJBHome { Converter create() throws RemoteException, CreateException; }

OCT 48 Master of Information System Management The Session Bean Class import java.rmi.RemoteException; import javax.ejb.SessionBean; import javax.ejb.SessionContext; import java.math.*; public class ConverterBean implements SessionBean { BigDecimal yenRate = new BigDecimal(" "); BigDecimal euroRate = new BigDecimal("0.0077"); public BigDecimal dollarToYen(BigDecimal dollars) { BigDecimal result = dollars.multiply(yenRate); return result.setScale(2,BigDecimal.ROUND_UP); }

OCT 49 Master of Information System Management public BigDecimal yenToEuro(BigDecimal yen) { BigDecimal result = yen.multiply(euroRate); return result.setScale(2,BigDecimal.ROUND_UP); } public ConverterBean() {} public void ejbCreate() {} public void ejbRemove() {} public void ejbActivate() {} public void ejbPassivate() {} public void setSessionContext(SessionContext sc) {} }

OCT 50 Master of Information System Management The Session Bean Client import javax.naming.Context; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; import java.math.BigDecimal; public class ConverterClient { public static void main(String[] args) { try { Context initial = new InitialContext(); Object objref = initial.lookup ("java:comp/env/ejb/SimpleConverter"); ConverterHome home = (ConverterHome)PortableRemoteObject.narrow(objref, ConverterHome.class);

OCT 51 Master of Information System Management Converter currencyConverter = home.create(); BigDecimal param = new BigDecimal ("100.00"); BigDecimal amount = currencyConverter.dollarToYen(param); System.out.println(amount); amount = currencyConverter.yenToEuro(param); System.out.println(amount); System.exit(0); } catch (Exception ex) { System.err.println("Caught an unexpected exception!"); ex.printStackTrace(); }

OCT 52 Master of Information System Management Message Driven Beans Revisited Handles asynchronous messages. Normally acts as a JMS message listener. The message may have originated from an application client, another enterprise bean, a web component or a non-Java application that can generate messages. Like a stateless session bean but with no interfaces. All operations within onMessage may be in a transaction context.

OCT 53 Master of Information System Management From Sun

OCT 54 Master of Information System Management On The Client // locate the connection factory and queue connectionFactory = (ConnectionFactory) jndiContext.lookup ("java:comp/env/jms/MyConnectionFactory"); destination = (Queue) jndiContext.lookup("java:comp/env/jms/QueueName");

OCT 55 Master of Information System Management // Next, the client creates the queue connection, session, and sender: connection = connectionFactory.createConnection(); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); messageProducer = session.createProducer(destination); // Finally, the client sends several messages to the queue: message = session.createTextMessage(); for (int i = 0; i < NUM_MSGS; i++) { message.setText("This is message " + (i + 1)); System.out.println("Sending message: " + message.getText()); messageProducer.send(message); }

OCT 56 Master of Information System Management JMS Message Types(1) The Message Body Contains: TextMessage A java.lang.String object (for example, an XML document). MapMessage A set of name/value pairs, with names as String objects and values as primitive types in the Java programming language. The entries can be accessed sequentially by enumerator or randomly by name. The order of the entries is undefined.

OCT 57 Master of Information System Management JMS Message Types(2) BytesMessage A stream of unin JMS Message Types(1) terpreted bytes. This message type is for literally encoding a body to match an existing message format. StreamMessage A stream of primitive values in the Java programming language, filled and read sequentially. ObjectMessage A Serializable object in the Java programming language.

OCT 58 Master of Information System Management Listening to the Queue public void onMessage(Message inMessage) { TextMessage msg = null; try { if (inMessage instanceof TextMessage) { msg = (TextMessage) inMessage; System.out.println("MESSAGE BEAN: Message received: " +msg.getText()); } else { System.out.println("Message of wrong type: " + inMessage.getClass().getName()); } } catch (JMSException e) { e.printStackTrace(); mdc.setRollbackOnly(); } catch (Throwable te) { te.printStackTrace(); } }

OCT 59 Master of Information System Management The Web Service as an EJB

OCT 60 Master of Information System Management The Web Service as an EJB A Web service client can access Java EE applications in two ways. First, the client can access a Web service created with JAX-RPC. Behind the scenes, JAX-RPC uses a servlet to implement the SOAP Web Service. Second, a Web service client can access a stateless session bean through the service endpoint interface of the bean. Other types of enterprise beans cannot be accessed by Web service clients.

OCT 61 Master of Information System Management A Stateless Session Bean as a Web Service The client need not know that its interacting with a Java EJB. It calls the bean like it calls any other web service. Thus,.NET interoperates with Java EE using XML on the wire.

OCT 62 Master of Information System Management The Web Service Endpoint Interface package helloservice; import java.rmi.RemoteException; import java.rmi.Remote; public interface HelloIF extends Remote { public String sayHello(String name) throws RemoteException; } The client cannot see that it’s interacting with an EJB

OCT 63 Master of Information System Management The Web Service Session Bean package helloservice; import java.rmi.RemoteException; import javax.ejb.SessionBean; import javax.ejb.SessionContext; public class HelloServiceBean implements SessionBean { public String sayHello(String name) { return "Hello " + name + "from HelloServiceEJB"; } public HelloServiceBean() {} public void ejbCreate() {} public void ejbRemove() {} public void ejbActivate() {} public void ejbPassivate() {} public void setSessionContext(SessionContext sc) {} } If we added remote and home Interfaces then this bean could also be called using in the traditional manner – with remote references. No change to the bean would be necessary. WSDL can be generated and all of the previous clients will work.