* @param operationDesc - The OperationDescription that for the invoked method.
* @return
*/
protected Object createResponse(Method method, Object[] args, MessageContext responseContext,
OperationDescription operationDesc) throws Throwable {
Message responseMsg = responseContext.getMessage();
try {
if (log.isDebugEnabled()) {
log.debug("Processing the response Message to create the return value(s).");
}
// Find out if there was a fault on the response and create the appropriate
// exception type.
if (hasFaultResponse(responseContext)) {
Throwable t = getFaultResponse(responseContext, operationDesc);
throw t;
}
// Get the classloader that was used for the request processing
ClassLoader cl = (ClassLoader) responseContext.getProperty(Constants.CACHE_CLASSLOADER);
if (cl == null) {
InvocationContext ic = responseContext.getInvocationContext();
if (ic != null) {
MessageContext requestMC = ic.getRequestMessageContext();
if (requestMC != null) {
cl = (ClassLoader) responseContext.getProperty(Constants.CACHE_CLASSLOADER);
if (cl != null) {
if (log.isDebugEnabled()) {
log.debug("Obtained ClassLoader for the request context: " + cl);
}
}
}
}
} else {
if (log.isDebugEnabled()) {
log.debug("Obtained ClassLoader for the response context: " + cl);
}
}
Object object =
MethodMarshallerFactory.getMarshaller(operationDesc, true, cl)
.demarshalResponse(responseMsg, args, operationDesc);
if (log.isDebugEnabled()) {
log.debug("The response was processed and the return value created successfully.");
}
return object;
} finally {
responseMsg.close();
// Free incoming stream
try {
responseContext.freeInputStream();
}
catch (Throwable t) {