axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juan Moratilla Peón <jmorati...@novanotio.es>
Subject Problems in axiom1.2.7 when throwing an Exception (fault) in a method of a web service with axis2-1.4
Date Wed, 21 Oct 2009 15:25:35 GMT
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

 

 

 

 


Mime
View raw message