コード例 #1
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;
}
コード例 #2
0
ファイル: wsf_util.c プロジェクト: harunjuhasz/wsf
/* CHANGED */
void
wsf_util_create_op_and_add_to_svc (
    wsf_svc_info_t * svc_info,
    char *action,
    axutil_env_t * env,
    char *op_name,
    VALUE ht_mep)
{
    axis2_svc_t *svc = NULL;
    axis2_op_t *op = NULL;
    axutil_qname_t *op_qname = NULL;
    op_qname = axutil_qname_create (env, op_name, NULL, NULL);
    svc = svc_info->svc;

    if (NULL != svc && NULL != op_name) {
        op = axis2_svc_get_op_with_name (svc_info->svc, env, op_name);
        if (!op) {
            axis2_conf_t *conf = NULL;
            axis2_conf_ctx_t *conf_ctx = NULL;
            axis2_phases_info_t *info = NULL;

            op_qname = axutil_qname_create (env, op_name, NULL, NULL);

            op = axis2_op_create_with_qname (env, op_qname);

            axis2_op_set_msg_recv (op, env, svc_info->msg_recv);

            conf_ctx = wsf_worker_get_conf_ctx (svc_info->ruby_worker, env);

            conf = axis2_conf_ctx_get_conf (conf_ctx, env);

            info = axis2_conf_get_phases_info (conf, env);
            axis2_phases_info_set_op_phases (info, env, op);
            axis2_svc_add_op (svc_info->svc, env, op);

            if (ht_mep) {
                char operation[300];
                VALUE mep_value;
                char *mep;

                AXIS2_LOG_DEBUG (env->log, AXIS2_LOG_SI,
                                 "[wsf_service] ht mep not null, %s", op_name);
                snprintf (operation, sizeof(operation), "%s", op_name);
                if(TYPE(ht_mep) == T_HASH)
                {
                    mep_value = rb_hash_aref(ht_mep, ID2SYM(rb_intern(operation)));
                }
                if(mep_value != Qnil)
                {
                    mep = RSTRING(mep_value)->ptr;
                    if (mep) {
                        AXIS2_LOG_DEBUG (env->log, AXIS2_LOG_SI,
                                         "[wsf_service] op mep %s", mep);
                        if (strcmp (mep, "IN_ONLY") == 0) {
                            axis2_op_set_msg_exchange_pattern (op, env,
                                                               AXIS2_MEP_URI_IN_ONLY);
                            AXIS2_LOG_DEBUG (env->log, AXIS2_LOG_SI,
                                             "[wsf_service] AXIS2_MEP_URI_IN_ONLY");

                        } else if (strcmp (mep, "IN_OUT") == 0) {
                            axis2_op_set_msg_exchange_pattern (op, env,
                                                               AXIS2_MEP_URI_IN_OUT);
                            AXIS2_LOG_DEBUG (env->log, AXIS2_LOG_SI,
                                             "[wsf_service] AXIS2_MEP_URI_IN_OUT");
                        }
                    }
                }
                else {
                    AXIS2_LOG_DEBUG (env->log, AXIS2_LOG_SI,
                                     "[wsf service] message exchange pattern for %s not found",
                                     op_name);
                }
            }
            if (action) {
                axis2_svc_add_mapping (svc_info->svc, env, action, op);
            }
        }
    }
    if(op_qname) {
        axutil_qname_free(op_qname, env);
    }

    return;
}
コード例 #3
0
AXIS2_EXTERN void AXIS2_CALL
axis2_svc_client_send_receive_non_blocking_with_op_qname(
    axis2_svc_client_t * svc_client,
    const axutil_env_t * env,
    const axutil_qname_t * op_qname,
    const axiom_node_t * payload,
    axis2_callback_t * callback)
{
    axis2_msg_ctx_t *msg_ctx = NULL;
    AXIS2_TRANSPORT_ENUMS transport_in_protocol;
    axis2_bool_t qname_free_flag = AXIS2_FALSE;

    AXIS2_PARAM_CHECK_VOID(env->error, svc_client);

    if(!op_qname)
    {
        op_qname = axutil_qname_create(env, AXIS2_ANON_OUT_IN_OP, NULL, NULL);
        if(!op_qname)
            return;
        qname_free_flag = AXIS2_TRUE;
    }

    svc_client->auth_failed = AXIS2_FALSE;
    svc_client->required_auth_is_http = AXIS2_FALSE;
    if(svc_client->auth_type)
    {
        AXIS2_FREE(env->allocator, svc_client->auth_type);
    }
    svc_client->auth_type = NULL;

    msg_ctx = axis2_msg_ctx_create(env, axis2_svc_ctx_get_conf_ctx(svc_client-> svc_ctx, env),
        NULL, NULL);
    if(!msg_ctx)
        return;

    if(!axis2_svc_client_fill_soap_envelope(env, svc_client, msg_ctx, payload))
    {
        return;
    }

    if(!axis2_svc_client_create_op_client(svc_client, env, op_qname))
    {
        return;
    }

    axis2_op_client_set_callback(svc_client->op_client, env, callback);
    axis2_op_client_add_out_msg_ctx(svc_client->op_client, env, msg_ctx);

    /* If dual channel */
    if(axis2_options_get_use_separate_listener(svc_client->options, env))
    {
        axis2_op_t *op = NULL;

        transport_in_protocol = axis2_options_get_transport_in_protocol(svc_client->options, env);
        if(transport_in_protocol == AXIS2_TRANSPORT_ENUM_MAX)
        {
            axis2_options_set_transport_in_protocol(svc_client->options, env,
                AXIS2_TRANSPORT_ENUM_HTTP);
            transport_in_protocol = AXIS2_TRANSPORT_ENUM_HTTP;
        }
        axis2_listener_manager_make_sure_started(svc_client->listener_manager, env,
            transport_in_protocol, svc_client->conf_ctx);
        /* Following sleep is required to ensure the listener is ready to receive response.
         If it is missing, the response gets lost. - Samisa */
        AXIS2_USLEEP(1);

        op = axis2_svc_get_op_with_qname(svc_client->svc, env, op_qname);
        /* At the end of the incoming flow this message receiver will be hit */
        axis2_op_set_msg_recv(op, env,
            AXIS2_CALLBACK_RECV_GET_BASE(svc_client-> callback_recv, env));
        axis2_op_client_set_callback_recv(svc_client->op_client, env, svc_client->callback_recv);
    }

    axis2_op_client_execute(svc_client->op_client, env, AXIS2_FALSE);
    axis2_svc_client_set_http_info(svc_client, env, msg_ctx);
    svc_client->auth_failed = axis2_msg_ctx_get_auth_failed(msg_ctx, env);
    svc_client->required_auth_is_http = axis2_msg_ctx_get_required_auth_is_http(msg_ctx, env);
    if(axis2_msg_ctx_get_auth_type(msg_ctx, env))
    {
        svc_client->auth_type = axutil_strdup(env, axis2_msg_ctx_get_auth_type(msg_ctx, env));
    }

    if(qname_free_flag)
    {
        axutil_qname_free((axutil_qname_t *)op_qname, env);
        op_qname = NULL;
    }
}