Wednesday, April 16, 2008

SoapUI and WebLogic Web Services

I am assisting one of our clients who is using WebLogic Web Services to test these web services using SoapUI. I have used SoapUI for almost 4 years and had never found this bug. So, here is what's happening:

The weblogic.webservice.GenericHandler is extended to do some security checks. Within this special Class, the handleRequest method is overridden as such:

public boolean handleRequest(MessageContext mc) {
SOAPMessageContext messageContext = (SOAPMessageContext) mc;
SOAPBody soapBody = messageContext.getMessage().getSOAPPart()
Iterator itBody = soapBody.getChildElements();
while (itBody.hasNext()) {
Object obj =;
SOAPElement bodyElement = (SOAPElement) obj;
String name = bodyElement.getElementName().getLocalName();

The following line:
SOAPElement bodyElement = (SOAPElement) obj;

throws a ClassCastException, the stack trace is shown below:
java.lang.ClassCastException: weblogic.webservice.core.soap.SOAPTextElement
at weblogic.webservice.core.HandlerChainImpl.handleRequest(
at weblogic.webservice.core.DefaultOperation.process(
at weblogic.webservice.server.Dispatcher.process(
at weblogic.webservice.server.Dispatcher.doDispatch(
at weblogic.webservice.server.Dispatcher.dispatch(
at weblogic.webservice.server.WebServiceManager.dispatch(
at weblogic.webservice.server.servlet.WebServiceServlet.serverSideInvoke(
at weblogic.webservice.server.servlet.ServletBase.doPost(
at weblogic.webservice.server.servlet.WebServiceServlet.doPost(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at weblogic.servlet.internal.ServletStubImpl$
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(
at weblogic.servlet.internal.WebAppServletContext$
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(
at weblogic.servlet.internal.ServletRequestImpl.execute(
at weblogic.kernel.ExecuteThread.execute(

I did read in just one post that any default spaces in the request is converted
to a SoapTextElement.

If I add a simple guardian to check for
and skip the loop it works, but I know that's isn't the right solution.

If I create a simple Web Services Client using Axis(WSDL2Java),
I don't see the same exception.

Have you seen this, how did you fix this? Any ideas?
Here is the thread which I saw on bea web site.

1. bea site
And this one which I guess is related to Spring:

2. Spring site

1 comment:

  1. Hi Meera,
    Have you find out any solution to issue related to java.lang.ClassCastException: weblogic.webservice.core.soap.SOAPTextElement?
    Please write soluction to fix this issue.