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

Reply via email to