Uploaded image for project: 'JBoss Web Services'
  1. JBoss Web Services
  2. JBWS-2651

ClassCast Exception in case of malformed webservice response

XMLWordPrintable

      At the moment jbossws throws a ClassCast Exception in case of an illegal webservice response (missing closing tag, etc...) :
      [code]
      Caused by: javax.xml.ws.WebServiceException: java.lang.ClassCastException: org.jboss.ws.core.soap.Te
      xtImpl cannot be cast to org.jboss.ws.core.soap.SOAPElementI
      mpl
      at org.jboss.ws.core.jaxws.client.ClientImpl.handleRemoteException(ClientImpl.java:404)
      at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:314)
      at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:172)
      at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:152)
      at $Proxy311.bookOrders(Unknown Source)
      at com.skidata.dta.server.co.v3_0.classic.impl.BookOrdersHelper.invoke(BookOrdersHelper.java
      :46)
      ... 12 more
      Caused by: java.lang.ClassCastException: org.jboss.ws.core.soap.TextImpl cannot be cast to org.jboss
      .ws.core.soap.SOAPElementImpl
      at org.jboss.ws.core.CommonSOAPBinding.getParameterFromMessage(CommonSOAPBinding.java:894)
      at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPBinding.java:634)
      at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:380)
      at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:302)
      ... 16 more
      [/code]

      It would be helpful to get the actual Parse Excpetion from the xml parser instead of this classcastexcpetion.
      Digging through the code i found out that this might occur because the MessageFectory to parse the response is initialized with ignoreParseErrors = true. e.g in the SOAPMessageUnMarshallerHTTP at line 82 (source .3.1.1.GA)
      [code]
      MimeHeaders mimeHeaders = getMimeHeaders(metadata);
      soapMsg = getMessageFactory().createMessage(mimeHeaders, inputStream, true);
      [/code]

              rhn-engineering-ema Jim Ma
              gandulf.k Gandulf Kohlweiss (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: