'WSGI method that controls (de)serialization and method dispatch.'

@webob.dec.wsgify(RequestClass=Request)
def __call__(self, request):

    action_args = self.get_action_args(request.environ)
    action = action_args.pop('action', None)
    content_type = request.params.get('ContentType')
    try:
        deserialized_request = self.dispatch(self.deserializer, action, request)
        action_args.update(deserialized_request)
        LOG.debug('Calling    %(controller)s    :    %(action)s', {'controller': self.controller, 'action': action})
        action_result = self.dispatch(self.controller, action, request, **action_args)
    except TypeError as err:
        LOG.error('Exception    handling    resource:    %s', err)
        msg = _('The    server    could    not    comply    with    the    request    since    it    is    either    malformed    or    otherwise    incorrect.')
        err = webob.exc.HTTPBadRequest(msg)
        http_exc = translate_exception(err, request.best_match_language())
        raise exception.HTTPExceptionDisguise(http_exc)
    except webob.exc.HTTPException as err:
        if isinstance(err, aws_exception.HeatAPIException):
            raise
        if (not isinstance(err, webob.exc.HTTPError)):
            raise
        if isinstance(err, webob.exc.HTTPServerError):
            LOG.error('Returning    %(code)s    to    user:    %(explanation)s', {'code': err.code, 'explanation': err.explanation})
        http_exc = translate_exception(err, request.best_match_language())
        raise exception.HTTPExceptionDisguise(http_exc)
    except exception.HeatException as err:
        raise translate_exception(err, request.best_match_language())
    except Exception as err:
        log_exception(err, sys.exc_info())
        raise translate_exception(err, request.best_match_language())
    try:
        serializer = self.serializer
        if (serializer is None):
            if (content_type == 'JSON'):
                serializer = serializers.JSONResponseSerializer()
            else:
                serializer = serializers.XMLResponseSerializer()
        response = webob.Response(request=request)
        self.dispatch(serializer, action, response, action_result)
        return response
    except Exception:
        if (content_type == 'JSON'):
            try:
                err_body = action_result.get_unserialized_body()
                serializer.default(action_result, err_body)
            except Exception:
                LOG.warning('Unable    to    serialize    exception    response')
        return action_result
