Vishy Kasar wrote:
> I'm trying to expose a stateless session bean as a webservice. I have
> not been able to find explicit instructions on how to do this in any
> of
> the docs or examples.
> Specifically, I would like to know the following:
>
> 1) how do I generate the .wsdl for for me EJB? Do I simply run the
> remote home interface through the java2wsdl tool?
>
Run java2wsdl on the EJBObject (not the EJBHome)
>
> 2) How do I generate the deployment descriptor? Do I generate them
> just
> like I would any other class (in other words, using wsdl2java)? Are
> there certain configurations parameters in the DD that should be
> modified to tell the deployer that the class is a EJB? Which of the 3
> ejb classes (home, remote home, or implementation) should I bind to?
>
Here is a sample deploy.wsdd that works for me. You must specify "EJB"
provider.
You bind to the Home object. Borland JBuilder Web services toolkit will
be able to
generate deploy.wsdd along with all typemappings necessary.
<deployment
xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:ns="http://borland.com"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="Animal" provider="java:EJB">
<parameter name="beanJndiName" value="Animal"/>
<parameter name="homeInterfaceName"
value="com.borland.examples.webservices.ejb.AnimalHome"/>
<parameter name="allowedMethods" value="talk sleep"/>
</service>
</deployment>
>
> 3) Will the rpc router call the ejb container, or will it make direct
> calls to the implementation class?
>
The provider is EJB in this case. All that the EJB provider does is
locate the JNDI home object, call the create() method to get the bean
instance and use reflection to invoke methods on it. EJB provider is
essentially an EJB client. It makes invocation on the EJB client stub
not on teh implementation class.
If WAR and EJB jar are deployed in different VMs, then you must package
the EJB client stubs in to the AXIS WAR as well.
If WAR and EJB jar are deployed in same VM, then the behavior you get
depends on the app server. You may or may not have to package the client
stubs. Certainly packaging the stub should not hurt you. You may get a
class cast exception based on the what kind of class loader policy is
used by the containers in your app server.
>
> I'm using axis beta 1, and I'm planning on trying to integrate with
> weblogic 6.1.
>
All the information above is based on AXIS beta 1. We ship a simple EJB
example (With Borland App Server) that shows how to do all this. Let me
know if you need it. You should be able to run on app server of your
choice.