{
//
// create and return WS-A ActionNotSupported fault
//
Object[] filler = { getContextPath(), action };
SoapFault wsaFault = new SoapFault(_MESSAGES.get("ActionNotSupported", filler));
wsaFault.setCode(SoapConstants.SENDER_QNAME);
wsaFault.setSubCode(WsaConstants.ACTION_NOT_SUPPORTED_FAULT_QNAME);
Element detail = XmlUtils.createElement(WsaConstants.PROBLEM_ACTION_QNAME);
XmlUtils.setElement(detail, WsaConstants.ACTION_QNAME, action);
wsaFault.setDetail(detail);
return wsaFault.toXML();
}
MessageHandler handler = capability.getMessageHandler(action);
Method method = handler.getMethod();
Object[] parameters = null;
try
{
//
// translate from XML -> POJO. the reflection call will take
// care of casting the generic Object references to the actual
// method parameter types
//
parameters = handler.fromXML(soapBody);
//
// invoke operation and translate result to XML
//
Object result = method.invoke(capability, parameters);
return handler.toXML(result);
}
catch (Throwable error)
{
//
// the exception is the generic reflection error, and useless
// to the programmer - we want to report on the REAL cause
//
Throwable cause = error.getCause();
if (cause != null) // sanity check
error = cause;
Logger log = getLog();
//
// log the details of de-serialization and reflection
//
if (parameters != null)
LoggingUtils.logCall(log, method, parameters);
LoggingUtils.logError(log, error);
SoapFault response = SoapUtils.convertToFault(error);
return response.toXML();
}
}