File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

invoking ejb through web service

 
AjayChawla Chawla
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :

try
{
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL,"t3://localhost:7001");
InitialContext ctx=new InitialContext(p);
System.out.println("1");
Object objhome = ctx.lookup("TestWebService");
System.out.println("2");
TestWebServiceHome testwebhome =(TestWebServiceHome)PortableRemoteObject.narrow(objhome,TestWebServiceHome.class);
System.out.println("3");
TestWebServiceRemote testweb = (TestWebServiceRemote)PortableRemoteObject.narrow(testwebhome.create(),TestWebServiceRemote.class);
System.out.println("4");
int cnt = testweb.method1("FAST");

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

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

return returnValue;


need uor help people,
Thanks
Ajay
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by AjayChawla Chawla:
catch(Exception ex)
{
System.out.println("XXX"+ex.getMessage());
}



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 ?
 
AjayChawla Chawla
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Balaji,

the code --
catch(Exception ex)
{
System.out.println("XXX"+ex.getMessage());
}

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: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic