log.error("Not jsonrpc-2.0 request.")
        return Response(response="Expected jsonrpc 2.0 request.", status=400)
    methods_map = _initialize_map()
    method_name = body.get("method")
    if method_name not in methods_map:
        log.error("Unrecognized method: %s.", method_name)
        return Response(response=f"Unrecognized method: {method_name}.", status=400)
    handler = methods_map[method_name]
    params = {}
    try:
        if body.get("params"):
            params_json = json.loads(str(body.get("params")))
            params = BaseSerialization.deserialize(params_json)
    except Exception as err:
        log.error("Error deserializing parameters.")
        log.error(err)
        return Response(response="Error deserializing parameters.", status=400)
    log.debug("Calling method %.", {method_name})
    try:
        output = handler(**params)
        output_json = BaseSerialization.serialize(output)
        log.debug("Returning response")
        return Response(
            response=json.dumps(output_json or "{}"), headers={"Content-Type": "application/json"}
        )
    except Exception as e:
        log.error("Error when calling method %s.", method_name)
        log.error(e)
        return Response(response=f"Error executing method: {method_name}.", status=500)