EJB and Web Services

Why we must call Web Services in EJB's?
[47 byte] By [J@A@V@Aa] at [2007-11-27 5:05:27]
# 1
It isn't mandatory to. Who said it was?
georgemca at 2007-7-12 10:23:55 > top of Java-index,Java Essentials,Java Programming...
# 2
Ok. Let me put it this way: What advantages do we have?
J@A@V@Aa at 2007-7-12 10:23:55 > top of Java-index,Java Essentials,Java Programming...
# 3

> Ok. Let me put it this way: What advantages do we

> have?

Non-Java clients, and more generally, interoperability with other platforms.

Plus you won't need to change the client code should you decide to change the implementation, say from EJB to an IoC container like Spring.

If you do not see any of the above applying to your own environment, then you probably shouldn't bother with WS.

karma-9a at 2007-7-12 10:23:55 > top of Java-index,Java Essentials,Java Programming...
# 4
I know the advantages of using WS, but i'm asking what are the advantages of calling WS inside EJB, instead in normal classes.
J@A@V@Aa at 2007-7-12 10:23:55 > top of Java-index,Java Essentials,Java Programming...
# 5

> I know the advantages of using WS, but i'm asking

> what are the advantages of calling WS inside EJB,

> instead in normal classes.

Your question makes no sense. EJB and WS address different requirements.

The advantages/disadvantages of WS are the same with EJBs than with other non-EJB solutions.

And the decision to use EJBs instead of POJOs is not related to whether to use WS or not.

karma-9a at 2007-7-12 10:23:55 > top of Java-index,Java Essentials,Java Programming...
# 6
one simple answer. Single point of entry.
corlettka at 2007-7-12 10:23:55 > top of Java-index,Java Essentials,Java Programming...
# 7

> one simple answer. Single point of entry.

wrong. He's talking about calling webservices from EJBs, not EJBs from webservices...

There CAN be some advantages. Example from real life: we've an enterprise application deployed on JBoss 3, another deployed on JBoss 4.

If there were no webservices attached to those applications they'd be incapable of talking to each other (and they do need to talk) because the client libraries clash.

jwentinga at 2007-7-12 10:23:55 > top of Java-index,Java Essentials,Java Programming...
# 8

> Why we must call Web Services in EJB's?

Setting aside what others have said for a minute, clarify the question please.

Are you asking:

A) Why web services must derive from an ejb? (They don't actually which is what at least one other poster has said)

B) Why must an ejb call a web service? (Situational would depend on what you were trying to accomplish in the ejb. For example getting data from Google maps would require a service call unless you happen to be in the Google house in which case why would you need to ask this question?)

C) Something I haven't included here.

PS.

puckstopper31a at 2007-7-12 10:23:55 > top of Java-index,Java Essentials,Java Programming...
# 9
B).What are the advantages of calling a WS FROM (inside) an EJB?
J@A@V@Aa at 2007-7-12 10:23:55 > top of Java-index,Java Essentials,Java Programming...
# 10
> B).> What are the advantages of calling a WS FROM (inside)> an EJB?None in particular unless the functionality you need is only available from a service, or the preferred method of obtaining it is from a service.PS.
puckstopper31a at 2007-7-12 10:23:55 > top of Java-index,Java Essentials,Java Programming...