示例#1
0
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_engine_resume_receive(
    axis2_engine_t * engine,
    const axutil_env_t * env,
    axis2_msg_ctx_t * msg_ctx)
{
    axis2_status_t status = AXIS2_FAILURE;
    axis2_conf_ctx_t *conf_ctx = NULL;
    axis2_conf_t *conf = NULL;
    axutil_array_list_t *phases = NULL;

    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Start:axis2_engine_resume_receive");
    /* Find and invoke the phases */
    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
    phases = axis2_conf_get_in_phases_upto_and_including_post_dispatch(conf, env);

    axis2_engine_resume_invocation_phases(engine, env, phases, msg_ctx);
    /* Invoking the message receiver */
    if(axis2_msg_ctx_get_server_side(msg_ctx, env) && !axis2_msg_ctx_is_paused(msg_ctx, env))
    {
        /* Invoke the message receivers */
        axis2_op_ctx_t *op_ctx = NULL;

        status = axis2_engine_check_must_understand_headers(env, msg_ctx);

        if(status != AXIS2_SUCCESS)
        {
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Checking for must understand headers failed");
            return status;
        }

        op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
        if(op_ctx)
        {
            axis2_op_t *op = axis2_op_ctx_get_op(op_ctx, env);
            if(op)
            {
                axis2_msg_recv_t *receiver = NULL;
                receiver = axis2_op_get_msg_recv(op, env);
                if(!receiver)
                {
                    AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                        "Message receiver not set in operation description");
                    return AXIS2_FAILURE;
                }
                status = axis2_msg_recv_receive(receiver, env, msg_ctx, axis2_msg_recv_get_derived(
                    receiver, env));
            }
        }
    }
    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Exit:axis2_engine_resume_receive");
    return status;
}
示例#2
0
文件: svc.c 项目: Denisss025/wsfcpp
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_svc_add_op(
    axis2_svc_t * svc,
    const axutil_env_t * env,
    axis2_op_t * op)
{
    axis2_status_t status = AXIS2_FAILURE;
    axis2_msg_recv_t *msg_recv = NULL;
    const axutil_qname_t *qname = NULL;
    axis2_char_t *key = NULL;
    const axis2_char_t *svcname = NULL;
    axutil_array_list_t *mappings_list = NULL;
    int size = 0;
    int j = 0;

    AXIS2_PARAM_CHECK(env->error, op, AXIS2_FAILURE);
    svcname = axis2_svc_get_name(svc, env);
    qname = axis2_op_get_qname(op, env);
    if(qname)
        key = axutil_qname_get_localpart(qname, env);
    mappings_list = axis2_op_get_wsamapping_list(op, env);
    /* Adding action mappings into service */
    if(mappings_list)
        size = axutil_array_list_size(mappings_list, env);
    for(j = 0; j < size; j++)
    {
        axis2_char_t *mapping = NULL;

        mapping = (axis2_char_t *)axutil_array_list_get(mappings_list, env, j);
        status = axis2_svc_add_mapping(svc, env, mapping, op);
        if(AXIS2_SUCCESS != status)
        {
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                            "Adding operation %s to service %s mapping list failed", svcname, key);
            return status;
        }
    }

    status = axis2_op_set_parent(op, env, svc);
    if(AXIS2_SUCCESS != status)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Setting service %s as operation %s parent failed",
                        svcname, key);
        return status;
    }
    msg_recv = axis2_op_get_msg_recv(op, env);
    if(msg_recv == NULL)
    {
        msg_recv = axis2_desc_builder_load_default_msg_recv(env);
        axis2_op_set_msg_recv(op, env, msg_recv);
    }
    if(key)
    {
        /* If service defines the operation, then we should not override with module level
         * operation. Module operations are global. If any setting to be modified, those operations
         * can be defined in service */
        if(!axutil_hash_get(svc->op_alias_map, key, AXIS2_HASH_KEY_STRING))
        {
            axutil_hash_set(svc->op_alias_map, key, AXIS2_HASH_KEY_STRING, op);
        }
    }
    return AXIS2_SUCCESS;
}
示例#3
0
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_engine_receive(
    axis2_engine_t * engine,
    const axutil_env_t * env,
    axis2_msg_ctx_t * msg_ctx)
{
    axis2_conf_ctx_t *conf_ctx = NULL;
    axis2_conf_t *conf = NULL;
    axis2_op_ctx_t *op_ctx = NULL;
    axis2_op_t *op = NULL;
    axutil_array_list_t *pre_calculated_phases = NULL;
    axutil_array_list_t *op_specific_phases = NULL;
    axis2_status_t status = AXIS2_FAILURE;

    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Start:axis2_engine_receive");
    AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);

    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);

    conf = axis2_conf_ctx_get_conf(conf_ctx, env);

    pre_calculated_phases = axis2_conf_get_in_phases_upto_and_including_post_dispatch(conf, env);

    if(axis2_msg_ctx_is_paused(msg_ctx, env))
    {
        /* The message has paused, so re-run them from the position they stopped. */
        axis2_engine_resume_invocation_phases(engine, env, pre_calculated_phases, msg_ctx);
        if(axis2_msg_ctx_is_paused(msg_ctx, env))
        {
            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Message context is paused. So return here.");
            return AXIS2_SUCCESS;
        }

        /* Resume op specific phases */
        op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
        if(op_ctx)
        {
            op = axis2_op_ctx_get_op(op_ctx, env);
            op_specific_phases = axis2_op_get_in_flow(op, env);
            axis2_engine_resume_invocation_phases(engine, env, op_specific_phases, msg_ctx);
            if(axis2_msg_ctx_is_paused(msg_ctx, env))
            {
                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
                    "Message context is paused. So return here.");
                return AXIS2_SUCCESS;
            }
        }
    }
    else
    {
        status = axis2_engine_invoke_phases(engine, env, pre_calculated_phases, msg_ctx);
        if(status != AXIS2_SUCCESS)
        {
            if(axis2_msg_ctx_get_server_side(msg_ctx, env))
            {
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Invoking pre-calculated phases failed");
                return status;
            }
        }

        if(axis2_msg_ctx_is_paused(msg_ctx, env))
        {
            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Message context is paused. So return here.");
            return AXIS2_SUCCESS;
        }

        op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
        if(op_ctx)
        {
            op = axis2_op_ctx_get_op(op_ctx, env);
            op_specific_phases = axis2_op_get_in_flow(op, env);
            status = axis2_engine_invoke_phases(engine, env, op_specific_phases, msg_ctx);
            if(status != AXIS2_SUCCESS)
            {
                axis2_char_t *op_name = NULL;
                op_name = axutil_qname_get_localpart(axis2_op_get_qname(op, env), env);
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                    "Invoking operation specific phases failed for operation %s", op_name);
                return status;
            }

            if(axis2_msg_ctx_is_paused(msg_ctx, env))
            {
                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
                    "Message context is paused. So return here.");
                return AXIS2_SUCCESS;
            }
        }
    }

    if((axis2_msg_ctx_get_server_side(msg_ctx, env)) && !(axis2_msg_ctx_is_paused(msg_ctx, env)))
    {
        axis2_msg_recv_t *receiver = NULL;

        status = axis2_engine_check_must_understand_headers(env, msg_ctx);
        if(status != AXIS2_SUCCESS)
        {
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Check for must understand headers failed");
            return status;
        }

        /* Invoke the message receivers */
        if(!op)
        {
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Operation not found");
            return AXIS2_FAILURE;
        }
        receiver = axis2_op_get_msg_recv(op, env);
        if(!receiver)
        {
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                "Message receiver not set in operation description");
            return AXIS2_FAILURE;
        }
        status = axis2_msg_recv_receive(receiver, env, msg_ctx, axis2_msg_recv_get_derived(
            receiver, env));
    }

    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Exit:axis2_engine_receive");

    return status;
}