Example #1
0
AXIS2_EXTERN void AXIS2_CALL
axis2_svc_free(
    axis2_svc_t * svc,
    const axutil_env_t * env)
{
    if(!svc)
    {
        return;
    }
    if(svc->impl_class)
    {
        AXIS2_SVC_SKELETON_FREE((axis2_svc_skeleton_t *)svc->impl_class, env);
    }
    if(svc->param_container)
    {
        axutil_param_container_free(svc->param_container, env);
    }

    if(svc->flow_container)
    {
        axis2_flow_container_free(svc->flow_container, env);
    }

    if(svc->filename)
    {
        AXIS2_FREE(env->allocator, svc->filename);
        svc->filename = NULL;
    }

    if(svc->svc_desc)
    {
        AXIS2_FREE(env->allocator, svc->svc_desc);
        svc->svc_desc = NULL;
    }

    svc->parent = NULL;

    if(svc->module_list)
    {
        int i = 0;
        int size = 0;

        size = axutil_array_list_size(svc->module_list, env);
        for(i = 0; i < size; i++)
        {
            axutil_qname_t *qname = NULL;
            qname = axutil_array_list_get(svc->module_list, env, i);
            if(qname)
            {
                axutil_qname_free(qname, env);
            }
        }
        axutil_array_list_free(svc->module_list, env);
    }

    if(svc->schema_list)
    {
        axutil_array_list_free(svc->schema_list, env);
    }

    if(svc->engaged_module_list)
    {
        axutil_array_list_free(svc->engaged_module_list, env);
    }

    if(svc->axis_svc_name)
    {
        AXIS2_FREE(env->allocator, svc->axis_svc_name);
        svc->axis_svc_name = NULL;
    }

    if(svc->op_alias_map)
    {
        axutil_hash_index_t *hi = NULL;
        void *val = NULL;

        for(hi = axutil_hash_first(svc->op_alias_map, env); hi; hi = axutil_hash_next(env, hi))
        {
            axutil_hash_this(hi, NULL, NULL, &val);

            if(val)
            {
                if(axis2_op_is_from_module((axis2_op_t *)val, env) == AXIS2_FALSE)
                {
                    axis2_op_free((axis2_op_t *)val, env);
                }
                val = NULL;
            }
        }

        axutil_hash_free(svc->op_alias_map, env);
    }

    if(svc->op_action_map)
    {
        axutil_hash_index_t *hi = NULL;
        const void *key = NULL;

        for(hi = axutil_hash_first(svc->op_action_map, env); hi; hi = axutil_hash_next(env, hi))
        {
            axutil_hash_this(hi, &key, NULL, NULL);

            if(key)
            {
                AXIS2_FREE(env->allocator, (axis2_char_t *)key);
                key = NULL;
            }
        }
        axutil_hash_free(svc->op_action_map, env);
    }

    if(svc->op_rest_map)
    {
        axis2_core_utils_free_rest_map(env, svc->op_rest_map);
    }

    if(svc->schema_target_ns_prefix)
    {
        AXIS2_FREE(env->allocator, svc->schema_target_ns_prefix);
        svc->schema_target_ns_prefix = NULL;
    }

    if(svc->target_ns)
    {
        AXIS2_FREE(env->allocator, svc->target_ns);
        svc->target_ns = NULL;
    }

    if(svc->wsdl_path)
    {
        AXIS2_FREE(env->allocator, svc->wsdl_path);
        svc->wsdl_path = NULL;
    }

    if(svc->folder_path)
    {
        AXIS2_FREE(env->allocator, svc->folder_path);
        svc->folder_path = NULL;
    }

    if(svc->target_ns_prefix)
    {
        AXIS2_FREE(env->allocator, svc->target_ns_prefix);
        svc->target_ns_prefix = NULL;
    }

    if(svc->qname)
    {
        axutil_qname_free(svc->qname, env);
    }

    if(svc->style)
    {
        AXIS2_FREE(env->allocator, svc->style);
    }

    if(svc->base)
    {
        axis2_desc_free(svc->base, env);
    }
    if(svc->mutex)
    {
        axutil_thread_mutex_destroy(svc->mutex);
    }
    AXIS2_FREE(env->allocator, svc);
}
Example #2
0
static axis2_svc_t *
axis2_svc_client_create_annonymous_svc(
    axis2_svc_client_t * svc_client,
    const axutil_env_t * env)
{

    /**
     now add anonymous operations to the axis2 service for use with the
     shortcut client API. NOTE: We only add the ones we know we'll use
     later in the convenience API; if you use
     this constructor then you can't expect any magic!
     */
    axutil_qname_t *tmp_qname;
    axis2_svc_t *svc;
    axis2_op_t *op_out_in, *op_out_only, *op_robust_out_only;
    axis2_phases_info_t *info = NULL;

    tmp_qname = axutil_qname_create(env, AXIS2_ANON_SERVICE, NULL, NULL);
    if(!tmp_qname)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"Error creating QName for service");
        return NULL;
    }

    svc = axis2_svc_create_with_qname(env, tmp_qname);
    axutil_qname_free(tmp_qname, env);
    if(!svc)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error creating the service");
        return NULL;
    }

    tmp_qname = axutil_qname_create(env, AXIS2_ANON_OUT_IN_OP, NULL, NULL);
    if(!tmp_qname)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error creating the QName for out-in operation");
        return NULL;
    }
    op_out_in = axis2_op_create_with_qname(env, tmp_qname);
    axutil_qname_free(tmp_qname, env);

    tmp_qname = axutil_qname_create(env, AXIS2_ANON_OUT_ONLY_OP, NULL, NULL);
    if(!tmp_qname)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error creating the QName for out-only operation");
        return NULL;
    }
    op_out_only = axis2_op_create_with_qname(env, tmp_qname);
    axutil_qname_free(tmp_qname, env);

    tmp_qname = axutil_qname_create(env, AXIS2_ANON_ROBUST_OUT_ONLY_OP, NULL, NULL);
    if(!tmp_qname)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Error creating the QName for robust-out-only operation");
        return NULL;
    }
    op_robust_out_only = axis2_op_create_with_qname(env, tmp_qname);
    axutil_qname_free(tmp_qname, env);

    if(!op_out_in || !op_out_only || !op_robust_out_only)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
        if(op_out_in)
        {
            axis2_op_free(op_out_in, env);
        }
        if(op_out_only)
        {
            axis2_op_free(op_out_only, env);
        }
        if(op_robust_out_only)
        {
            axis2_op_free(op_robust_out_only, env);
        }

        return NULL;
    }

    axis2_op_set_msg_exchange_pattern(op_out_in, env, AXIS2_MEP_URI_OUT_IN);
    axis2_op_set_msg_exchange_pattern(op_out_only, env, AXIS2_MEP_URI_OUT_ONLY);
    axis2_op_set_msg_exchange_pattern(op_robust_out_only, env, AXIS2_MEP_URI_ROBUST_OUT_ONLY);

    /* Setting operation phase */
    info = axis2_conf_get_phases_info(svc_client->conf, env);
    axis2_phases_info_set_op_phases(info, env, op_out_in);
    axis2_phases_info_set_op_phases(info, env, op_out_only);
    axis2_phases_info_set_op_phases(info, env, op_robust_out_only);
    axis2_svc_add_op(svc, env, op_out_in);
    axis2_svc_add_op(svc, env, op_out_only);
    axis2_svc_add_op(svc, env, op_robust_out_only);
    return svc;
}