You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by Juan Moratilla Peón <jm...@novanotio.es> on 2009/10/21 15:24:27 UTC

Bug in axiom 1.2.7???Problem to response a fault in the web service

Hello guys,

 

I’m using axiom 1.2.7 with Axis2-1.4 (axiom 1.2.7 is included with Axis2-1.4
distribution). I have a web service with security using username token, with
rampart 1.4. I have used Axis Databinding (ADB) to implement the
server-side.

My problem is that when I launch an Exception in one of the methods of the
service (I have declared it as a fault in the wsdl) an exception is thrown
in org.apache.rampart.RampartMessageData  (line 322) and the server replies
with an internal error. This  exception is thrown in
org.apache.rampart.RampartMessageData   in a catch block, where an AxisFault
is catched:

}catch (AxisFault e){

      logger.error(“-------Error:”+e.getMessage(),e);//I added this line

      throw new RampartException(“errorInExtractingMsgProps”,e); 

}

 

So I modified the rampart source code to add an error log as you can see
above. My discover was that it comes from an Exception thrown in
org.apache.axiom.soap.impl.builder.SOAP11BuilderHelper, in
processText(SMLStreamReader parser, OMElement value) method:

 

private void processText(XMLStreamReader parser, OMElement value) {

        try {

            int token = parser.next();

            while (token != XMLStreamReader.END_ELEMENT) {

                if (token == XMLStreamReader.CHARACTERS) {

                    factory.createOMText(value, parser.getText());

                } else {

                    throw new SOAPProcessingException(

                            "Only Characters are allowed here");

                }

                token = parser.next();

            }

 

 

        } catch (XMLStreamException e) {

            throw new SOAPProcessingException(e); //THAT IS THE EXCEPCION
THROWN

        }

    }

 

Adding logs in this method I discover that the first parser.next() call
returns a token which (token == XMLStreamReader.START_ELEMENT) is true, so
the exception is thrown.

So if I modified the method processText as:

 

private void processText(XMLStreamReader parser, OMElement value) {

        try {

            int token = parser.next();

            while (token != XMLStreamReader.END_ELEMENT) {

                if (token == XMLStreamReader.CHARACTERS) {

                    factory.createOMText(value, parser.getText());

                }else if(token==XMLStreamReader.START_ELEMENT){

           //JUST DO NOTHING

          } else {

                    throw new SOAPProcessingException(

                            "Only Characters are allowed here");//THAT IS
THE EXCEPCION THROWN

                }

                token = parser.next();

            }

 

 

        } catch (XMLStreamException e) {

            throw new SOAPProcessingException(e); 

        }

    }

 

It works well because I don’t get the exception "Only Characters are allowed
here".

 

Is it a bug of axiom? I have seen in axiom 1.2.8 that the same exception
would be thrown.

Or is it problem of the next() method of the implementation of the interface
XMLStreamReader, org.apache.axiom.om.impl.llom.OMStAXWrapper?

 

Has someone some idea?

 

Thanks,

 

 

Juan Moratilla Peón

 

Telefonica I+D Madrid, Spain