This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes invoking ejb through web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "invoking ejb through web service" Watch "invoking ejb through web service" New topic

invoking ejb through web service

AjayChawla Chawla

Joined: May 24, 2004
Posts: 2
Hi, I've deployed a webservice (a simple java class) on weblogic7.1.
This java class tries to invoke a session ejb(which i've deplyed as a seperate jar), but it gives a runtime error :

Failed to invoke service:
javax.xml.rpc.soap.SOAPFaultException: com.sessiontest.TestWebServiceHome

my java class is :

Properties p = new Properties();
InitialContext ctx=new InitialContext(p);
Object objhome = ctx.lookup("TestWebService");
TestWebServiceHome testwebhome =(TestWebServiceHome)PortableRemoteObject.narrow(objhome,TestWebServiceHome.class);
TestWebServiceRemote testweb = (TestWebServiceRemote)PortableRemoteObject.narrow(testwebhome.create(),TestWebServiceRemote.class);
int cnt = testweb.method1("FAST");

System.out.println("return from EJB :"+cnt);
catch(Exception ex)

String returnValue = "This message brought to you by the "+
"letter "+s+" and the number "+num;

return returnValue;

need uor help people,
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
Originally posted by AjayChawla Chawla:
catch(Exception ex)

Ajay!. Welcome to Javaranch!.
Can you post the complete error message..
Also, are you able to call this ejb(testweb.method1()) from the normal java client ?

Spritle Software Blogs
AjayChawla Chawla

Joined: May 24, 2004
Posts: 2
Hi Balaji,

the code --
catch(Exception ex)

dosn't gets printed.

The exception "javax.xml.rpc.soap.SOAPFaultException: com.sessiontest.TestWebServiceHome"

gets printed on the browser when I try to invoke the web service through a web client(the default client that is created when I use the 'servicegen' ant task).

Also, Iam able to access the ejb through a normal java client.

I've developed the web service using the 'servicegen' ant task.
I agree. Here's the link:
subject: invoking ejb through web service
Similar Threads
Sybase JNDI lookup woes
error while running Client in Eclipse helios
Dependency INjection through Annotations
Exception in client program of ejb using weblogic5.1
Session facade