return null;
}
}
resEnv = (SOAPEnvelope)resMsg.getSOAPEnvelope();
SOAPBodyElement bodyEl = resEnv.getFirstBody();
if (bodyEl instanceof RPCElement) {
try {
resArgs = ((RPCElement) bodyEl).getParams();
} catch (Exception e) {
log.error(Messages.getMessage("exception00"), e);
throw AxisFault.makeFault(e);
}
if (resArgs != null && resArgs.size() > 0) {
// If there is no return, then we start at index 0 to create the outParams Map.
// If there IS a return, then we start with 1.
int outParamStart = 0;
// If we have resArgs and the returnType is specified, then the first
// resArgs is the return. If we have resArgs and neither returnType
// nor paramXMLTypes are specified, then we assume that the caller is
// following the non-JAX-RPC AXIS shortcut of not having to specify
// the return, in which case we again assume the first resArgs is
// the return.
// NOTE 1: the non-JAX-RPC AXIS shortcut allows a potential error
// to escape notice. If the caller IS NOT following the non-JAX-RPC
// shortcut but instead intentionally leaves returnType and params
// null (ie., a method that takes no parameters and returns nothing)
// then, if we DO receive something it should be an error, but this
// code passes it through. The ideal solution here is to require
// this caller to set the returnType to void, but there's no void
// type in XML.
// NOTE 2: we should probably verify that the resArgs element
// types match the expected returnType and paramXMLTypes, but I'm not
// sure how to do that since the resArgs value is a Java Object
// and the returnType and paramXMLTypes are QNames.
// GD 03/15/02 : We're now checking for invalid metadata
// config at the top of this method, so don't need to do it
// here. Check for void return, though.
if (!XMLType.AXIS_VOID.equals(returnType)) {
RPCParam param = (RPCParam)resArgs.get(0);
result = param.getValue();
outParamStart = 1;
}
for (int i = outParamStart; i < resArgs.size(); i++) {
RPCParam param = (RPCParam) resArgs.get(i);
Class javaType = getJavaTypeForQName(param.getQName());
Object value = param.getValue();
// Convert type if needed
if (javaType != null &&
!javaType.isAssignableFrom(value.getClass())) {
value = JavaUtils.convert(value, javaType);
}
outParams.put(param.getQName(), value);
outParamsList.add(value);
}
}
} else {
// This is a SOAPBodyElement, try to treat it like a return value
try {
result = bodyEl.getValueAsType(returnType);
} catch (Exception e) {
// just return the SOAPElement
result = bodyEl;
}