// suitable for passing to java.lang.reflect.Method.invoke()
// Make sure we respect parameter ordering if we know about it
// from metadata, and handle whatever conversions are necessary
// (values -> Holders, etc)
for (int i = 0; i < numArgs; i++) {
RPCParam rpcParam = (RPCParam) args.get(i);
Object value = rpcParam.getValue();
// first check the type on the paramter
ParameterDesc paramDesc = rpcParam.getParamDesc();
// if we found some type info try to make sure the value type is
// correct. For instance, if we deserialized a xsd:dateTime in
// to a Calendar and the service takes a Date, we need to convert
if (paramDesc != null && paramDesc.getJavaType() != null) {
// Get the type in the signature (java type or its holder)
Class sigType = paramDesc.getJavaType();
// Convert the value into the expected type in the signature
value = JavaUtils.convert(value,
sigType);
rpcParam.setValue(value);
}
argValues.add(value);
}
COMBridge bridge = new COMBridge();
Hashtable props = new Hashtable();
props.put("progid", progID);
if (threadingModel != null)
props.put("threadmodel", threadingModel);
Object result = bridge.execute(methodName, argValues, props);
RPCElement resBody = new RPCElement(methodName + "Response");
resBody.setPrefix(body.getPrefix());
resBody.setNamespaceURI(body.getNamespaceURI());
resBody.setEncodingStyle(msgContext.getEncodingStyle());
Message resMsg = msgContext.getResponseMessage();
SOAPEnvelope resEnv;
// If we didn't have a response message, make sure we set one up
if (resMsg == null) {
resEnv = new SOAPEnvelope(msgContext.getSOAPConstants());
resMsg = new Message(resEnv);
msgContext.setResponseMessage(resMsg);
} else {
resEnv = resMsg.getSOAPEnvelope();
}
QName returnQName = operation.getReturnQName();
if (returnQName == null) {
returnQName = new QName("", methodName + "Return");
}
// For SOAP 1.2, add a result
if (msgContext.getSOAPConstants() ==
SOAPConstants.SOAP12_CONSTANTS) {
returnQName = Constants.QNAME_RPC_RESULT;
}
RPCParam param = new RPCParam(returnQName, result);
param.setParamDesc(operation.getReturnParamDesc());
if (!operation.isReturnHeader()) {
resBody.addParam(param);
} else {
resEnv.addHeader(new RPCHeaderParam(param));
}