This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes How to expose EJB as a web service?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to expose EJB as a web service??" Watch "How to expose EJB as a web service??" New topic
Author

How to expose EJB as a web service??

raka sinha
Greenhorn

Joined: Jan 22, 2007
Posts: 15
Hi
My current application architecture is as follows

Frontend- Weblogic portal
Backend - EJB with Stored proceedure deployed in BEA Weblogic 7.0.

My customer now wants to move from vendor specific app server to open source framework.also they want to remove RMI.

We have currently 250 methodis in EJB?

How should I decide that what all methods that can be exposed as a web service? How many number of service I should plan?


Can any one give me the solution for how to approach this architecture.How to write specific wrapper class for EJB and what all design consideration I have to look for.
Also if you have any links then please let me know.

Thanks in advance.
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
I don't understand the requirement to "move from vendor specific app server". Every Java application server is an implementation of several specifications, and every EJB application deployed to a server will need to have an application-specific configuration to work.

If the requirement is to cut costs by moving from an expensive EJB server to a lower-cost server (there is no such thing as a free server), then by all means migrate your EJB applications.

I would caution against thinking too much about building a web service at this stage as you must first do the migration. Once you have done this, and if the web service still makes sense (which very possibly it would not), then you can use BEA-supplied Ant tasks to generate a web service from the EAR file.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30586
    
154

Originally posted by raka sinha:
We have currently 250 methodis in EJB?

I can't imagine that you want to expose 250 methods as a webservice. Before exposing anything, think about who will be calling it and what specifically, should be exposed.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
I think that it usually best if the EJB methods which are exposed to a client are coarse-grained. Consider a MoneyTransferBean which manages the transfer of funds. What I like to see is a single coarse-grained method, let's call it transfer(), exposed to the client. Behind the scenes, there may be other fine-grained methods such as withdraw(), deposit(), createAuditLog(), etc, which actually do the work but which the client has no need to see.

So Jeanne is right to question exposing 250 methods to the client. What you need to do is declare only the relevant methods in your Remote interfaces, and make the appropriate changes to your EJB classes.

On a related point: if your services are highly transactional, it may be a good idea to implement a stateless session bean as a session facade. The reason is that should you later build a Web service, then this will make it easier to reuse such a bean as a Web service endpoint which can process SOAP messages as RPC calls.
 
GeeCON Prague 2014
 
subject: How to expose EJB as a web service??