Axis2 schema validation using ADB - how to report a meaningful error message in Soap Fault

Avinder Bahra <[email protected]>
Newsgroups gmane.text.xml.axis.user
Message-ID <CAKikyT8Wx7aP_5o2t_zOy3PoQiwCWhLYv+9YYsWRZsNA1QZQiA@mail.gmail.com>
I am using Axis 1.6.2 to generate Java from WSDL using ADB for
serialisation. I have many elements in the WSDL that uses restriction and a
pattern e.g. element ABC:

    <simpleType name="ABC">
        <restriction base="string">
            <maxLength value="10"/>
            <minLength value="10"/>
            <pattern value="[1-9][0-9]{9}"/>
        </restriction>
    </simpleType>

The code generated is:

public void setABC(java.lang.String param){

    if
(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(param).matches("[1-9][0-9]{9}"))
{
        this.localABC=param;
    }
    else {
        throw new java.lang.RuntimeException();
    }
}

The problem is when I send a request with an invalid ABC element (e.g.
'AAA') in SoapUI I get the above runtime exception thrown and displayed as
the message detail in the SoapFault in a big stack trace in the response.
This occurs early on in the in bound message flow before it hits my
business logic implementation class.

What I would like is to report a meaningful error message wrt element  ABC
e.g. 'Invalid ABC format'.

Is there a way to do this in Axis2 using ADB (bearing in mind that I have
many elements similar to ABC)?

Thanks
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.