예제 #1
0
AXIS2_EXTERN axutil_qname_t *AXIS2_CALL
axiom_attribute_get_qname(
    axiom_attribute_t * attribute,
    const axutil_env_t * env)
{
    axutil_qname_t *qname = NULL;
    AXIS2_ENV_CHECK(env, NULL);
    if(!(attribute->qname))
    {
        if(attribute->ns)
        {
            qname = axutil_qname_create(env, axutil_string_get_buffer(attribute-> localname, env),
                axiom_namespace_get_uri(attribute->ns, env), axiom_namespace_get_prefix(
                    attribute-> ns, env));
        }
        else
        {
            qname = axutil_qname_create(env, axutil_string_get_buffer(attribute-> localname, env),
                NULL, NULL);
        }
        attribute->qname = qname;
        return qname;
    }
    return attribute->qname;
}
예제 #2
0
파일: phase.c 프로젝트: Denisss025/wsfcpp
static axis2_status_t
axis2_phase_remove_unique(
    const axutil_env_t * env,
    axutil_array_list_t * list,
    axis2_handler_t * handler)
{
    int i = 0, size = 0;
    axis2_bool_t remove_handler = AXIS2_FALSE;
    const axutil_string_t *handler_name = NULL;

    handler_name = axis2_handler_get_name(handler, env);
    size = axutil_array_list_size(list, env);
    for(i = 0; i < size; i++)
    {
        axis2_handler_t *obj = NULL;
        const axutil_string_t *obj_name = NULL;

        obj = (axis2_handler_t *)axutil_array_list_get(list, env, i);
        obj_name = axis2_handler_get_name(obj, env);
        if(obj == handler)
        {
            remove_handler = AXIS2_TRUE;
            break;
        }
        else if(!axutil_strcmp(axutil_string_get_buffer(handler_name, env),
            axutil_string_get_buffer(obj_name, env)))
        {
            remove_handler = AXIS2_TRUE;
            break;
        }
    }
    if(remove_handler)
        axutil_array_list_remove(list, env, i);
    return AXIS2_SUCCESS;
}
        /**
         * auto generated function definition signature
         * for "getSecurityConfigData|http://service.config.security.carbon.wso2.org" operation.
         * @param env environment ( mandatory)* @param MessageContext the outmessage context
         * @param _getSecurityConfigData of the adb_getSecurityConfigData_t*
         *
         * @return adb_getSecurityConfigDataResponse_t*
         */
        adb_getSecurityConfigDataResponse_t* axis2_skel_SecurityAdminService_getSecurityConfigData(const axutil_env_t *env , axis2_msg_ctx_t *msg_ctx,
                                              adb_getSecurityConfigData_t* _getSecurityConfigData,
                                          axis2_skel_SecurityAdminService_getSecurityConfigData_fault *fault )
        {
			adb_getSecurityConfigDataResponse_t* response = NULL;
			adb_SecurityConfigData_t* data = NULL;
			axutil_array_list_t* key_stores = NULL;
			axutil_array_list_t* user_groups = NULL;
	
			/* Create data */
			key_stores = axutil_array_list_create(env, 1);
			axutil_array_list_add(key_stores, env, axutil_string_get_buffer(
				axutil_string_create(env, "test"), env));

			user_groups = axutil_array_list_create(env, 1);
			axutil_array_list_add(user_groups, env, axutil_string_get_buffer(
				axutil_string_create(env, "admin"), env));
			axutil_array_list_add(user_groups, env, axutil_string_get_buffer(
				axutil_string_create(env, "everyone"), env));

			data = adb_SecurityConfigData_create(env);
			adb_SecurityConfigData_set_privateStore(data, env, "test");
			adb_SecurityConfigData_set_trustedKeyStores(data, env, key_stores);
			adb_SecurityConfigData_set_userGroups(data, env, user_groups);

			/* Create response */
			response = adb_getSecurityConfigDataResponse_create(env);
			adb_getSecurityConfigDataResponse_set_return(response, env, data);

			return response;
        }
예제 #4
0
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
axiom_namespace_to_string(
    axiom_namespace_t * om_namespace,
    const axutil_env_t * env)
{
    axis2_char_t *temp_str = NULL;
    AXIS2_ENV_CHECK(env, NULL);
    if(om_namespace->key)
    {
        AXIS2_FREE(env->allocator, om_namespace->key);
        om_namespace->key = NULL;
    }
    if((om_namespace->uri) && (NULL != om_namespace->prefix))
    {
        temp_str = axutil_stracat(env, axutil_string_get_buffer(om_namespace->uri, env), "|");
        om_namespace->key = axutil_stracat(env, temp_str, axutil_string_get_buffer(
            om_namespace->prefix, env));
        if(temp_str)
        {
            AXIS2_FREE(env->allocator, temp_str);
            temp_str = NULL;
        }
    }
    else if((om_namespace->uri) && !(om_namespace->prefix))
    {
        om_namespace->key = axutil_strdup(env, axutil_string_get_buffer(om_namespace->uri, env));
        if(!(om_namespace->key))
        {
            return NULL;
        }
    }
    return om_namespace->key;
}
예제 #5
0
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axiom_namespace_serialize(
    axiom_namespace_t * om_namespace,
    const axutil_env_t * env,
    axiom_output_t * om_output)
{
    int status = AXIS2_SUCCESS;
    if(!om_namespace)
    {
        return AXIS2_FAILURE;
    }

    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
    AXIS2_PARAM_CHECK(env->error, om_output, AXIS2_FAILURE);

    if(om_namespace->uri && NULL != om_namespace->prefix && axutil_strcmp(axutil_string_get_buffer(
        om_namespace->prefix, env), "") != 0)
    {
        status = axiom_output_write(om_output, env, AXIOM_NAMESPACE, 2, axutil_string_get_buffer(
            om_namespace-> prefix, env), axutil_string_get_buffer(om_namespace->uri, env));
    }
    else if(om_namespace->uri)
    {
        status = axiom_output_write(om_output, env, AXIOM_NAMESPACE, 2, NULL,
            axutil_string_get_buffer(om_namespace->uri, env));
    }
    return status;
}
예제 #6
0
파일: phase.c 프로젝트: Denisss025/wsfcpp
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_set_last_handler(
    axis2_phase_t * phase,
    const axutil_env_t * env,
    axis2_handler_t * handler)
{
    const axis2_char_t *handler_name = axutil_string_get_buffer(
        axis2_handler_get_name(handler, env), env);
    const axis2_char_t *phase_name = axis2_phase_get_name(phase, env);
    if(phase->last_handler_set)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_PHASE_LAST_HANDLER_ALREADY_SET, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Last handler of phase already set, so cannot set handler %s "
                "in to the phase %s as last handler", handler_name, phase_name);
        return AXIS2_FAILURE;
    }
    else
    {
        if(_axis2_phase_get_before_after(handler, env) != AXIS2_PHASE_ANYWHERE)
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_PHASE_LAST_HANDLER, AXIS2_FAILURE);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Invalid last handler %s set for the Phase %s",
                handler_name, phase_name);
            return AXIS2_FAILURE;
        }
        phase->last_handler = handler;
        phase->last_handler_set = AXIS2_TRUE;
    }

    return AXIS2_SUCCESS;
}
예제 #7
0
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_handler_desc_set_rules(
    axis2_handler_desc_t * handler_desc,
    const axutil_env_t * env,
    axis2_phase_rule_t * phase_rule)
{
    const axutil_string_t *str_name = axis2_handler_desc_get_name(handler_desc, env);
    const axis2_char_t *name = axutil_string_get_buffer(str_name, env);
    if(handler_desc->rules)
    {
        axis2_phase_rule_free(handler_desc->rules, env);
    }

    if(phase_rule)
    {
        handler_desc->rules = axis2_phase_rule_clone(phase_rule, env);
        if(!(handler_desc->rules))
        {
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                "Phase rule cloning failed for handler description %s", name);
            return AXIS2_FAILURE;
        }
    }

    return AXIS2_SUCCESS;
}
예제 #8
0
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
axiom_attribute_get_localname(
    axiom_attribute_t * attribute,
    const axutil_env_t * env)
{
    AXIS2_ASSERT(attribute);
    AXIS2_ASSERT(attribute->localname);
    return (axis2_char_t *)axutil_string_get_buffer(attribute->localname, env);
}
예제 #9
0
파일: phase.c 프로젝트: Denisss025/wsfcpp
AXIS2_EXTERN int AXIS2_CALL
_axis2_phase_get_before_after(
    axis2_handler_t * handler,
    const axutil_env_t * env)
{
    const axis2_char_t *before = NULL, *after = NULL;
    axis2_handler_desc_t *handler_desc = NULL;
    axis2_phase_rule_t *rules = NULL;
    const axis2_char_t *name = axutil_string_get_buffer(axis2_handler_get_name(handler, env), env);

    handler_desc = axis2_handler_get_handler_desc(handler, env);
    if(!handler_desc)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Handler description is not set for the Handler %s", name);
        return AXIS2_FAILURE;
    }

    rules = axis2_handler_desc_get_rules(handler_desc, env);
    if(!rules)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Handler rules are not set for the Handler Description %s", name);
        return AXIS2_FAILURE;
    }

    before = axis2_phase_rule_get_before(rules, env);
    after = axis2_phase_rule_get_after(rules, env);

    if(before && after)
    {
        if(!axutil_strcmp(before, after))
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_BEFORE_AFTER_HANDLERS_SAME, AXIS2_FAILURE);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                "Both before and after handlers cannot be the same");
            return AXIS2_FAILURE;
        }
        return AXIS2_PHASE_BOTH_BEFORE_AFTER;
    }
    else if(before)
    {
        return AXIS2_PHASE_BEFORE;
    }
    else if(after)
    {
        return AXIS2_PHASE_AFTER;
    }
    else
    {
        return AXIS2_PHASE_ANYWHERE;
    }
}
예제 #10
0
파일: phase.c 프로젝트: Denisss025/wsfcpp
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_remove_handler(
    axis2_phase_t * phase,
    const axutil_env_t * env,
    axis2_handler_t * handler)
{
    AXIS2_LOG_INFO(env->log, "Handler %s romoved from phase %s", axutil_string_get_buffer(
        axis2_handler_get_name(handler, env), env), phase->name);

    return axis2_phase_remove_unique(env, phase->handlers, handler);
}
예제 #11
0
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
axiom_attribute_get_localname(
    axiom_attribute_t * attribute,
    const axutil_env_t * env)
{
    AXIS2_ASSERT(attribute);
    AXIS2_ASSERT(attribute->localname);
    AXIS2_ENV_CHECK(env, NULL);
    AXIS2_PARAM_CHECK(env->error, attribute, NULL);
    return (axis2_char_t *)axutil_string_get_buffer(attribute->localname, env);
}
예제 #12
0
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
axiom_namespace_get_prefix(
    axiom_namespace_t * om_namespace,
    const axutil_env_t * env)
{
    if(om_namespace->prefix)
    {
        return (axis2_char_t *)axutil_string_get_buffer(om_namespace->prefix, env);
    }
    return NULL;
}
예제 #13
0
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
axiom_attribute_get_value(
    axiom_attribute_t * attribute,
    const axutil_env_t * env)
{
    if(attribute->value)
    {
        return (axis2_char_t *)axutil_string_get_buffer(attribute->value, env);
    }
    return NULL;
}
예제 #14
0
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
axiom_namespace_equals(
    axiom_namespace_t * om_namespace,
    const axutil_env_t * env,
    axiom_namespace_t * om_namespace1)
{
    int uris_differ = 0;
    int prefixes_differ = 0;

    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
    AXIS2_PARAM_CHECK(env->error, om_namespace, AXIS2_FAILURE);
    AXIS2_PARAM_CHECK(env->error, om_namespace1, AXIS2_FAILURE);

    if(!om_namespace || !om_namespace1)
    {
        return AXIS2_FALSE;
    }

    if(om_namespace->uri && om_namespace1->uri)
    {
        uris_differ = axutil_strcmp(axutil_string_get_buffer(om_namespace->uri, env),
            axutil_string_get_buffer(om_namespace1->uri, env));
    }
    else
    {
        uris_differ = (om_namespace->uri || om_namespace1->uri);
    }

    if(om_namespace->prefix && om_namespace1->prefix)
    {
        prefixes_differ = axutil_strcmp(axutil_string_get_buffer(om_namespace->prefix, env),
            axutil_string_get_buffer(om_namespace1->prefix, env));
    }
    else
    {
        prefixes_differ = (om_namespace->prefix || om_namespace1->prefix);
    }

    return (!uris_differ && !prefixes_differ);
}
예제 #15
0
파일: om_text.c 프로젝트: Denisss025/wsfcpp
AXIS2_EXTERN const axis2_char_t *AXIS2_CALL
axiom_text_get_value(
    axiom_text_t * om_text,
    const axutil_env_t * env)
{
    AXIS2_ENV_CHECK(env, NULL);
    AXIS2_PARAM_CHECK(env->error, om_text, NULL);
    if(om_text->value)
    {
        return axutil_string_get_buffer(om_text->value, env);
    }
    return NULL;
}
예제 #16
0
파일: phase.c 프로젝트: Denisss025/wsfcpp
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_add_handler_at(
    axis2_phase_t * phase,
    const axutil_env_t * env,
    const int idx,
    axis2_handler_t * handler)
{
    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
        "axis2_handler_t *%s added to the index %d of the phase %s", axutil_string_get_buffer(
            axis2_handler_get_name(handler, env), env), idx, phase->name);

    return axutil_array_list_add_at(phase->handlers, env, idx, handler);
}
예제 #17
0
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
axiom_attribute_get_value(
    axiom_attribute_t * attribute,
    const axutil_env_t * env)
{
    AXIS2_ENV_CHECK(env, NULL);
    AXIS2_PARAM_CHECK(env->error, attribute, NULL);
    if(attribute->value)
    {
        return (axis2_char_t *)axutil_string_get_buffer(attribute->value, env);
    }
    return NULL;
}
        /**
         * auto generated function definition signature
         * for "getAllRolesNames|http://service.mgt.user.carbon.wso2.org" operation.
         * @param env environment ( mandatory)* @param MessageContext the outmessage context
         *
         * @return adb_getAllRolesNamesResponse_t*
         */
        adb_getAllRolesNamesResponse_t* axis2_skel_UserManagementService_getAllRolesNames(const axutil_env_t *env , axis2_msg_ctx_t *msg_ctx,
                                          axis2_skel_UserManagementService_getAllRolesNames_fault *fault )
        {
			adb_getAllRolesNamesResponse_t* response = NULL;
			axis2_char_t* roles = NULL;

			/* Fetch roles */
			roles = axutil_string_get_buffer(axutil_string_create(env, "admin"), env);

			/* Create response */
			response = adb_getAllRolesNamesResponse_create(env);

			adb_getAllRolesNamesResponse_add_return(response, env, roles);
			return response;
        }
예제 #19
0
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_handler_desc_add_param(
    axis2_handler_desc_t * handler_desc,
    const axutil_env_t * env,
    axutil_param_t * param)
{
    const axutil_string_t *str_name = axis2_handler_desc_get_name(handler_desc, env);
    const axis2_char_t *name = axutil_string_get_buffer(str_name, env);
    axis2_char_t *param_name = axutil_param_get_name(param, env);
    if(axutil_param_container_is_param_locked(handler_desc->parent, env, param_name))
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_PARAMETER_LOCKED_CANNOT_OVERRIDE, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Parameter %s is locked for handler %s",
            param_name, name);
        return AXIS2_FAILURE;
    }

    return axutil_param_container_add_param(handler_desc->param_container, env, param);
}
예제 #20
0
파일: phase.c 프로젝트: Denisss025/wsfcpp
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
_axis2_phase_is_valid_before(
    axis2_phase_t * phase,
    const axutil_env_t * env,
    axis2_handler_t * handler)
{
    axis2_phase_rule_t *rules = NULL;
    axis2_handler_desc_t *handler_desc = NULL;
    const axis2_char_t *first_handler_name = NULL, *before = NULL;

    if(phase->first_handler)
    {
        handler_desc = axis2_handler_get_handler_desc(phase->first_handler, env);
        if(!handler_desc)
            return AXIS2_TRUE;

        first_handler_name = axutil_string_get_buffer(
            axis2_handler_desc_get_name(handler_desc, env), env);

        if(!first_handler_name)
            return AXIS2_TRUE;

        handler_desc = axis2_handler_get_handler_desc(handler, env);
        if(!handler_desc)
            return AXIS2_TRUE;

        rules = axis2_handler_desc_get_rules(handler_desc, env);
        if(!rules)
            return AXIS2_TRUE;

        before = axis2_phase_rule_get_before(rules, env);
        if(!before)
            return AXIS2_TRUE;

        if(!axutil_strcmp(first_handler_name, before))
            return AXIS2_FALSE;
        else
            return AXIS2_TRUE;

    }
    return AXIS2_TRUE;
}
예제 #21
0
파일: phase.c 프로젝트: Denisss025/wsfcpp
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
_axis2_phase_is_valid_after(
    axis2_phase_t * phase,
    const axutil_env_t * env,
    axis2_handler_t * handler)
{
    axis2_phase_rule_t *rules = NULL;
    axis2_handler_desc_t *handler_desc = NULL;
    const axis2_char_t *last_handler_name = NULL, *after = NULL;

    if(phase->last_handler)
    {
        handler_desc = axis2_handler_get_handler_desc(phase->last_handler, env);
        if(!handler_desc)
            return AXIS2_TRUE;

        last_handler_name = axutil_string_get_buffer(
            axis2_handler_desc_get_name(handler_desc, env), env);

        if(!last_handler_name)
            return AXIS2_TRUE;

        handler_desc = axis2_handler_get_handler_desc(handler, env);
        if(!handler_desc)
            return AXIS2_TRUE;

        rules = axis2_handler_desc_get_rules(handler_desc, env);
        if(!rules)
            return AXIS2_TRUE;

        after = axis2_phase_rule_get_after(rules, env);
        if(!after)
            return AXIS2_TRUE;

        if(!axutil_strcmp(last_handler_name, after))
            return AXIS2_FALSE;
        else
            return AXIS2_TRUE;

    }
    return AXIS2_TRUE;
}
예제 #22
0
파일: phase.c 프로젝트: Denisss025/wsfcpp
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_remove_handler_desc(
    axis2_phase_t * phase,
    const axutil_env_t * env,
    axis2_handler_desc_t * handler_desc)
{
    axis2_handler_t *handler;
    const axis2_char_t *handler_desc_name = axutil_string_get_buffer(axis2_handler_desc_get_name(
        handler_desc, env), env);
    handler = axis2_handler_desc_get_handler(handler_desc, env);
    if(!handler)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Handler is not set in the Handler Description %s within phase %s", handler_desc_name,
            phase->name);
        return AXIS2_FAILURE;
    }
    return axis2_phase_remove_unique(env, phase->handlers, handler);
}
예제 #23
0
파일: phase.c 프로젝트: Denisss025/wsfcpp
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_invoke_start_from_handler(
    axis2_phase_t * phase,
    const axutil_env_t * env,
    const int paused_handler_index,
    axis2_msg_ctx_t * msg_ctx)
{
    int i = 0, size = 0;
    axis2_status_t status = AXIS2_SUCCESS;

    axis2_msg_ctx_set_paused_phase_name(msg_ctx, env, phase->name);

    size = axutil_array_list_size(phase->handlers, env);
    for(i = paused_handler_index; i < size; i++)
    {
        axis2_handler_t *handler =
            (axis2_handler_t *)axutil_array_list_get(phase->handlers, env, i);
        if(handler)
        {
            const axis2_char_t *handler_name = axutil_string_get_buffer(axis2_handler_get_name(
                handler, env), env);
            int idx = -1;

            axis2_handler_desc_t *handler_desc = axis2_handler_get_handler_desc(handler, env);
            if(!handler_desc)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                    "Invalid Handler State for the handler %s within phase %s", handler_name,
                    phase->name);
                return AXIS2_FAILURE;
            }

            axis2_handler_invoke(handler, env, msg_ctx);
            idx = axis2_msg_ctx_get_current_handler_index(msg_ctx, env);
            axis2_msg_ctx_set_current_handler_index(msg_ctx, env, (idx + 1));
        }
    }
    return status;
}
예제 #24
0
파일: om_text.c 프로젝트: Denisss025/wsfcpp
AXIS2_EXTERN const axis2_char_t *AXIS2_CALL
axiom_text_get_text(
    axiom_text_t * om_text,
    const axutil_env_t * env)
{
    AXIS2_ENV_CHECK(env, NULL);
    AXIS2_PARAM_CHECK(env->error, om_text, NULL);
    if(om_text->value)
    {
        return axutil_string_get_buffer(om_text->value, env);
    }
    else
    {
        axis2_char_t *data_handler_stream = NULL;
        size_t data_handler_stream_size = 0;
        if(om_text->data_handler)
        {
            size_t encoded_len = 0;
            axis2_char_t *encoded_str = NULL;
            axiom_data_handler_read_from(om_text->data_handler, env, &data_handler_stream,
                &data_handler_stream_size);
            if(data_handler_stream)
            {
                encoded_len = (size_t)axutil_base64_encode_len((int)data_handler_stream_size);
                encoded_str = AXIS2_MALLOC(env->allocator, encoded_len + 2);
                if(encoded_str)
                {
                    encoded_len = (size_t)axutil_base64_encode(encoded_str, data_handler_stream,
                        (int)data_handler_stream_size);
                    encoded_str[encoded_len] = '\0';
                    return encoded_str;
                }
            }
        }
    }
    return NULL;
}
예제 #25
0
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axiom_attribute_serialize(
    axiom_attribute_t * attribute,
    const axutil_env_t * env,
    axiom_output_t * om_output)
{
    int status = AXIS2_SUCCESS;

    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
    AXIS2_PARAM_CHECK(env->error, om_output, AXIS2_FAILURE);

    if(attribute->ns)
    {
        axis2_char_t *uri = NULL;
        axis2_char_t *prefix = NULL;

        uri = axiom_namespace_get_uri(attribute->ns, env);
        prefix = axiom_namespace_get_prefix(attribute->ns, env);

        if((uri) && (NULL != prefix) && (axutil_strcmp(prefix, "") != 0))
        {
            status = axiom_output_write(om_output, env, AXIOM_ATTRIBUTE, 4,
                axutil_string_get_buffer(attribute-> localname, env), axutil_string_get_buffer(
                    attribute-> value, env), uri, prefix);
        }
        else if(uri)
        {
            status = axiom_output_write(om_output, env, AXIOM_ATTRIBUTE, 3,
                axutil_string_get_buffer(attribute-> localname, env), axutil_string_get_buffer(
                    attribute-> value, env), uri);
        }
    }
    else
    {
        status = axiom_output_write(om_output, env, AXIOM_ATTRIBUTE, 2, axutil_string_get_buffer(
            attribute-> localname, env), axutil_string_get_buffer(attribute->value, env));
    }
    return status;
}
예제 #26
0
파일: phase.c 프로젝트: Denisss025/wsfcpp
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_insert_before(
    axis2_phase_t * phase,
    const axutil_env_t * env,
    axis2_handler_t * handler)
{
    axis2_phase_rule_t *rules = NULL;
    axis2_handler_desc_t *handler_desc = NULL;
    const axis2_char_t *handler_name = NULL, *before = NULL;
    int i = 0;
    int size = 0;
    const axis2_char_t *name = axutil_string_get_buffer(axis2_handler_get_name(handler, env), env);
    const axis2_char_t *handler_desc_name = NULL;

    handler_desc = axis2_handler_get_handler_desc(handler, env);
    if(!handler_desc)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Handler description is not set in the handler %s within phase %s", name, phase->name);
        return AXIS2_FAILURE;
    }
    handler_desc_name = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env),
        env);

    rules = axis2_handler_desc_get_rules(handler_desc, env);
    if(!rules)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Handler rules are not set in the handler description %s within "
                "phase %s", handler_desc_name, phase->name);
        return AXIS2_FAILURE;
    }

    before = axis2_phase_rule_get_before(rules, env);
    if(!before)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Rule `before` is not set in the handler rules for handler %s "
                "within phase %s", name, phase->name);
        return AXIS2_FAILURE;
    }

    if(phase->last_handler)
    {
        const axis2_char_t *last_handler_name = axutil_string_get_buffer(axis2_handler_get_name(
            phase->last_handler, env), env);
        handler_desc = axis2_handler_get_handler_desc(phase->last_handler, env);
        if(!handler_desc)
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                "Handler description is not set in the last handler %s of "
                    "phase %s", last_handler_name, phase->name);
            return AXIS2_FAILURE;
        }

        handler_name
            = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env), env);
        if(!handler_name)
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                "Handler name is not set in the handler description for "
                    "last handler %s within phase %s", last_handler_name, phase->name);
            return AXIS2_FAILURE;
        }

        if(!axutil_strcmp(before, handler_name))
        {
            /*return axutil_array_list_add(phase->handlers, env, handler); */
            return axis2_phase_add_unique(env, phase->handlers, handler);
        }
    }

    size = axutil_array_list_size(phase->handlers, env);

    for(i = 0; i < size; i++)
    {
        axis2_handler_t *temp_handler = (axis2_handler_t *)axutil_array_list_get(phase->handlers,
            env, i);
        if(temp_handler)
        {
            const axis2_char_t *temp_handler_name = axutil_string_get_buffer(
                axis2_handler_get_name(temp_handler, env), env);
            handler_desc = axis2_handler_get_handler_desc(temp_handler, env);
            if(!handler_desc)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                    "Handler Description is not set for the Handler %s "
                        "within phase %s", temp_handler_name, phase->name);
                return AXIS2_FAILURE;
            }

            handler_name = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env),
                env);
            if(!handler_name)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                    "Handler name is not set in the handler description for "
                        "handler %s within phase %s", temp_handler_name, phase->name);
                return AXIS2_FAILURE;
            }

            if(!axutil_strcmp(before, handler_name))
            {
                return axutil_array_list_add_at(phase->handlers, env, i, handler);
            }
        }
    }
    /* add as the last handler */
    /* return axutil_array_list_add(phase->handlers, env, handler); */
    return axis2_phase_add_unique(env, phase->handlers, handler);
}
예제 #27
0
파일: om_text.c 프로젝트: Denisss025/wsfcpp
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axiom_text_serialize(
    axiom_text_t * om_text,
    const axutil_env_t * env,
    axiom_output_t * om_output)
{
    int status = AXIS2_SUCCESS;
    axis2_char_t *attribute_value = NULL;
    const axis2_char_t *text = NULL;
    axiom_xml_writer_t *om_output_xml_writer = NULL;

    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
    AXIS2_PARAM_CHECK(env->error, om_output, AXIS2_FAILURE);

    if(!axiom_text_get_is_binary(om_text, env))
    {
        if(om_text->value)
        {
            status = axiom_output_write(om_output, env, AXIOM_TEXT, 1, axutil_string_get_buffer(
                om_text->value, env));
        }
    }
    else
    {
        om_output_xml_writer = axiom_output_get_xml_writer(om_output, env);
        if(axiom_output_is_optimized(om_output, env) && om_text->optimize)
        {
            if(!(axiom_text_get_content_id(om_text, env)))
            {
                axis2_char_t *content_id = axiom_output_get_next_content_id(om_output, env);
                if(content_id)
                {
                    om_text->content_id = axutil_strdup(env, content_id);
                }
            }

            attribute_value = axutil_stracat(env, "cid:", om_text->content_id);

            /*send binary as MTOM optimised */
            if(om_text->om_attribute)
            {
                axiom_attribute_free(om_text->om_attribute, env);
                om_text->om_attribute = NULL;
            }

            om_text->om_attribute = axiom_attribute_create(env, "href", attribute_value, NULL);

            AXIS2_FREE(env->allocator, attribute_value);
            attribute_value = NULL;

            if(!om_text->is_swa) /* This is a hack to get SwA working */
            {
                axiom_text_serialize_start_part(om_text, env, om_output);
            }
            else
            {
                status = axiom_output_write(om_output, env, AXIOM_TEXT, 1, om_text->content_id);
            }

            axiom_output_write_optimized(om_output, env, om_text);

            axiom_output_write(om_output, env, AXIOM_ELEMENT, 0);
        }
        else
        {
            text = axiom_text_get_text(om_text, env);
            axiom_xml_writer_write_characters(om_output_xml_writer, env, (axis2_char_t *)text);
        }
    }
    return status;
}
예제 #28
0
파일: phase.c 프로젝트: Denisss025/wsfcpp
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_insert_after(
    axis2_phase_t * phase,
    const axutil_env_t * env,
    axis2_handler_t * handler)
{
    axis2_phase_rule_t *rules = NULL;
    axis2_handler_desc_t *handler_desc = NULL;
    const axis2_char_t *handler_name = NULL;
    const axis2_char_t *after = NULL;
    int i = 0;
    int size = 0;
    const axis2_char_t *name = axutil_string_get_buffer(axis2_handler_get_name(handler, env), env);
    const axis2_char_t *handler_desc_name = NULL;

    handler_desc = axis2_handler_get_handler_desc(handler, env);
    if(!handler_desc)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Handler description is not set in the handler %s within phase %s", name, phase->name);
        return AXIS2_FAILURE;
    }
    handler_desc_name = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env),
        env);
    rules = axis2_handler_desc_get_rules(handler_desc, env);
    if(!rules)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Handler rules are not set in the handler description %s within "
                "phase %s", handler_desc_name, phase->name);
        return AXIS2_FAILURE;
    }

    after = axis2_phase_rule_get_after(rules, env);
    if(!after)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Rule `after` is not set in the handler rules for handler desc "
                "%s within phase %s", handler_desc_name, phase->name);
        return AXIS2_FAILURE;
    }

    if(phase->first_handler)
    {
        const axis2_char_t *first_handler_name = axutil_string_get_buffer(axis2_handler_get_name(
            phase->first_handler, env), env);
        handler_desc = axis2_handler_get_handler_desc(phase->first_handler, env);
        if(!handler_desc)
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                "Handler description is not set in the first handler %s "
                    "within phase %s", first_handler_name, phase->name);
            return AXIS2_FAILURE;
        }

        handler_name
            = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env), env);
        if(!handler_name)
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                "Handler name is not set in the handler description for "
                    "handler %s within phase %s", name, phase->name);
            return AXIS2_FAILURE;
        }

        if(!axutil_strcmp(after, handler_name))
        {
            return axutil_array_list_add_at(phase->handlers, env, 0, handler);
        }
    }

    size = axutil_array_list_size(phase->handlers, env);

    for(i = 0; i < size; i++)
    {
        axis2_handler_t *temp_handler = (axis2_handler_t *)axutil_array_list_get(phase->handlers,
            env, i);
        if(temp_handler)
        {
            const axis2_char_t *temp_handler_name = axutil_string_get_buffer(
                axis2_handler_get_name(temp_handler, env), env);
            handler_desc = axis2_handler_get_handler_desc(temp_handler, env);
            if(!handler_desc)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                    "Handler description is not set in the handler %s within"
                        " phase %s", temp_handler_name, phase->name);
                return AXIS2_FAILURE;
            }

            handler_name = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env),
                env);
            if(!handler_name)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                    "Handler name is not set in the handler description %s "
                        "within phase %s", temp_handler_name, phase->name);
                return AXIS2_FAILURE;
            }

            if(!axutil_strcmp(after, handler_name))
            {
                if(i == (size - 1))
                {
                    return axis2_phase_add_unique(env, phase->handlers, handler);
                }
                else
                    return axutil_array_list_add_at(phase->handlers, env, i + 1, handler);
            }
        }
    }

    if(size > 0)
        return axutil_array_list_add_at(phase->handlers, env, 0, handler);
    else
    {
        return axis2_phase_add_unique(env, phase->handlers, handler);
    }
}
예제 #29
0
파일: phase.c 프로젝트: Denisss025/wsfcpp
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_phase_insert_before_and_after(
    axis2_phase_t * phase,
    const axutil_env_t * env,
    axis2_handler_t * handler)
{
    int before = -1;
    int after = -1;
    axis2_phase_rule_t *rules = NULL;
    axis2_handler_desc_t *handler_desc = NULL;
    const axis2_char_t *before_handler_name = NULL, *after_handler_name = NULL, *after_name = NULL,
        *before_name = NULL, *handler_name = NULL;
    int i = 0;
    int size = 0;
    const axis2_char_t *name = axutil_string_get_buffer(axis2_handler_get_name(handler, env), env);
    const axis2_char_t *handler_desc_name = NULL;

    handler_desc = axis2_handler_get_handler_desc(handler, env);
    if(!handler_desc)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Handler description is not set in the handler %s within phase %s", name, phase->name);
        return AXIS2_FAILURE;
    }
    handler_desc_name = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env),
        env);

    rules = axis2_handler_desc_get_rules(handler_desc, env);
    if(!rules)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Handler rules are not set in the handler description %s within "
                "phase %s", handler_desc_name, phase->name);
        return AXIS2_FAILURE;
    }

    before_name = axis2_phase_rule_get_before(rules, env);
    if(!before_name)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Rule `before` is not set in the handler rules for handler desc "
                "   %s within phase %s", handler_desc_name, phase->name);
        return AXIS2_FAILURE;
    }

    after_name = axis2_phase_rule_get_after(rules, env);
    if(!after_name)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Rule `after` is not set in the handler rules for handler desc "
                "%s within phase %s", handler_desc_name, phase->name);
        return AXIS2_FAILURE;
    }

    if(phase->first_handler)
    {
        const axis2_char_t *first_handler_name = axutil_string_get_buffer(axis2_handler_get_name(
            phase->first_handler, env), env);
        handler_desc = axis2_handler_get_handler_desc(phase->first_handler, env);
        if(!handler_desc)
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                "Handler description is not set in the first handler %s "
                    "within phase %s", first_handler_name, phase->name);
            return AXIS2_FAILURE;
        }

        before_handler_name = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc,
            env), env);
        if(!before_handler_name)
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                "Handler name is not set in the handler description for the "
                    "first handler %s within phase %s", first_handler_name, phase->name);
            return AXIS2_FAILURE;
        }
    }

    if(phase->last_handler)
    {
        const axis2_char_t *last_handler_name = axutil_string_get_buffer(axis2_handler_get_name(
            phase->last_handler, env), env);
        handler_desc = axis2_handler_get_handler_desc(phase->last_handler, env);
        if(!handler_desc)
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                "Handler description is not set in the last handler %s "
                    "within phase %s", last_handler_name, phase->name);
            return AXIS2_FAILURE;
        }

        after_handler_name = axutil_string_get_buffer(
            axis2_handler_desc_get_name(handler_desc, env), env);
        if(!after_handler_name)
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                "Handler name is not set in the handler description for the "
                    "last handler %s within phase %s", last_handler_name, phase->name);
            return AXIS2_FAILURE;
        }
    }

    if(before_handler_name && after_handler_name)
    {
        if(!axutil_strcmp(before_handler_name, before_name) && !axutil_strcmp(after_handler_name,
            after_name))
        {
            return axis2_phase_add_unique(env, phase->handlers, handler);
        }
    }

    if(after_handler_name)
    {
        if(!axutil_strcmp(after_handler_name, after_name))
            after = 0;
    }

    size = axutil_array_list_size(phase->handlers, env);

    if(after_handler_name)
    {
        if(!axutil_strcmp(before_handler_name, before_name))
            before = size;
    }

    for(i = 0; i < size; i++)
    {
        axis2_handler_t *temp_handler = (axis2_handler_t *)axutil_array_list_get(phase->handlers,
            env, i);
        if(temp_handler)
        {
            const axis2_char_t *temp_handler_name = axutil_string_get_buffer(
                axis2_handler_get_name(temp_handler, env), env);
            handler_desc = axis2_handler_get_handler_desc(temp_handler, env);
            if(!handler_desc)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                    "Handler Description is not set for the Handler %s "
                        "within phase %s", temp_handler_name, phase->name);
                return AXIS2_FAILURE;
            }

            handler_name = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env),
                env);
            if(!handler_name)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                    "Handler name is not set in the handler Description for "
                        "handler %s within phase %s", temp_handler_name, phase->name);
                return AXIS2_FAILURE;
            }

            if(!axutil_strcmp(handler_name, after_name))
                after = i;
            if(!axutil_strcmp(handler_name, before_name))
                before = i;
        }

        if((after >= 0) && (before >= 0))
        {
            /*both the before and after indexes have been found */
            if(after > before)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                    "Both the before and after indexes have been found and "
                        "`after` comes before `before` which is wrong within "
                        "phase %s", phase->name);
                return AXIS2_FAILURE;
            }
            else
            {
                if(after + 1 < size)
                {
                    return axutil_array_list_add_at(phase->handlers, env, after + 1, handler);
                }
                else
                {
                    return axis2_phase_add_unique(env, phase->handlers, handler);
                }
            }
        }
    }
    return axis2_phase_add_unique(env, phase->handlers, handler);
}
예제 #30
0
axis2_status_t AXIS2_CALL
axis2_libcurl_send(
    axis2_libcurl_t *data,
    axiom_output_t * om_output,
    const axutil_env_t * env,
    axis2_msg_ctx_t * msg_ctx,
    axiom_soap_envelope_t * out,
    const axis2_char_t * str_url,
    const axis2_char_t * soap_action)
{
    struct curl_slist *headers = NULL;
    axiom_soap_body_t *soap_body;
    axis2_bool_t is_soap = AXIS2_TRUE;
    axis2_bool_t send_via_get = AXIS2_FALSE;
    axis2_bool_t send_via_head = AXIS2_FALSE;
    axis2_bool_t send_via_put = AXIS2_FALSE;
    axis2_bool_t send_via_delete = AXIS2_FALSE;
    axis2_bool_t doing_mtom = AXIS2_FALSE;
    axiom_node_t *body_node = NULL;
    axiom_node_t *data_out = NULL;
    axutil_property_t *method = NULL;
    axis2_char_t *method_value = NULL;
    axiom_xml_writer_t *xml_writer = NULL;
    axis2_char_t *buffer = NULL;
    unsigned int buffer_size = 0;
    int content_length = -1;
    axis2_char_t *content_type = NULL;
    /*axis2_char_t *content_len = AXIS2_HTTP_HEADER_CONTENT_LENGTH_; */
    const axis2_char_t *char_set_enc = NULL;
    axis2_char_t *content = AXIS2_HTTP_HEADER_CONTENT_TYPE_;
    axis2_char_t *soap_action_header = AXIS2_HTTP_HEADER_SOAP_ACTION_;
    axutil_stream_t *in_stream;
    axutil_property_t *trans_in_property;
    axutil_string_t *char_set_enc_str;
    axis2_byte_t *output_stream = NULL;
    int output_stream_size = 0;
    CURL *handler;
    axis2_conf_ctx_t *conf_ctx = NULL;
    axis2_conf_t *conf = NULL;
    axis2_transport_out_desc_t *trans_desc = NULL;
    axutil_param_t *write_xml_declaration_param = NULL;
    axutil_hash_t *transport_attrs = NULL;
    axis2_bool_t write_xml_declaration = AXIS2_FALSE;
    axutil_property_t *property;
    int *response_length = NULL;
    axis2_http_status_line_t *status_line = NULL;
    axis2_char_t *status_line_str = NULL;
    axis2_char_t *tmp_strcat = NULL;
    int status_code = 0;

    AXIS2_PARAM_CHECK(env->error, data, AXIS2_FAILURE);
    AXIS2_PARAM_CHECK(env->error, data->handler, AXIS2_FAILURE);

    handler = data->handler;
    curl_easy_reset(handler);
    curl_easy_setopt(handler, CURLOPT_ERRORBUFFER, data->errorbuffer);
    headers = curl_slist_append(headers, AXIS2_HTTP_HEADER_USER_AGENT_AXIS2C);
    headers = curl_slist_append(headers, AXIS2_HTTP_HEADER_ACCEPT_);
    headers = curl_slist_append(headers, AXIS2_HTTP_HEADER_EXPECT_);

    if(AXIS2_FAILURE == axis2_libcurl_set_options(handler, env, msg_ctx))
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[axis2libcurl]Setting options in Libcurl failed");
        return AXIS2_FAILURE;
    }

    if (AXIS2_TRUE == axis2_msg_ctx_get_doing_rest(msg_ctx, env))
    {
        is_soap = AXIS2_FALSE;
    }
    else
    {
        is_soap = AXIS2_TRUE;
    }

    if (!is_soap)
    {
        soap_body = axiom_soap_envelope_get_body(out, env);
        if (!soap_body)
        {
            AXIS2_HANDLE_ERROR(env,
                AXIS2_ERROR_SOAP_ENVELOPE_OR_SOAP_BODY_NULL,
                AXIS2_FAILURE);
            return AXIS2_FAILURE;
        }

        body_node = axiom_soap_body_get_base_node(soap_body, env);
        if (!body_node)
        {
            AXIS2_HANDLE_ERROR(env,
                AXIS2_ERROR_SOAP_ENVELOPE_OR_SOAP_BODY_NULL,
                AXIS2_FAILURE);

            return AXIS2_FAILURE;
        }
        data_out = axiom_node_get_first_element(body_node, env);

        method = (axutil_property_t *) axis2_msg_ctx_get_property(msg_ctx, env,
            AXIS2_HTTP_METHOD);

        if (method)
        {
            method_value =
            (axis2_char_t *) axutil_property_get_value(method, env);
        }

        /* The default is POST */
        if (method_value && 0 == axutil_strcmp(method_value, AXIS2_HTTP_GET))
        {
            send_via_get = AXIS2_TRUE;
        }
        else if (method_value && 0 == axutil_strcmp(method_value, AXIS2_HTTP_HEAD))
        {
            send_via_head = AXIS2_TRUE;
        }
        else if (method_value && 0 == axutil_strcmp(method_value, AXIS2_HTTP_PUT))
        {
            send_via_put = AXIS2_TRUE;
        }
        else if (method_value && 0 == axutil_strcmp(method_value, AXIS2_HTTP_DELETE))
        {
            send_via_delete = AXIS2_TRUE;
        }
    }

    conf_ctx = axis2_msg_ctx_get_conf_ctx (msg_ctx, env);
    if (conf_ctx)
    {
        conf = axis2_conf_ctx_get_conf (conf_ctx, env);
    }

    if (conf)
    {
        trans_desc = axis2_conf_get_transport_out (conf,
            env, AXIS2_TRANSPORT_ENUM_HTTP);
    }

    if (trans_desc)
    {
        write_xml_declaration_param =
        axutil_param_container_get_param
        (axis2_transport_out_desc_param_container (trans_desc, env), env,
            AXIS2_XML_DECLARATION);
    }

    if (write_xml_declaration_param)
    {
        transport_attrs =
        axutil_param_get_attributes (write_xml_declaration_param, env);
        if (transport_attrs)
        {
            axutil_generic_obj_t *obj = NULL;
            axiom_attribute_t *write_xml_declaration_attr = NULL;
            axis2_char_t *write_xml_declaration_attr_value = NULL;

            obj = axutil_hash_get (transport_attrs, AXIS2_ADD_XML_DECLARATION,
                AXIS2_HASH_KEY_STRING);
            if (obj)
            {
                write_xml_declaration_attr = (axiom_attribute_t *)
                axutil_generic_obj_get_value (obj,
                    env);
            }
            if (write_xml_declaration_attr)
            {
                write_xml_declaration_attr_value =
                axiom_attribute_get_value (write_xml_declaration_attr, env);
            }
            if (write_xml_declaration_attr_value &&
                0 == axutil_strcasecmp (write_xml_declaration_attr_value,
                    AXIS2_VALUE_TRUE))
            {
                write_xml_declaration = AXIS2_TRUE;
            }
        }
    }

    if (write_xml_declaration)
    {
        axiom_output_write_xml_version_encoding (om_output, env);
    }

    if (!send_via_get && !send_via_head && !send_via_delete)
    {
        xml_writer = axiom_output_get_xml_writer(om_output, env);

        char_set_enc_str = axis2_msg_ctx_get_charset_encoding(msg_ctx, env);

        if (!char_set_enc_str)
        {
            char_set_enc = AXIS2_DEFAULT_CHAR_SET_ENCODING;
        }
        else
        {
            char_set_enc = axutil_string_get_buffer(char_set_enc_str, env);
        }

        if (!send_via_put && is_soap)
        {
            doing_mtom = axis2_msg_ctx_get_doing_mtom(msg_ctx, env);

            axiom_output_set_do_optimize(om_output, env, doing_mtom);
            axiom_soap_envelope_serialize(out, env, om_output, AXIS2_FALSE);
            if (AXIS2_TRUE == axis2_msg_ctx_get_is_soap_11(msg_ctx, env))
            {
                if (AXIS2_ESC_DOUBLE_QUOTE != *soap_action)
                {
                    axis2_char_t *tmp_soap_action = NULL;
                    tmp_soap_action =
                    AXIS2_MALLOC(env->allocator,
                        (axutil_strlen(soap_action) +
                            5) * sizeof(axis2_char_t));
                    sprintf(tmp_soap_action, "\"%s\"", soap_action);
                    tmp_strcat = axutil_stracat(env, soap_action_header,tmp_soap_action);
                    headers = curl_slist_append(headers, tmp_strcat);
                    AXIS2_FREE(env->allocator, tmp_strcat);
                    AXIS2_FREE(env->allocator, tmp_soap_action);
                }
                else
                {
                    tmp_strcat = axutil_stracat(env, soap_action_header, soap_action);
                    headers = curl_slist_append(headers, tmp_strcat );
                    AXIS2_FREE(env->allocator, tmp_strcat);
                }
            }

            if (doing_mtom)
            {
                /*axiom_output_flush(om_output, env, &output_stream,
                 &output_stream_size);*/
                axiom_output_flush(om_output, env);
                content_type =
                (axis2_char_t *) axiom_output_get_content_type(om_output,
                    env);
                if (AXIS2_TRUE != axis2_msg_ctx_get_is_soap_11(msg_ctx, env))
                {
                    if (axutil_strcmp(soap_action, ""))
                    {
                        /* handle SOAP action for SOAP 1.2 case */
                        axis2_char_t *temp_content_type = NULL;
                        temp_content_type = axutil_stracat (env,
                            content_type,
                            AXIS2_CONTENT_TYPE_ACTION);
                        content_type = temp_content_type;
                        temp_content_type = axutil_stracat (env,
                            content_type,
                            soap_action);
                        AXIS2_FREE (env->allocator, content_type);
                        content_type = temp_content_type;
                        temp_content_type =
                        axutil_stracat (env, content_type,
                            AXIS2_ESC_DOUBLE_QUOTE_STR);
                        AXIS2_FREE (env->allocator, content_type);
                        content_type = temp_content_type;
                    }
                }
            }
            else if (AXIS2_TRUE == axis2_msg_ctx_get_is_soap_11(msg_ctx, env))
            {
                axis2_char_t *temp_content_type = NULL;
                content_type =
                (axis2_char_t *) AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML;
                content_type = axutil_stracat(env, content_type,
                    AXIS2_CONTENT_TYPE_CHARSET);
                temp_content_type =
                axutil_stracat(env, content_type, char_set_enc);
                AXIS2_FREE(env->allocator, content_type);
                content_type = temp_content_type;
            }
            else
            {
                axis2_char_t *temp_content_type = NULL;
                content_type =
                (axis2_char_t *) AXIS2_HTTP_HEADER_ACCEPT_APPL_SOAP;
                content_type = axutil_stracat(env, content_type,
                    AXIS2_CONTENT_TYPE_CHARSET);
                temp_content_type =
                axutil_stracat(env, content_type, char_set_enc);
                AXIS2_FREE(env->allocator, content_type);
                content_type = temp_content_type;
                if (axutil_strcmp(soap_action, ""))
                {
                    temp_content_type =
                    axutil_stracat(env, content_type,
                        AXIS2_CONTENT_TYPE_ACTION);
                    AXIS2_FREE(env->allocator, content_type);
                    content_type = temp_content_type;
                    temp_content_type =
                    axutil_stracat(env, content_type, soap_action);
                    AXIS2_FREE(env->allocator, content_type);
                    content_type = temp_content_type;
                }
                temp_content_type = axutil_stracat(env, content_type,
                    AXIS2_SEMI_COLON_STR);
                AXIS2_FREE(env->allocator, content_type);
                content_type = temp_content_type;
            }
        }
        else if (is_soap)
        {
            AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "Attempt to send SOAP"
                "message using HTTP PUT failed");
            return AXIS2_FAILURE;
        }
        else
        {
            axutil_property_t *content_type_property = NULL;
            axutil_hash_t *content_type_hash = NULL;
            axis2_char_t *content_type_value = NULL;

            axiom_node_serialize(data_out, env, om_output);
            content_type_property =
            (axutil_property_t *)
            axis2_msg_ctx_get_property(msg_ctx, env,
                AXIS2_USER_DEFINED_HTTP_HEADER_CONTENT_TYPE);

            if (content_type_property)
            {
                content_type_hash =
                (axutil_hash_t *)
                axutil_property_get_value(content_type_property, env);

                if (content_type_hash)
                {
                    content_type_value =
                    (char *) axutil_hash_get(content_type_hash,
                        AXIS2_HTTP_HEADER_CONTENT_TYPE,
                        AXIS2_HASH_KEY_STRING);
                }
            }

            if (content_type_value)
            {
                content_type = content_type_value;
            }
            else
            {
                content_type = axutil_strdup(env,AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML);
            }

        }

        buffer = axiom_xml_writer_get_xml(xml_writer, env);
        if (!doing_mtom)
        {
            buffer_size = axiom_xml_writer_get_xml_size(xml_writer, env);
        }
        else
        buffer_size = output_stream_size;
        {
            /*
             * Curl calculates the content-length automatically.
             * This commented section is not only unnecessary,
             * it interferes with authentication.
             *
             * NTLM, for example, will send an empty request
             * first (no body) to get the auth challenge
             * before resending with actual content.
             */
            /*char tmp_buf[10];
            sprintf(tmp_buf, "%d", buffer_size);
            tmp_strcat = axutil_stracat(env, content_len, tmp_buf);
            headers = curl_slist_append(headers, tmp_strcat);
            AXIS2_FREE(env->allocator, tmp_strcat);
            tmp_strcat = NULL;*/

            tmp_strcat = axutil_stracat(env, content, content_type);
            headers = curl_slist_append(headers, tmp_strcat);
            AXIS2_FREE(env->allocator, tmp_strcat);
            tmp_strcat = NULL;
        }

        if (!doing_mtom)
        {
            curl_easy_setopt(handler, CURLOPT_POSTFIELDSIZE, buffer_size);
            curl_easy_setopt(handler, CURLOPT_POSTFIELDS, buffer);
        }
        else
        {
            curl_easy_setopt(handler, CURLOPT_POSTFIELDSIZE,
                output_stream_size);
            curl_easy_setopt(handler, CURLOPT_POSTFIELDS, output_stream);
        }

        if (send_via_put)
        {
            curl_easy_setopt(handler, CURLOPT_CUSTOMREQUEST, AXIS2_HTTP_PUT);
        }
        curl_easy_setopt(handler, CURLOPT_URL, str_url);
    }
    else
    {
        axis2_char_t *request_param;
        axis2_char_t *url_encode;
        request_param =
        (axis2_char_t *) axis2_http_sender_get_param_string(NULL, env,
            msg_ctx);
        url_encode = axutil_strcat(env, str_url, AXIS2_Q_MARK_STR,
            request_param, NULL);
        if (send_via_get)
        {
            curl_easy_setopt(handler, CURLOPT_HTTPGET, 1);
        }
        else if (send_via_head)
        {
            curl_easy_setopt(handler, CURLOPT_NOBODY, 1);
        }
        else if (send_via_delete)
        {
            curl_easy_setopt(handler, CURLOPT_CUSTOMREQUEST, AXIS2_HTTP_DELETE);
        }
        curl_easy_setopt(handler, CURLOPT_URL, url_encode);
    }

    {
        axis2_bool_t manage_session;
        manage_session = axis2_msg_ctx_get_manage_session(msg_ctx, env);
        if (manage_session == AXIS2_TRUE)
        {
            if (data->cookies == AXIS2_FALSE)
            {
                /* Ensure cookies enabled to manage session */
                /* Pass empty cookie string to enable cookies */
                curl_easy_setopt(handler, CURLOPT_COOKIEFILE, " ");
                data->cookies = AXIS2_TRUE;
            }
        }
        else if (data->cookies == AXIS2_TRUE)
        {
            /* Pass special string ALL to reset cookies if any have been enabled. */
            /* If cookies have ever been enabled, we reset every time as long as 
             manage_session is false, as there is no clear curl option to
             turn off the cookie engine once enabled. */
            curl_easy_setopt(handler, CURLOPT_COOKIELIST, AXIS2_ALL);
        }
    }

    curl_easy_setopt(handler, CURLOPT_HTTPHEADER, headers);
    curl_easy_setopt(handler, CURLOPT_WRITEFUNCTION,
        axis2_libcurl_write_memory_callback);
    curl_easy_setopt(handler, CURLOPT_WRITEDATA, data);

    curl_easy_setopt (handler, CURLOPT_HEADERFUNCTION, axis2_libcurl_header_callback);

    curl_easy_setopt (handler, CURLOPT_WRITEHEADER, data);

    /* Free response data from previous request */
    if( data->size )
    {
        if (data->memory)
        {
            AXIS2_FREE(data->env->allocator, data->memory);
        }
        data->size = 0;
    }

    if (curl_easy_perform(handler))
    {
        AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "%s", &data->errorbuffer);
        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_HTTP_CLIENT_TRANSPORT_ERROR,
            AXIS2_FAILURE);
        return AXIS2_FAILURE;
    }

    in_stream = axutil_stream_create_libcurl(env, data->memory, data->size);
    trans_in_property = axutil_property_create(env);
    axutil_property_set_scope(trans_in_property, env, AXIS2_SCOPE_REQUEST);
    axutil_property_set_free_func(trans_in_property, env,
        libcurl_stream_free);
    axutil_property_set_value(trans_in_property, env, in_stream);
    axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_TRANSPORT_IN,
        trans_in_property);

    if (axutil_array_list_size(data->alist, env) > 0)
    {
        status_line_str = axutil_array_list_get(data->alist, env, 0);
        if (status_line_str)
        {
            status_line = axis2_http_status_line_create(env, status_line_str);
        }
    }

    if (status_line)
    {
        status_code = axis2_http_status_line_get_status_code(status_line, env);
    }

    axis2_msg_ctx_set_status_code (msg_ctx, env, status_code);
    AXIS2_FREE(data->env->allocator, content_type);
    content_type = axis2_libcurl_get_content_type(data, env);

    if (content_type)
    {
        if (strstr (content_type, AXIS2_HTTP_HEADER_ACCEPT_MULTIPART_RELATED)
            && strstr (content_type, AXIS2_HTTP_HEADER_ACCEPT_XOP_XML))
        {
            axis2_ctx_t *axis_ctx =
            axis2_op_ctx_get_base (axis2_msg_ctx_get_op_ctx (msg_ctx, env),
                env);
            property = axutil_property_create (env);
            axutil_property_set_scope (property, env, AXIS2_SCOPE_REQUEST);
            axutil_property_set_value (property,
                env, axutil_strdup (env, content_type));
            axis2_ctx_set_property (axis_ctx,
                env, MTOM_RECIVED_CONTENT_TYPE, property);
        }
    }

    content_length = axis2_libcurl_get_content_length(data, env);
    if (content_length >= 0)
    {
        response_length = AXIS2_MALLOC (env->allocator, sizeof (int));
        memcpy (response_length, &content_length, sizeof (int));
        property = axutil_property_create (env);
        axutil_property_set_scope (property, env, AXIS2_SCOPE_REQUEST);
        axutil_property_set_value (property, env, response_length);
        axis2_msg_ctx_set_property (msg_ctx, env,
            AXIS2_HTTP_HEADER_CONTENT_LENGTH, property);
    }

    curl_slist_free_all (headers);
    /* release the read http headers. */
    /* (commenting out the call below is a clever way to force a premature EOF 
     condition in subsequent messages, as they will be read using the content-length
     of the first message.) */
    axis2_libcurl_free_headers(data, env);
    AXIS2_FREE(data->env->allocator, content_type);
    axis2_http_status_line_free( status_line, env);

    return AXIS2_SUCCESS;
}