You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by John Eapen <j1...@gmail.com> on 2009/04/25 01:05:51 UTC

Fault/Exception Handling on Axis2

Hi ,

We are in the process of migrating from Axis1 to Axis2 and using Axis2
1.4.1. ( using adb )
I am having some trouble understanding the code generation regarding Fault
handling and mapping to Java Exceptions.

1. In Axis2, why are exceptions based of wsdl messages and not xsd elements
as was the case in axis1. ?

2. Is this an issue with wrapping/unwrapping of exceptions or something to
do with wsdl version (2.0 Vs 1.1) ?
    I know, things are proabably better with WSDL 2.0 but we are still on
wsdl 1.1, since I am not sure about wsdl 2 adoption.

3. In Axis2, how does one create a exception class hierarchy. (  fault2
extends fault1  etc etc ...) since its based on messages.

In my opinion, Axis1 was much better in this regard.

Appreciate any insight

Thanks
   John

-------------------------------
   public  example.WithdrawResponse withdraw(example.Withdraw param0)
           throws InsufficientFundFaultMessage,
                     AccountNotExistFaultMessage
{
 ...
}

The WSDL sections are ..

<wsdl:message name="InsufficientFundFaultMessage">
        <wsdl:part element="tns:InsufficientFundFault" name="fault"/>
    </wsdl:message>

    <wsdl:message name="AccountNotExistFaultMessage">
        <wsdl:part element="tns:AccountNotExistFault" name="fault"/>
    </wsdl:message>

<element name="AccountNotExistFault">
                <complexType>
                    <sequence>
                        <element name="account" type="xsd:string"/>
                    </sequence>
                </complexType>
            </element>

            <element name="InsufficientFundFault">
                <complexType>
                    <sequence>
                        <element name="account" type="xsd:string"/>
                        <element name="balance" type="xsd:int"/>
                        <element name="requestedFund" type="xsd:int"/>
                    </sequence>
                </complexType>
            </element>

Fault/Exception Handling on Axis2

Posted by John Eapen <j1...@gmail.com>.
Hi ,

We are in the process of migrating from Axis1 to Axis2 and using Axis2
1.4.1. ( using adb )
I am having some trouble understanding the code generation regarding Fault
handling and mapping to Java Exceptions.

1. In Axis2, why are exceptions based of wsdl messages and not xsd elements
as was the case in axis1. ?

2. Is this an issue with wrapping/unwrapping of exceptions or something to
do with wsdl version (2.0 Vs 1.1) ?
    I know, things are proabably better with WSDL 2.0 but we are still on
wsdl 1.1, since I am not sure about wsdl 2 adoption.

3. In Axis2, how does one create a exception class hierarchy. (  fault2
extends fault1  etc etc ...) since its based on messages.

In my opinion, Axis1 was much better in this regard.

Appreciate any insight

Thanks
   John

-------------------------------
   public  example.WithdrawResponse withdraw(example.Withdraw param0)
           throws InsufficientFundFaultMessage,
                     AccountNotExistFaultMessage
{
 ...
}

The WSDL sections are ..

<wsdl:message name="InsufficientFundFaultMessage">
        <wsdl:part element="tns:InsufficientFundFault" name="fault"/>
    </wsdl:message>

    <wsdl:message name="AccountNotExistFaultMessage">
        <wsdl:part element="tns:AccountNotExistFault" name="fault"/>
    </wsdl:message>

<element name="AccountNotExistFault">
                <complexType>
                    <sequence>
                        <element name="account" type="xsd:string"/>
                    </sequence>
                </complexType>
            </element>

            <element name="InsufficientFundFault">
                <complexType>
                    <sequence>
                        <element name="account" type="xsd:string"/>
                        <element name="balance" type="xsd:int"/>
                        <element name="requestedFund" type="xsd:int"/>
                    </sequence>
                </complexType>
            </element>

Re: Fault/Exception Handling on Axis2

Posted by Amila Suriarachchi <am...@gmail.com>.
On Sat, Apr 25, 2009 at 4:35 AM, John Eapen <j1...@gmail.com> wrote:

>
> Hi ,
>
> We are in the process of migrating from Axis1 to Axis2 and using Axis2
> 1.4.1. ( using adb )
> I am having some trouble understanding the code generation regarding Fault
> handling and mapping to Java Exceptions.
>
> 1. In Axis2, why are exceptions based of wsdl messages and not xsd elements
> as was the case in axis1. ?


within the generated Exception class there is an ADBBean class corresponding
to the xsd element.

>
>
> 2. Is this an issue with wrapping/unwrapping of exceptions or something to
> do with wsdl version (2.0 Vs 1.1) ?
>     I know, things are proabably better with WSDL 2.0 but we are still on
> wsdl 1.1, since I am not sure about wsdl 2 adoption.
>
> 3. In Axis2, how does one create a exception class hierarchy. (  fault2
> extends fault1  etc etc ...) since its based on messages.


In wsdl I think you can not extend a soap fault from another. Always fault
message refers to an xsd element.
But you can have extensions with complex types refer to the wsdl.

thanks,
Amila.

>
>
> In my opinion, Axis1 was much better in this regard.
>
> Appreciate any insight
>
> Thanks
>    John
>
> -------------------------------
>    public  example.WithdrawResponse withdraw(example.Withdraw param0)
>            throws InsufficientFundFaultMessage,
>                      AccountNotExistFaultMessage
> {
>  ...
> }
>
> The WSDL sections are ..
>
> <wsdl:message name="InsufficientFundFaultMessage">
>         <wsdl:part element="tns:InsufficientFundFault" name="fault"/>
>     </wsdl:message>
>
>     <wsdl:message name="AccountNotExistFaultMessage">
>         <wsdl:part element="tns:AccountNotExistFault" name="fault"/>
>     </wsdl:message>
>
> <element name="AccountNotExistFault">
>                 <complexType>
>                     <sequence>
>                         <element name="account" type="xsd:string"/>
>                     </sequence>
>                 </complexType>
>             </element>
>
>             <element name="InsufficientFundFault">
>                 <complexType>
>                     <sequence>
>                         <element name="account" type="xsd:string"/>
>                         <element name="balance" type="xsd:int"/>
>                         <element name="requestedFund" type="xsd:int"/>
>                     </sequence>
>                 </complexType>
>             </element>
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/