axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samisa Abeysinghe <samisa_abeysin...@yahoo.com>
Subject Re: Suggestion on receiving soap fault
Date Fri, 07 May 2004 08:00:15 GMT
Hi Damitha,
   Both 
> iStatus = ws.add(i1,i2, iResult)
and
> iResult = ws.add(i1,i2, iStatus)
take too many parameters. This does not look neat.

We can have 
   result = ws.add(i1,i2);
which is a natural method call.
To track the error use a seperate method call, in non exception case.

Also 
> try {
>     ws.add(i1,i2, iResult)
> }catch(exception& ){}
looks like a procedure call and not function call as Mark earlier pointed out.

A better mechanism is
 try {
     result = ws.add(i1,i2);
 } catch(exception& ){}

Also if you think of semantics, add should take two parameters and return a result.
The error code is something external to the method invocation, and thus has to be handled
external
to the method call. Passing a third parameter to add violates programming principles.

Thanks,
Samisa...





--- damitha@opensource.lk wrote:
> > Damitha,
> >     What is X in this case?
> 
> #ifdef __ENABLE_AXIS_EXCEPTION__
> #define AXISC_TRY try {
> #define AXISC_CATCH(X) } catch (X) {
> #define AXISC_ENDCATCH }
> #define AXISC_THROW(X) throw AxisException(X)
> 
> #else
> #define AXISC_TRY
> #define AXISC_CATCH(X)
> #define AXISC_ENDCATCH
> #define AXISC_THROW(X) return X
> 
> #endif
> 
> X in the first AXISC_THROW(X) (exception enabled case) is an int error
> code which already defined or any exception object(for example bad_cast)
> 
> in the seconde AXISC_THROW(X) (exception disabled) is an int error code
> >
> >>From non exception case:
> >> #define AXISC_THROW(X) return X
> > suggests that X must be int.
> >
> > If the exception model cannot use objects (i.e. throw and catch objects)
> > that is not that useful.
> As you can see above you can throw and catch objects
> 
> >
> > Also, if you are to use
> >> #define AXISC_THROW(X) return X
> > then the methods invocation would look like:
> >> iStatus = ws.add(i1, i2, iResult);
> >
> > But the prefferes way is
> >
> >  result = ws.add(i1, i2);
> 
> Yes there are two ways.(both are if you don't use exceptions)
> either
> iStatus = ws.add(i1,i2, iResult)
> or
> iResult = ws.add(i1,i2, iStatus)
> 
> I prefer the first
> 
> if you use exceptions
> 
> we can have
> try
>     ws.add(i1,i2, iResult)
> catch(exception& ){}
> 
> Still you can get the result through iResult
> 
> damitha
> 
> 
> >
> > --- damitha@opensource.lk wrote:
> >> Hi Mark,
> >> Yes, that comes to the other part of the solution. What I plan is to use
> >> macros like this in the axis c++ libraries
> >>
> >> #ifdef __ENABLE_AXIS_EXCEPTION__
> >> #define AXISC_TRY try {
> >> #define AXISC_CATCH(X) } catch (X) {
> >> #define AXISC_ENDCATCH }
> >> #define AXISC_THROW(X) throw AxisException(X)
> >>
> >> #else //you don't want exception handling enabled
> >> #define AXISC_TRY
> >> #define AXISC_CATCH(X)
> >> #define AXISC_ENDCATCH
> >> #define AXISC_THROW(X) return X
> >>
> >> #endif
> >>
> >> So that the user of the library can disable exception handling if he
> >> wants. This is important when your service or client is written in C.
> >>
> >> > damitha@opensource.lk wrote:
> >> >> Curretnly Axis C++ does not handle a soap body that contains a soap
> >> >> fault.
> >> > [snip]
> >> >> In addition SoapDeseriazer concatenate Faultcode, Faultstring,
> >> >> Faultactor
> >> >> and FaultDetail into a string. So when we receive iStatus = fail we
> >> can
> >> >> request
> >> >> the fault string that the SoapDeserializer stored as follows
> >> >>
> >> >> iStatus = ws.add(i1, i2, iResult);
> >> >> if(AXIS_SUCCESS == iStatus)
> >> >>     printf("Result : %d\n\n", iResult);
> >> >> else
> >> >> {
> >> >>     printf("Failed\n");
> >> >>     ws.getFaultDetail(&pcDetail);
> >> >>     printf("pcDetail:%s\n", pcDetail);
> >> >> }
> >> >>
> >> >> Any suggestions?
> >> >
> >> > Throw an exception with the error stuff inside it.
> >> >
> >> > If you insist on sticking with return codes, for goodness's sake don't
> >> > use the "getLastError" stuff - it's horribly vulnerable to threading
> >> > errors.
> >> agree
> >>
> >> >
> >> > As an academic argument against your solution: You've removed all
> >> > functions from the system. Everything is a procedure with output
> >> > variables.
> >> >
> >> > - Mark
> >>
> >> damitha
> >>
> >
> >
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Win a $20,000 Career Makeover at Yahoo! HotJobs
> > http://hotjobs.sweepstakes.yahoo.com/careermakeover
> >
> >
> 



	
		
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

Mime
View raw message