Hi all,
I am trying to invoke a Web service from a servlet. Since the servlet is
supposed to
be able to be dynamic w.r.t. the Web service's name, I am using a
generic way to
invoke the service as follows:
Service service = new Service();
Object ret;
try
{
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new URL(wsEndpoint));
call.setOperationName( new
javax.xml.namespace.QName(wsNamespace,wsMethod));
ret = call.invoke(val);
The service is deployed and accessible by a Java application using the
same invoke method.
When running the servlet, I am getting an NoClassDefFoundError error
pointing to the line
that contains the new Service() statement (the full error report is
attached below).
I don't understand this. When running the exact code as a Java
application it worked and
I have provided the same set of jars, i.e. activation.jar, axis.jar,
axis-ant.jar,
commons-discovery-0.2.jar, commons-logging-1.0.4.jar, jaxrpc.jar,
log4j-1.2.8.jar,
mail.jar, saaj.jar, wsdl4j-1.5.1.jar, xmlsec-1.2.1.jar.
Since the incriminated line is the first occurrence of a
service-specific class, I might
have failed to understand how to make archives known to a servlet. Isn't
it enough to
get the servlet compiled and provide the jars in the Web application's
lib sub-directory ?
My overall intent is to provide a page that enables invoking Web
services per
button-click. Is there a better way to do that than using servlets. I
already tried
applets but failed.
I would greatly apreciate any comments.
Thanks & regards,
Juliane.
-------------------------------------------------
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoClassDefFoundError
org.apache.axis.client.Service.getAxisClient(Service.java:103)
org.apache.axis.client.Service.<init>(Service.java:112)
CallServiceServlet.callService(CallServiceServlet.java:51)
CallServiceServlet.doPost(CallServiceServlet.java:35)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache
Tomcat/5.5.9 logs.
________________________________
Apache Tomcat/5.5.9