I've noticed the following *pattern* in a SOAP WS which I'd like to share with you and have ur input please :)
Assume the signature of a method of a WS being the following:
public boolean getSum(int x, int y, int sum)
As you can see the given method calculates the sum of x and y but it does not return the result to the client but instead the client access the value of sum via reference.
The return type of boolean is used so that the client can know if calculation of the sum was succesful or not.
I'd like to ask under which circumstances is the above approach suitable as well as the pros/cons.
TIA :D
-
SOAP method invocation (4 messages)
- Posted by: Markos Charatzas
- Posted on: September 14 2005 11:18 EDT
Threaded Messages (4)
- Just use jaxrpc holder by sigates ouyang on September 14 2005 20:49 EDT
- Just use jaxrpc holder by Markos Charatzas on September 15 2005 01:35 EDT
- I think it is. by sigates ouyang on September 15 2005 11:33 EDT
- Just use jaxrpc holder by Markos Charatzas on September 15 2005 01:35 EDT
- Sound an exception to be unable to do a summation by S??bastien Tardif on September 14 2005 23:35 EDT
-
Just use jaxrpc holder[ Go to top ]
- Posted by: sigates ouyang
- Posted on: September 14 2005 20:49 EDT
- in response to Markos Charatzas
server side:
public boolean getSum(int x, int y, javax.xml.rpc.holders.IntHolder sum)
{
sum.value = x+y;
return true;
}
client:
IntHolder sum = new IntHolder();
boolean suc = xxx.getSum(1,2,sum);
if(suc){
int result = sum.vlaue;
} -
Just use jaxrpc holder[ Go to top ]
- Posted by: Markos Charatzas
- Posted on: September 15 2005 01:35 EDT
- in response to sigates ouyang
sigates ouyang, thanks for ur comment.
What you wrote is exactly right, but I'm more concern (as I said in my first post) on whether or not it's common practise, plus its pros/cons :)
Thanks! -
I think it is.[ Go to top ]
- Posted by: sigates ouyang
- Posted on: September 15 2005 23:33 EDT
- in response to Markos Charatzas
sorry,:P
I think it's common practise.
In fact, use hodler will be more efficient then use exception
Just my point. -
Sound an exception to be unable to do a summation[ Go to top ]
- Posted by: S??bastien Tardif
- Posted on: September 14 2005 23:35 EDT
- in response to Markos Charatzas
You should throw an exception for very exceptional case like be unable to do a summation.