You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Mark Whitlock <ma...@uk.ibm.com> on 2004/11/25 17:08:02 UTC

What changes for AXISCPP-216 "Improve fault handling"




Hi,
I am currently investigating AXISCPP-216 and I would like to discuss it
before I make any changes.

In the client, the engine throws AxisException's. If that AxisException
describes a user fault (in the wsdl) which the web service itself has
thrown, the generated client stubs convert that AxisException into a
MathOpsService_AxisClientException. The MathOpsService_AxisClientException
is a generated class that is thrown back to the client application. So the
FaultMappingDocClient looks like ...

try {
 result=ws.div(i1,i2);
} catch(MathOpsService_AxisClientException &e) {
  ISoapFault *fault = (ISoapFault *)e.getFault();
  faultName = fault->getCmplxFaultObjectName().c_str();
  if (0==strcmp("DivByZeroStruct",faultName)) {
    DivByZeroStruct *p=(DivByZeroStruct*)fault->getCmplxFaultObject();
  } else ...
} catch (AxisException &e) {
  ...
} catch (...) {
  ...
}

So all AxisException's which aren't faults defined in the wsdl are caught
by the catch (AxisException&). I propose to make two small improvements to
this by moving AxisGenException.hpp from include/axis into src/common since
applications never need it. Also I propose to hide the ISoapFault from
client applications by generating suitable methods on the
MathOpsService_AxisClientException.....

} catch(MathOpsService_AxisClientException &e) {
  faultName = e.getFaultName();
  if (0==strcmp("DivByZeroStruct",faultName)) {
    DivByZeroStruct *p=(DivByZeroStruct*)e.getFaultObject();
  } else ...

I thought about the generated stub throwing a DivByZeroStruct instead of a
MathOpsService_AxisClientException. The DivByZeroStruct would have to
extend AxisException to get the other original information about the fault.
But I don't think this would work since the fault in the wsdl could be a
basic type (int or string) not a complex type and so could not extend
AxisException.

I expect to make these changes for 1.5 not 1.4.
Comments?
Mark
Mark Whitlock
IBM


Re: What changes for AXISCPP-216 "Improve fault handling"

Posted by Damitha Kumarage <da...@opensource.lk>.
Hi Mark,
Since you are not going to do the improvments until after that 1.4 release
let's start discussing this soon after the release.
Read below
On Thu, 25 Nov 2004 16:08:02 +0000, Mark Whitlock wrote
> Hi,
> I am currently investigating AXISCPP-216 and I would like to discuss 
> it before I make any changes.
> 
> In the client, the engine throws AxisException's. If that AxisException
> describes a user fault (in the wsdl) which the web service itself has
> thrown, the generated client stubs convert that AxisException into a
> MathOpsService_AxisClientException. The MathOpsService_AxisClientException
> is a generated class that is thrown back to the client application. 
> So the FaultMappingDocClient looks like ...
> 
> try {
>  result=ws.div(i1,i2);
> } catch(MathOpsService_AxisClientException &e) {
>   ISoapFault *fault = (ISoapFault *)e.getFault();
>   faultName = fault->getCmplxFaultObjectName().c_str();
>   if (0==strcmp("DivByZeroStruct",faultName)) {
>     DivByZeroStruct *p=(DivByZeroStruct*)fault->getCmplxFaultObject()
> ;  } else ... } catch (AxisException &e) {  ... } catch (...) {  ... }
> 
> So all AxisException's which aren't faults defined in the wsdl are caught
> by the catch (AxisException&). I propose to make two small 
> improvements to this by moving AxisGenException.hpp from 
> include/axis into src/common since applications never need it.

OK 

>Also 
> I propose to hide the ISoapFault from client applications by 
> generating suitable methods on the MathOpsService_AxisClientException.....
> 
> } catch(MathOpsService_AxisClientException &e) {
>   faultName = e.getFaultName();
>   if (0==strcmp("DivByZeroStruct",faultName)) {
>     DivByZeroStruct *p=(DivByZeroStruct*)e.getFaultObject();
>   } else ...
> 
> I thought about the generated stub throwing a DivByZeroStruct 
> instead of a MathOpsService_AxisClientException.

This is good

> The DivByZeroStruct 
> would have to extend AxisException to get the other original 
> information about the fault. But I don't think this would work since 
> the fault in the wsdl could be a basic type (int or string) not a 
> complex type and so could not extend AxisException.
> 
> I expect to make these changes for 1.5 not 1.4.
> Comments?
> Mark
> Mark Whitlock
> IBM


--
Damitha Kumarage
hSenid Software International (PVT) Ltd
damitha@hSenid.lk

Lanka Software Foundation (http://www.opensource.lk)