tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <>
Subject Re: Web services deployment example?
Date Wed, 15 Apr 2009 15:57:04 GMT

On Apr 14, 2009, at 9:52 AM, Laird Nelson wrote:

> In the simple-webservice example that ships with OpenEJB 3.1, the  
> interface
> (CalculatorWs) is annotated with @WebService (and nothing else), and  
> the
> implementation (CalculatorImpl) is annotated *both *with @Stateless  
> *and *
> @WebService, and implements CalculatorWs.  The associated test  
> passes (
> CalculatorTest)--and it only tests the web service functionality,  
> not the
> EJB functionality.

It definitely does test the "EJB" functionality.  Transactions are  
started, interceptors are invoked, etc. etc.  The only real difference  
between invoking the EJB via a Local interface or a Web Service is the  
client and how the invocation is sent to the container for  
processing.  But strictly speaking both "views" reach  
StatelessContainer.invoke(...) and are handled identically.

> It's my understanding that in EJB 3.0 if you don't explicitly mark any
> business interface as being either @Remote or @Local, it defaults to  
> @Local,

Close.  @WebService counts too (either on the interface itself or via  
"endpointInterface = "org.superbiz.calculator.CalculatorWs"").

So there's no defaulting in this situation.  The interface is marked  
explicitly as a service endpoint interface (<service-endpoint> in the  
ejb-jar.xml) and therefore not implicitly marked as Local (<business- 

> From these conversations, I would expect that if I were to add a  
> test to
> that attempted to locate the  
> "CalculatorImplLocal" bean
> in JNDI, either that lookup would fail or an invocation on the
> resulting CalculatorWs
> interface would fail.  Is this correct?
> If it *is* correct, why is the CalculatorImpl class in that example  
> marked
> as @Stateless (in addition to @WebService), since I can't see any  
> way (from
> our discussions) that any test written against the EJB interfaces  
> could
> pass?

Not sure I followed the logic, but as mentioned above in all cases it  
is an EJB invocation regardless of the "view" the client has of the  
bean (i.e. web service vs. business local vs. business remote, etc.).   
Think of them as different doors to the exact same room with the exact  
same stuff in it.  In this situation, @WebService is a door and  
@Stateless is the room and the stuff is all the things the bean can  
lookup or have injected.  If you add an @Local interface, you simply  
add another door to the room, not another room.  Regardless of which  
door you use, you still end up at the same place and can use the same  


View raw message