webMethods Microsoft Package 9.0 | webMethods Package for Microsoft .NET Documentation | webMethods Package for Microsoft .NET Client API Programmer’s Documentation | Invoking a Service using Java Client API from Designer | Generating a C# Client Code from Designer | Invoke the Service and Retrieve the Output (IData)
 
Invoke the Service and Retrieve the Output (IData)
The fifth and sixth stages are combined in the serverContext.invoke method, which invokes the service with the IData input object and receives the reply as an Idata output object:
{
// Invoke the service
IData outputIData = serverContext.invoke( serviceFolder,
serviceName, inputIData );
// get a data cursor for out output IData
IDataCursor outputCursor = outputIData.getCursor();
// the addInts service has one return variable, "value" as string
// however we can retrieve the value as an int using the IDataUtil
// helper method getInteger();
sum = IDataUtil.getInt( outputCursor, "value", 0 );
}
catch( Exception ex )
{
Console.WriteLine("The service invoke failed, reason=" + ex );
}