-
1. Re: java.lang.ClassCastException: org.jboss.axis.Message
rmerry72 Apr 6, 2006 2:24 AM (in response to greenbean)This seems to be caused by the Sun StubBase class is casting the response message to com.sun.xml.messaging.saaj.soap.MessageImpl as per the decomiled code snippet below:
MessageImpl response = (MessageImpl)state.getResponse().getMessage();
if(!useFastInfoset() && response.isFastInfoset())
_properties.put("com.sun.xml.rpc.client.ContentNegotiation", "optimistic");
Since JBoss uses an axis message factory the response message is in fact not an instance of MessageImpl but rather org.jboss.axis.Message. Seems to be a very presumptuous cast and all itisdoing isattempting to use FastInfoSet.
I've yet to find a work around, as this code is part of Sun'sJAX-RPC implementation and the stubs are generated by the developers kit. -
2. Re: java.lang.ClassCastException: org.jboss.axis.Message
rmerry72 Apr 6, 2006 11:13 PM (in response to greenbean)Found a work around. Nasty as it is it does work :-)
The solution is to override the offending method in the generated stub:protected void _postSendingHook(StreamingSenderState state) throws Exception { Object maintainSession = _getProperty("javax.xml.rpc.session.maintain"); if (maintainSession != null && maintainSession.equals(((Object) (Boolean.TRUE)))) { Object cookieJar = _getProperty("com.sun.xml.rpc.client.http.CookieJar"); if (cookieJar == null) { SOAPMessageContext messageContext = state.getMessageContext(); cookieJar = messageContext.getProperty("com.sun.xml.rpc.client.http.CookieJar"); _setProperty("com.sun.xml.rpc.client.http.CookieJar", cookieJar); } } // MessageImpl response = (MessageImpl)state.getResponse().getMessage(); // if(!useFastInfoset() && response.isFastInfoset()) // _properties.put("com.sun.xml.rpc.client.ContentNegotiation", "optimistic"); }
This can only be done after the service stub has been generated by wscompile, so you'll have to modify your build to recompile this class after you've generated it. Easy to do every so often if your service doesn' cange much and you can modify it manually every so often. Hard to do automatically as part of a full build from sratch.
Hope this helps,
Rick -
3. Re: java.lang.ClassCastException: org.jboss.axis.Message
jordan.rivington Apr 13, 2006 2:32 PM (in response to greenbean)Could you please explain the work around in a little more detail. Where should this method override go as far as code location? Must I rebuild the library file for axis from source? I dont think so, but I am a little confused. If I put this in my client code, there are access issues with _setProperty and such.
I always the only stupid question is the one left unasked.
Thanks for the help.
Jordan Rivington -
4. Re: java.lang.ClassCastException: org.jboss.axis.Message
spicagao May 2, 2006 10:45 PM (in response to greenbean)Hi
I get the same problem on 4.0.3 with jwsdp1.6 and workaround it by overwrite _postSendingHook.
It does work to me but it not a good solution. Since JBoss 4.0.3 still use Axis, how about the JBossWS on 4.0.4?
Also how about the jwsdp2.0?