AMFMessageBody responseBody = new AMFMessageBody();
context.setResponseBody(responseBody);
AMFMessageBody messageBody = context.getRequestBody();
Endpoint endpoint = context.getEndpoint();
RemotingMessage remotingMessage = (RemotingMessage) messageBody.getData();
try {
responseBody.setData(endpoint.routeMessageToService(remotingMessage));
} catch (MessagingException e) {
LogWriter.error(getClass(), "Failed to route message to service: " + e, e);
ErrorMessage errorBody = new ErrorMessage("Service destination could not be reached",
remotingMessage.getDestination(), remotingMessage.getOperation(), remotingMessage.getParameters());
responseBody.setData(errorBody);