SOAP method invocation


XML & Web services: SOAP method invocation

  1. SOAP method invocation (4 messages)

    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

    Threaded Messages (4)

  2. Just use jaxrpc holder[ Go to top ]

    server side:
    public boolean getSum(int x, int y, javax.xml.rpc.holders.IntHolder sum)
      sum.value = x+y;
      return true;

      IntHolder sum = new IntHolder();
      boolean suc = xxx.getSum(1,2,sum);
        int result = sum.vlaue;
  3. Just use jaxrpc holder[ Go to top ]

    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 :)

  4. I think it is.[ Go to top ]


    I think it's common practise.

    In fact, use hodler will be more efficient then use exception

    Just my point.
  5. You should throw an exception for very exceptional case like be unable to do a summation.