axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanjiva Weerawarana" <sanj...@opensource.lk>
Subject Re: Handling faults
Date Sat, 25 Sep 2004 07:53:33 GMT
Handling faults+1! I think it makes a lot of sense to provide direct access
to
the SOAP fault.

Sanjiva.

----- Original Message ----- 
From: Carsten Blecken
To: axis-c-dev@ws.apache.org
Sent: Saturday, September 25, 2004 6:56 AM
Subject: Handling faults


Hi,
the current fault handling in the client stub code could be improved (in my
opinion).
I wanted to propose to add a member variable of type ISoapFault to the
generated
AxisClientException which constains the fault being thrown. By providing a
fault
accessor in the AxisClientException clients could directly deal with the
fault
information in their catch clauses and access fault string, fault reason,
fault actor
and also the custom fault detail.
This would allow error handling like
        try {
                <invoke web service>
        } catch(AxisClientException& e) {
                // check for soap fault
                if (!(e.getFault() == 0)) {
                        ISoapFault* fault = e.getFault();
                        cout << "Found SOAP fault : " <<
e.getFault()->getFaultstring().c_str() << endl;
                } else {
                        cout << "Exception : " << e.what() << endl;
                }
        } catch(AxisException& e) {
                         cout << "Exception : " << e.what() << endl;
        } catch(exception& e) {
                cout << "Unknown exception has occured" << endl;
        } catch(...) {
                         cout << "Unknown exception has occured"  << endl;
        }
If people a happy with that approach I can provide a patch to the WSDL2Ws
compiler.
Thanks,
Carsten


Mime
View raw message