axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From damitha kumarage <dami...@opensource.lk>
Subject Re: Handling faults
Date Mon, 27 Sep 2004 06:27:34 GMT
+1
On Sat, 2004-09-25 at 06:56, Carsten Blecken wrote:
> 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