axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marcello <>
Subject handler: response message manipulation
Date Wed, 05 Sep 2007 10:22:20 GMT

I'm dealing with a service which sends back a response that's not complying
with the service WSDL. In details, it sometimes sends an attribute set to "
" (blank) while the attribute itself is defined as integer. The result is a
"java.lang.reflect.InvocationTargetException" during deserialization phase.

Waiting for the service provider to fix the issue, I'm trying to write an
handler to remove the message elements containing the offending attribute
(those elements are defined with minOccurs=0) with the following
(simplified) code on Axis 1.1:

public void invoke(MessageContext msgContext) throws AxisFault {

    Message response = msgContext.getResponseMessage();
    SOAPEnvelope responseEnvelope = response.getSOAPEnvelope();
    SOAPBodyElement sbe = (SOAPBodyElement) responseEnvelope.getFirstBody();
    Iterator it =
    if ( it != null ) {
        while ( it.hasNext() ) {

Inspecting the message I can see that it's not containing the offending
elements anymore, so I expected no more errors in the deserialization.
Unfortunately, it is not the case. The deserializer still fails with the
same exception on the same elements (that I can't see anymore at the end of
the handler) as before.

I've also tried with a responseEnvelope.removeBodyElement(sbe) before
modifications and a responseEnvelope.addBodyElement(sbe) before leaving the
method, but it doesn't help.

I'm missing something needed to let the axis engine know that the message
has changed? Or what else?

I've also tried a different approach, dealing with the DOM document obtained
with sbe.getAsDocument() which gave me other problems, object of the next

Any hints?

Thanks in advance.

Marcello Desantis
Storming Sas

View this message in context:
Sent from the Axis - Dev mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message