}
}
public Object invoke() throws CorbaInvocationException {
// Create request
Request request = object._request(operation.getName());
// Set parameters
Any arg = null;
List memArgs = new ArrayList();
if (parameters!=null) {
List patamList = new LinkedList(Arrays.asList(parameters));
Iterator paramsIter = patamList.iterator();
for (int i = 0; i < parameterTypeList.size(); i++) {
Member member = (Member) parameterTypeList.get(i);
DataType type = member.getDataType();
Object value = null;
String mode = member.getMode();
if (mode.equals(Member.MODE_IN)) {
arg = request.add_in_arg();
value = paramsIter.next();
} else if (mode.equals(Member.MODE_INOUT)) {
arg = request.add_inout_arg();
value = paramsIter.next();
} else if (mode.equals(Member.MODE_OUT)) {
arg = request.add_out_arg();
value = CorbaUtil.getEmptyValue(type);
}
memArgs.add(arg);
CorbaUtil.insertValue(arg, type, value);
}
}
// Set return type
DataType returnType = operation.getReturnType();
if (returnType!=null) {
TypeCode typeCode = returnType.getTypeCode();
request.set_return_type(typeCode);
}
// Set exceptions
List exceptions = operation.getRaises();
if (exceptions!=null && !exceptions.isEmpty()) {
ExceptionList exceptionList = request.exceptions();
for (int i = 0; i < exceptions.size(); i++) {
ExceptionType exType = (ExceptionType) exceptions.get(i);
exceptionList.add(exType.getTypeCode());
}
}
// Invoke
request.invoke();
// Get exception
Object returnValue = null;
Exception exception = request.env().exception();
if (exception == null) {
// Extract the return value
if (returnType != null) {
Any returned = request.return_value();
returnValue = CorbaUtil.extractValue(returnType, returned);
}
// Extract the values of inout and out parameters
returnedParams = new ArrayList();