void                SpecificationParser::GetNamedParameters(Json::Value &val, Procedure &result)
{
    vector<string> parameters = val[KEY_SPEC_PROCEDURE_PARAMETERS].getMemberNames();
    for (unsigned int i=0; i < parameters.size(); ++i)
    {
        result.AddParameter(parameters.at(i), toJsonType(val[KEY_SPEC_PROCEDURE_PARAMETERS][parameters.at(i)]));
    }
}
void                SpecificationParser::GetPositionalParameters(Json::Value &val, Procedure &result)
{
    //Positional parameters
    for (unsigned int i=0; i < val[KEY_SPEC_PROCEDURE_PARAMETERS].size(); i++)
    {
        stringstream paramname;
        paramname << "param" << (i+1);
        result.AddParameter(paramname.str(), toJsonType(val[KEY_SPEC_PROCEDURE_PARAMETERS][i]));
    }
}
    Procedure* SpecificationParser::GetProcedure(Json::Value &signature)
    {
        procedure_t procedureType;
        std::string name_key;
        std::string procedureName;
        Procedure* result;

        if ((signature.isMember(KEY_METHOD_NAME)
             || signature.isMember(KEY_NOTIFICATION_NAME))
                && signature.isMember(KEY_PROCEDURE_PARAMETERS))
        {
            if (signature.isMember(KEY_METHOD_NAME))
            {
                name_key = KEY_METHOD_NAME;
                procedureType = RPC_METHOD;
            }
            else
            {
                name_key = KEY_NOTIFICATION_NAME;
                procedureType = RPC_NOTIFICATION;

            }
            if (signature[name_key].isString()
                    && (signature[KEY_PROCEDURE_PARAMETERS].isObject() || signature[KEY_PROCEDURE_PARAMETERS].isNull()))
            {
                procedureName = signature[name_key].asString();
                vector<string> parameters =
                        signature[KEY_PROCEDURE_PARAMETERS].getMemberNames();
                if(procedureType == RPC_NOTIFICATION)
                {
                    result = new Procedure(procedureName, NULL);
                }
                else
                {
                    jsontype_t returntype = JSON_OBJECT;
                    if(signature.isMember(KEY_RETURN_TYPE))
                    {
                        returntype = toJsonType(signature[KEY_RETURN_TYPE]);
                    }
                    result = new Procedure(procedureName, returntype, NULL);
                }
                for (unsigned int i = 0; i < parameters.size(); i++)
                {
                    result->AddParameter(parameters.at(i), toJsonType(signature[KEY_PROCEDURE_PARAMETERS][parameters.at(i)]));
                }
            }
            else
            {
                throw JsonRpcException(Errors::ERROR_SERVER_PROCEDURE_SPECIFICATION_SYNTAX,
                                       "Invalid signature types in fileds: "
                                       + signature.toStyledString());
            }
        }
        else
        {
            throw JsonRpcException(Errors::ERROR_SERVER_PROCEDURE_SPECIFICATION_SYNTAX,
                                   "procedure declaration does not contain method/notification name or paramters: "
                                   + signature.toStyledString());
        }
        return result;
    }