Chapter 8 Using the Sybase Web Services Client Proxy


Obtaining output values and the return value

When the invokeService method returns, the return value can be assigned to a variable you have defined. After the return, you retrieve any output values from the parameter vector that was passed in. The Client Proxy code will ensure that any output values are added, in order, to the parameter vector.

When you use the findByGender method, you can see that a two-dimensional array of strings is returned. Casting the return value from invokeService() allows you to assign it to the proper object in the client code.

//...code for initializing  methodName and params
//omitted
//Catch  the array of strings returned from the Web
//services
String[][] rtn = (String[][])proxy.invokeService(
                          methodName,  params );

In the second example in the "Filling the parameters vector" section, the Web service being called returns an int and has an out parameter.

//call invokeService and obtain  the return value
Integer i = (Integer)proxy.invokeService(  methodName,
                                          params  );

int rtn = i.intValue();

//Get the out value
dblHolder = (DoubleHolder)params.get(  1 );

 


Copyright © 2002 Sybase, Inc. All rights reserved.