Am trying to create an ejb webservice client in WSAD 5.1.1 Since there isnt a wizard available for an EJB client, I tried to create and test the client using the two utilities that I found in WSAD install directory - WSDL2CLIENT and WSDL2JAVA. Both pretty much generate the same set of stubs and xml files, with the only difference being that I had to manually create the EJB and change the webservicesclient.xml when I used WSDL2JAVA, whereas WSDL2Client did everything for me. However, when I try to import the generated files in WSAD to test it, I get a java.lang.InstantiationException when I try to invoke a method on my stub. I tried to individually import and test the generated files from both the utilities and I still get the exception. Here is a snippet of the source code generated by the utility and the stack trace:
try {
Context ctx = new InitialContext();
String webService = "java:comp/env/service/DelegateService";
DelegateService service = (DelegateService) ctx.lookup(webService);
Delegate port = service.getDelegate();
// -- This is where the exception is thrown
int count = port.getCount();
}catch (java.lang.Exception e) {
e.printStackTrace();
}
The exception that I get is
com.ibm.ws.webservices.engine.transport.http.WebServicesServlet TRAS0014I: The following exception was logged WebServicesFault
Caused by: java.lang.InstantiationException: com.test.Delegate
at java.lang.Class.newInstance3(Class.java(Compiled Code))
at java.lang.Class.newInstance(Class.java(Compiled Code))
at com.ibm.ws.webservices.engine.providers.java.JavaProvider.makeNewServiceObject(JavaProvider.java:327)
I want to know if people have tried creating EJB clients using tools in WSAD, and if they were able to do so. Any lessons learned/tips would be greatly appreciated. The above code was generated by the tool and I havent made any modifications to it. Any pointers to the appropriate documentation would also be appreciated. I have gone through the webservices handbook for WSAD for 5.1.1 and 6.x and didnt find much help on how to actually create an EJB client.
Thank you all for your time
Dinesh
-
Need help creating an EJB Webservice client in WSAD 5.1.1 (1 messages)
- Posted by: Dinesh Sharma
- Posted on: July 19 2005 10:21 EDT
Threaded Messages (1)
- Need help creating an EJB Webservice client in WSAD 5.1.1 by Todd Clarke on August 16 2005 02:59 EDT
-
Need help creating an EJB Webservice client in WSAD 5.1.1[ Go to top ]
- Posted by: Todd Clarke
- Posted on: August 16 2005 02:59 EDT
- in response to Dinesh Sharma
Dinesh,
There is a client generator in WSAD. Save the WSDL for the web service in your workspace with a ".wsdl" extension. In the explorer view, right click on the wsdl file and go to "web services", select "generate client" and pretty much click through the wizard.
It will generate an axis based proxy client. Do a bit of googling for further details, but this should help.
Cheers
Todd.