Example #1
0
AXIS2_EXTERN const axis2_char_t *AXIS2_CALL
axis2_options_get_action(
    const axis2_options_t * options,
    const axutil_env_t * env)
{
    const axis2_char_t *action = NULL;
    action = axis2_msg_info_headers_get_action(options->msg_info_headers, env);

    if(!action && options->parent)
    {
        return axis2_options_get_action(options->parent, env);
    }

    return action;
}
Example #2
0
axis2_status_t AXIS2_CALL
axis2_addr_out_handler_invoke(
    struct axis2_handler * handler,
    const axutil_env_t * env,
    axis2_msg_ctx_t * msg_ctx)
{
    axis2_char_t *addr_ver_from_msg_ctx = NULL;
    const axis2_char_t *addr_ns = NULL;
    axis2_msg_info_headers_t *msg_info_headers = NULL;
    axis2_ctx_t *ctx = NULL;
    axiom_soap_envelope_t *soap_envelope = NULL;
    axiom_soap_header_t *soap_header = NULL;
    axiom_node_t *soap_header_node = NULL;
    axiom_element_t *soap_header_ele = NULL;
    axis2_endpoint_ref_t *epr_to = NULL;
    axis2_endpoint_ref_t *epr_reply_to = NULL;
    axis2_endpoint_ref_t *epr_from = NULL;
    axis2_endpoint_ref_t *epr_fault_to = NULL;
    axutil_property_t *property = NULL;
    const axis2_char_t *wsa_action = NULL;
	axis2_bool_t set_must_understand = AXIS2_FALSE;
	axutil_property_t *must_understand_prop;

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

    AXIS2_LOG_INFO(env->log, "Starting addressing out handler");

    soap_envelope = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
    if(!soap_envelope)
    {
        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "No SOAP envelope. Stop processing addressing");
        return AXIS2_SUCCESS; /* Can happen in case of ONE-WAY services/clients */
    }

    msg_info_headers = axis2_msg_ctx_get_msg_info_headers(msg_ctx, env);

    if(msg_info_headers)
    {
        wsa_action = axis2_msg_info_headers_get_action(msg_info_headers, env);
    }
    else
    {
        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "No addressing in use");
        return AXIS2_SUCCESS; /* No addressing in use */
    }

    if(!wsa_action || !*wsa_action)
    {
        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "No action present. Stop processing addressing");
        return AXIS2_SUCCESS; /* If no action present, assume no addressing in use */
    }


    ctx = axis2_msg_ctx_get_base(msg_ctx, env);
    property = axis2_ctx_get_property(ctx, env, AXIS2_WSA_VERSION);

    if(property)
    {
        addr_ver_from_msg_ctx = axutil_property_get_value(property, env);
        property = NULL;
    }

	must_understand_prop = axis2_msg_ctx_get_property(msg_ctx, env, AXIS2_ADDR_ADD_MUST_UNDERSTAND_TO_ADDR_HEADERS);
	if(must_understand_prop)
	{
		axis2_char_t *value = axutil_property_get_value(must_understand_prop, env);
		if(axutil_strcmp(value, AXIS2_VALUE_TRUE) == 0)
			set_must_understand = AXIS2_TRUE;
	}

    /* Setting version 1.0 as the default addressing namespace */
    addr_ns = AXIS2_WSA_NAMESPACE;

    if(addr_ver_from_msg_ctx)
    {
        if(!axutil_strcmp(AXIS2_WSA_NAMESPACE_SUBMISSION, addr_ver_from_msg_ctx))
        {
            addr_ns = AXIS2_WSA_NAMESPACE_SUBMISSION;
        }
    }
    else if(axis2_msg_ctx_get_op_ctx(msg_ctx, env))
    {
        axis2_op_ctx_t *op_ctx = NULL;
        axis2_msg_ctx_t *in_msg_ctx = NULL;
        op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);

        if(op_ctx)
        {
            in_msg_ctx = axis2_op_ctx_get_msg_ctx(op_ctx, env, AXIS2_WSDL_MESSAGE_LABEL_IN);
        }

        if(in_msg_ctx)
        {
            axis2_ctx_t *in_ctx = NULL;
            in_ctx = axis2_msg_ctx_get_base(in_msg_ctx, env);

            property = axis2_ctx_get_property(in_ctx, env, AXIS2_WSA_VERSION);
            if(property)
            {
                addr_ns = axutil_property_get_value(property, env);
                property = NULL;
            }

            if(!addr_ns || !*addr_ns)
            {
                addr_ns = AXIS2_WSA_NAMESPACE;
            }
        }
    }

    soap_header = axiom_soap_envelope_get_header(soap_envelope, env);
    if(!soap_header)
    {
        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "No SOAP header. Stop processing addressing");
        return AXIS2_SUCCESS; /* No SOAP header, so no point proceeding */
    }
    else
    {
        /* By this time, we definitely have some addressing information to be sent. This is because,
         * we have tested at the start of this whether msg_info_headers are null or not.
         * So rather than declaring addressing namespace in each and every addressing header, lets
         * define that in the Header itself.
         */
        const axis2_char_t *action = NULL;
        const axis2_char_t *address = NULL;
        const axis2_char_t *svc_group_context_id = NULL;
        const axis2_char_t *message_id = NULL;
        axis2_relates_to_t *relates_to = NULL;
        axiom_node_t *relates_to_header_node = NULL;
        axiom_element_t *relates_to_header_ele = NULL;
        axiom_namespace_t *addressing_namespace = NULL;

        soap_header_node = axiom_soap_header_get_base_node(soap_header, env);
        soap_header_ele = (axiom_element_t *)axiom_node_get_data_element(soap_header_node, env);

        addressing_namespace = axiom_namespace_create(env, addr_ns, AXIS2_WSA_DEFAULT_PREFIX);

        axiom_element_declare_namespace(soap_header_ele, env, soap_header_node,
            addressing_namespace);

        epr_to = axis2_msg_info_headers_get_to(msg_info_headers, env);

        if(epr_to)
        {
            axiom_soap_body_t *body = axiom_soap_envelope_get_body(soap_envelope, env);

            if(body)
            {
                /* In case of a SOAP fault, we got to send the response to
                 the adress specified by FaultTo */
                if(axiom_soap_body_has_fault(body, env))
                {
                    axis2_endpoint_ref_t *epr_fault_to = axis2_msg_info_headers_get_fault_to(
                        msg_info_headers, env);
                    if(epr_fault_to)
                    {
                        const axis2_char_t *fault_to_address = axis2_endpoint_ref_get_address(
                            epr_fault_to, env);
                        if(fault_to_address)
                        {
                            if(axutil_strcmp(AXIS2_WSA_NONE_URL, fault_to_address)
                                && axutil_strcmp(AXIS2_WSA_NONE_URL_SUBMISSION, fault_to_address))
                            {
                                axis2_endpoint_ref_set_address(epr_to, env, fault_to_address);
                            }
                        }
                    }
                }
            }

            address = axis2_endpoint_ref_get_address(epr_to, env);
            if(address && *address)
            {
                axiom_node_t *to_header_block_node = NULL;
                axiom_soap_header_block_t *to_header_block = NULL;
                axutil_array_list_t *ref_param_list = NULL;
                int size = 0;

                to_header_block = axiom_soap_header_add_header_block(soap_header, env,
                    AXIS2_WSA_TO, addressing_namespace);
				if(set_must_understand == AXIS2_TRUE)
				{
					axiom_soap_header_block_set_must_understand_with_bool(to_header_block, env, AXIS2_TRUE);
				}
				to_header_block_node = axiom_soap_header_block_get_base_node(to_header_block, env);
                if(to_header_block_node)
                {
                    axiom_element_t *to_header_block_element = NULL;
                    to_header_block_element = (axiom_element_t *)axiom_node_get_data_element(
                        to_header_block_node, env);
                    if(to_header_block_element)
                    {
                        axiom_element_set_text(to_header_block_element, env, address,
                            to_header_block_node);
                    }
                }

                ref_param_list = axis2_endpoint_ref_get_ref_param_list(epr_to, env);

                size = axutil_array_list_size(ref_param_list, env);
                if(ref_param_list && size > 0)
                {
                    axiom_soap_header_block_t *reference_header_block = NULL;
                    axiom_node_t *reference_node = NULL;
                    int i = 0;

                    for(i = 0; i < size; i++)
                    {
                        axiom_node_t *temp_node = NULL;

                        temp_node = (axiom_node_t *)axutil_array_list_get(ref_param_list, env, i);
                        if(temp_node)
                        {
                            axiom_element_t *temp_ele = NULL;

                            temp_ele = axiom_node_get_data_element(temp_node, env);
                            if(temp_ele)
                            {
                                reference_header_block = axiom_soap_header_add_header_block(
                                    soap_header, env, axiom_element_get_localname(temp_ele, env),
                                    axiom_element_get_namespace(temp_ele, env, temp_node));
								if(set_must_understand)
								{
									axiom_soap_header_block_set_must_understand_with_bool(reference_header_block, env, AXIS2_TRUE);
								}

                                reference_node = axiom_soap_header_block_get_base_node(
                                    reference_header_block, env);
                                if(reference_node)
                                {
                                    axiom_element_t *reference_ele = NULL;
                                    reference_ele = (axiom_element_t *)axiom_node_get_data_element(
                                        reference_node, env);

                                    if(reference_ele)
                                    {
                                        axiom_namespace_t *addr_ns_obj = NULL;
                                        axiom_attribute_t *reference_attr = NULL;

                                        addr_ns_obj = axiom_namespace_create(env, addr_ns,
                                            AXIS2_WSA_DEFAULT_PREFIX);
                                        reference_attr = axiom_attribute_create(env,
                                        /*"isReferenceParameter"*/
                                        AXIS2_WSA_IS_REFERENCE_PARAMETER_ATTRIBUTE, "true",
                                            addr_ns_obj);
                                        axiom_element_add_attribute(reference_ele, env,
                                            reference_attr, reference_node);
                                        axiom_element_set_text(reference_ele, env,
                                            axiom_element_get_text(temp_ele, env, temp_node),
                                            reference_node);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }/* if(epr_to) */

		axiom_namespace_free(addressing_namespace, env);

        action = axis2_msg_info_headers_get_action(msg_info_headers, env);
        if(action && *action)
        {
            axis2_addr_out_handler_process_string_info(env, action, AXIS2_WSA_ACTION, &soap_header,
				addr_ns, set_must_understand);
        }

        epr_reply_to = axis2_msg_info_headers_get_reply_to(msg_info_headers, env);
        if(!epr_reply_to)
        {
            const axis2_char_t *anonymous_uri = NULL;
            axis2_bool_t anonymous = axis2_msg_info_headers_get_reply_to_anonymous(
                msg_info_headers, env);
            axis2_bool_t none = axis2_msg_info_headers_get_reply_to_none(msg_info_headers, env);
            if(!axutil_strcmp(addr_ns, AXIS2_WSA_NAMESPACE_SUBMISSION))
            {
                if(none)
                {
                    anonymous_uri = AXIS2_WSA_NONE_URL_SUBMISSION;
                }
                else if(anonymous)
                {
                    anonymous_uri = AXIS2_WSA_ANONYMOUS_URL_SUBMISSION;
                }
            }
            else
            {
                if(none)
                {
                    anonymous_uri = AXIS2_WSA_NONE_URL;
                }
                else if(anonymous)
                {
                    anonymous_uri = AXIS2_WSA_ANONYMOUS_URL;
                }
            }

            if(anonymous_uri)
            {
                epr_reply_to = axis2_endpoint_ref_create(env, anonymous_uri);
            }

            if(epr_reply_to)
            {
                axis2_msg_info_headers_set_reply_to(msg_info_headers, env, epr_reply_to);
            }
        }

        /* add the service group id as a reference parameter */
        svc_group_context_id = axutil_string_get_buffer(axis2_msg_ctx_get_svc_grp_ctx_id(msg_ctx,
            env), env);

        axis2_addr_out_handler_add_to_soap_header(env, epr_reply_to, AXIS2_WSA_REPLY_TO,
            soap_header, addr_ns);

        epr_from = axis2_msg_info_headers_get_from(msg_info_headers, env);

        if(epr_from)
        {
            axis2_addr_out_handler_add_to_soap_header(env, epr_from, AXIS2_WSA_FROM, soap_header,
                addr_ns);

        }

        epr_fault_to = axis2_msg_info_headers_get_fault_to(msg_info_headers, env);
        if(!epr_fault_to)
        {
            const axis2_char_t *anonymous_uri = NULL;
            axis2_bool_t anonymous = axis2_msg_info_headers_get_fault_to_anonymous(
                msg_info_headers, env);
            axis2_bool_t none = axis2_msg_info_headers_get_fault_to_none(msg_info_headers, env);
            if(!axutil_strcmp(addr_ns, AXIS2_WSA_NAMESPACE_SUBMISSION))
            {
                if(none)
                {
                    anonymous_uri = AXIS2_WSA_NONE_URL_SUBMISSION;
                }
                else if(anonymous)
                {
                    anonymous_uri = AXIS2_WSA_ANONYMOUS_URL_SUBMISSION;
                }
            }
            else
            {
                if(none)
                    anonymous_uri = AXIS2_WSA_NONE_URL;
                else if(anonymous)
                    anonymous_uri = AXIS2_WSA_ANONYMOUS_URL;
            }

            if(anonymous_uri)
            {
                epr_fault_to = axis2_endpoint_ref_create(env, anonymous_uri);
            }
        }

        if(epr_fault_to)
        {
            /* optional */
            axis2_addr_out_handler_add_to_soap_header(env, epr_fault_to, AXIS2_WSA_FAULT_TO,
                soap_header, addr_ns);
        }

        message_id = axis2_msg_info_headers_get_message_id(msg_info_headers, env);

        if(message_id)
        {
            axis2_addr_out_handler_process_string_info(env, message_id, AXIS2_WSA_MESSAGE_ID,
				&soap_header, addr_ns, set_must_understand);
        }

        relates_to = axis2_msg_info_headers_get_relates_to(msg_info_headers, env);

        if(relates_to)
        {
            const axis2_char_t *value = NULL;
            value = axis2_relates_to_get_value(relates_to, env);
            relates_to_header_node = axis2_addr_out_handler_process_string_info(env, value,
				AXIS2_WSA_RELATES_TO, &soap_header, addr_ns, set_must_understand);
        }

        if(relates_to_header_node)
        {
            const axis2_char_t *relationship_type = NULL;
            relationship_type = axis2_relates_to_get_relationship_type(relates_to, env);
            if(relationship_type && *relationship_type)
            {
                axiom_attribute_t *om_attr = NULL;
                axiom_namespace_t *addr_ns_obj = NULL;
                axiom_namespace_t *dec_ns = NULL;
                relates_to_header_ele = (axiom_element_t *)axiom_node_get_data_element(
                    relates_to_header_node, env);
                if(relates_to_header_ele)
                {
                    dec_ns = axiom_element_find_declared_namespace(relates_to_header_ele, env,
                        addr_ns, AXIS2_WSA_DEFAULT_PREFIX);
                    if(dec_ns)
                    {
                        addr_ns_obj = dec_ns;
                    }
                    else
                    {
                        addr_ns_obj
                            = axiom_namespace_create(env, addr_ns, AXIS2_WSA_DEFAULT_PREFIX);
                    }

                    if(!axutil_strcmp(addr_ns, AXIS2_WSA_NAMESPACE_SUBMISSION))
                    {
                        om_attr = axiom_attribute_create(env,
                            AXIS2_WSA_RELATES_TO_RELATIONSHIP_TYPE,
                            AXIS2_WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE_SUBMISSION,
                            addr_ns_obj);
                    }
                    else
                    {
                        om_attr = axiom_attribute_create(env,
                            AXIS2_WSA_RELATES_TO_RELATIONSHIP_TYPE,
                            AXIS2_WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE, addr_ns_obj);
                    }

                    axiom_element_add_attribute(relates_to_header_ele, env, om_attr,
                        relates_to_header_node);

                    dec_ns = axiom_element_find_declared_namespace(relates_to_header_ele, env,
                        addr_ns, AXIS2_WSA_DEFAULT_PREFIX);
                    if(!dec_ns)
                    {
                        dec_ns = axiom_element_find_namespace(relates_to_header_ele, env,
                            relates_to_header_node, addr_ns, AXIS2_WSA_DEFAULT_PREFIX);
                        if(dec_ns)
                        {
                            axiom_namespace_free(addr_ns_obj, env);
                            addr_ns_obj = NULL;
                            axiom_attribute_set_namespace(om_attr, env, dec_ns);
                        }
                    }
                }

            }
        }
    }
    return AXIS2_SUCCESS;
}
Example #3
0
AXIS2_EXTERN axis2_msg_ctx_t * AXIS2_CALL
axis2_engine_create_fault_msg_ctx(
    axis2_engine_t * engine,
    const axutil_env_t * env,
    axis2_msg_ctx_t * processing_context,
    const axis2_char_t * code_value,
    const axis2_char_t * reason_text)
{
    axis2_msg_ctx_t *fault_ctx = NULL;
    axis2_endpoint_ref_t *fault_to = NULL;
    axis2_endpoint_ref_t *reply_to = NULL;
    axutil_stream_t *stream = NULL;
    axiom_soap_envelope_t *envelope = NULL;
    const axis2_char_t *wsa_action = NULL;
    const axis2_char_t *msg_id = NULL;
    axis2_relates_to_t *relates_to = NULL;
    axis2_char_t *msg_uuid = NULL;
    axis2_msg_info_headers_t *msg_info_headers = NULL;
    axis2_bool_t doing_rest = AXIS2_FALSE;

    AXIS2_PARAM_CHECK(env->error, processing_context, NULL);

    if(axis2_msg_ctx_get_process_fault(processing_context, env))
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_PROCESSING_FAULT_ALREADY,
            AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Creating fault message contex failed");
        return NULL;
    }

    fault_ctx = axis2_msg_ctx_create(env, engine->conf_ctx, axis2_msg_ctx_get_transport_in_desc(
        processing_context, env), axis2_msg_ctx_get_transport_out_desc(processing_context, env));

    axis2_msg_ctx_set_process_fault(fault_ctx, env, AXIS2_TRUE);

    fault_to = axis2_msg_ctx_get_fault_to(processing_context, env);
    if(fault_to)
    {
        const axis2_char_t *address = axis2_endpoint_ref_get_address(fault_to, env);
        if(!address)
        {
            fault_to = NULL;
        }
        else if(axutil_strcmp(AXIS2_WSA_NONE_URL, address) == 0 || axutil_strcmp(
            AXIS2_WSA_NONE_URL_SUBMISSION, address) == 0)
        {
            reply_to = axis2_msg_ctx_get_reply_to(processing_context, env);
            if(reply_to)
            {
                axis2_msg_ctx_set_fault_to(fault_ctx, env, reply_to);
            }
            else
            {
                axis2_msg_ctx_set_fault_to(fault_ctx, env, fault_to);
            }
        }
        else
        {
            axis2_msg_ctx_set_fault_to(fault_ctx, env, fault_to);
        }

    }

    stream = axis2_msg_ctx_get_transport_out_stream(processing_context, env);

    if(stream)
    {
        axis2_msg_ctx_set_transport_out_stream(fault_ctx, env, stream);
        axis2_msg_ctx_reset_transport_out_stream(processing_context, env);
    }

    if(!fault_to && !stream)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NOWHERE_TO_SEND_FAULT, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Soap fault target destination not found");
        return NULL;
    }

    /* Set WSA action */
    msg_info_headers = axis2_msg_ctx_get_msg_info_headers(processing_context, env);
    if(msg_info_headers)
    {
        wsa_action = axis2_msg_info_headers_get_action(msg_info_headers, env);
        if(wsa_action)
        {
            /*
             We have to use the action set by user,
             cannot use the default always.
             wsa_action = "http://www.w3.org/2005/08/addressing/fault"; */
            axis2_msg_ctx_set_wsa_action(fault_ctx, env, wsa_action);
        }
    }

    /* Set relates to */
    msg_id = axis2_msg_ctx_get_msg_id(processing_context, env);

    /* we can create with default Relates to namespace. 
     Actual namespace based on addressing version will be created in addressing out handler */
    relates_to = axis2_relates_to_create(env, msg_id,
        AXIS2_WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE);
    axis2_msg_ctx_set_relates_to(fault_ctx, env, relates_to);

    /* Set msg id */
    msg_uuid = axutil_uuid_gen(env);
    axis2_msg_ctx_set_message_id(fault_ctx, env, msg_uuid);
    if(msg_uuid)
    {
        AXIS2_FREE(env->allocator, msg_uuid);
        msg_uuid = NULL;
    }

	/** Copy the property map from the current message context to the newly created fault message
		context. */
	{
		axis2_ctx_t *ctx = axis2_msg_ctx_get_base(processing_context, env);
		axis2_ctx_t *fault_base_ctx = axis2_msg_ctx_get_base(fault_ctx, env);

		if(ctx && fault_ctx)
		{
			axis2_ctx_set_property_map(fault_base_ctx, env, axis2_ctx_get_property_map(ctx, env));
		}

	}


    axis2_msg_ctx_set_op_ctx(fault_ctx, env, axis2_msg_ctx_get_op_ctx(processing_context, env));
    axis2_msg_ctx_set_process_fault(fault_ctx, env, AXIS2_TRUE);
    axis2_msg_ctx_set_server_side(fault_ctx, env, AXIS2_TRUE);

    envelope = axis2_msg_ctx_get_fault_soap_envelope(processing_context, env);

    if(!envelope)
    {
        if(axis2_msg_ctx_get_is_soap_11(processing_context, env))
        {
            envelope = axiom_soap_envelope_create_default_soap_fault_envelope(env, code_value,
                reason_text, AXIOM_SOAP11, NULL, NULL);

        }
        else
        {
            envelope = axiom_soap_envelope_create_default_soap_fault_envelope(env, code_value,
                reason_text, AXIOM_SOAP12, NULL, NULL);
        }

        if(!envelope)
        {
            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Creating default soap envelope failed");
            return NULL;
        }
    }
    else
    {
        axis2_msg_ctx_set_fault_soap_envelope(processing_context, env, NULL);
    }

    doing_rest = axis2_msg_ctx_get_doing_rest(processing_context, env);
    axis2_msg_ctx_set_doing_rest(fault_ctx, env, doing_rest);

    axis2_msg_ctx_set_soap_envelope(fault_ctx, env, envelope);
    axis2_msg_ctx_set_out_transport_info(fault_ctx, env, axis2_msg_ctx_get_out_transport_info(
        processing_context, env));
    axis2_msg_ctx_reset_out_transport_info(processing_context, env);
    return fault_ctx;
}
Example #4
0
int
axis2_test_msg_info_headers(
    )
{
    axis2_endpoint_ref_t *to = NULL;
    axis2_endpoint_ref_t *from = NULL;
    axis2_endpoint_ref_t *reply_to = NULL;
    axis2_endpoint_ref_t *fault_to = NULL;
    axis2_endpoint_ref_t *axis2_endpoint_ref = NULL;
    axis2_status_t status = AXIS2_FAILURE;
    axis2_msg_info_headers_t *axis2_msg_info_headers = NULL;
    axutil_allocator_t *allocator = axutil_allocator_init(NULL);
    const axutil_env_t *env = axutil_env_create(allocator);
    const axis2_char_t *action = "test action";
    const axis2_char_t *get_action = NULL;
    to = axis2_endpoint_ref_create(env, "to");
    from = axis2_endpoint_ref_create(env, "from");
    reply_to = axis2_endpoint_ref_create(env, "reply to");
    fault_to = axis2_endpoint_ref_create(env, "fault to");

    axis2_msg_info_headers = axis2_msg_info_headers_create(env, NULL, action);
    if (axis2_msg_info_headers)
        printf("SUCCESS axis2_msg_info_headers_create\n");
    else
    {
        printf("ERROR AXIS2_MSG_INFO_HEADERS_CREATE\n");
        return -1;
    }

    status = axis2_msg_info_headers_set_to(axis2_msg_info_headers, env, to);

    if (status == AXIS2_SUCCESS)
        printf("SUCCESS axis2_msg_info_headers_set_to\n");
    else
    {
        printf("ERROR axis2_msg_info_headers_set_to");
        return -1;
    }

    axis2_endpoint_ref =
        axis2_msg_info_headers_get_to(axis2_msg_info_headers, env);

    if (axis2_endpoint_ref)
        printf("SUCCESS axis2_msg_info_headers_get_to\n");
    else
    {
        printf("ERROR axis2_msg_info_headers_get_to\n");
        return -1;
    }

    status = AXIS2_FAILURE;
    status = axis2_msg_info_headers_set_from(axis2_msg_info_headers, env, from);

    if (status)
        printf("SUCCESS axis2_msg_info_headers_set_from\n");
    else
    {
        printf("ERROR axis2_msg_info_headers_set_from\n");
        return -1;
    }

    axis2_endpoint_ref = NULL;
    axis2_endpoint_ref =
        axis2_msg_info_headers_get_from(axis2_msg_info_headers, env);

    if (axis2_endpoint_ref)
        printf("SUCCESS axis2_msg_info_headers_get_from\n");
    else
    {
        printf("ERROR axis2_msg_info_headers_get_from\n");
        return -1;
    }

    axis2_endpoint_ref = NULL;
    axis2_endpoint_ref =
        axis2_msg_info_headers_get_reply_to(axis2_msg_info_headers, env);

    if (status)
        printf("SUCCESS axis2_msg_info_headers_get_reply_to\n");
    else
    {
        printf("ERROR axis2_msg_info_headers_get_reply_to\n");
        return -1;
    }

    status = AXIS2_FAILURE;
    status =
        axis2_msg_info_headers_set_reply_to(axis2_msg_info_headers, env,
                                            reply_to);

    if (status)
        printf("SUCCESS axis2_msg_info_headers_set_reply_to\n");
    else
    {
        printf("ERROR axis2_msg_info_headers_set_reply_to\n");
        return -1;
    }

    status = AXIS2_FAILURE;
    status =
        axis2_msg_info_headers_set_fault_to(axis2_msg_info_headers, env,
                                            fault_to);
    if (status)
        printf("SUCCESS axis2_msg_info_headers_set_fault_to\n");
    else
    {
        printf("ERROR axis2_msg_info_headers_set_fault_to\n");
        return -1;
    }

    axis2_endpoint_ref = NULL;
    axis2_endpoint_ref =
        axis2_msg_info_headers_get_fault_to(axis2_msg_info_headers, env);
    if (axis2_endpoint_ref)
        printf("SUCCESS axis2_msg_info_headers_get_fault_to\n");
    else
    {
        printf("ERROR axis2_msg_info_headers_get_fault_to\n");
        return -1;
    }

    get_action = axis2_msg_info_headers_get_action(axis2_msg_info_headers, env);
    if (get_action)
        printf("SUCCESS axis2_msg_info_headers_get_action\n");
    else
    {
        printf("ERROR axis2_msg_info_headers_get_action\n");
        return -1;
    }

    status = AXIS2_FAILURE;
    status =
        axis2_msg_info_headers_set_action(axis2_msg_info_headers, env, action);
    if (status)
        printf("SUCCESS axis2_msg_info_headers_set_action\n");
    else
    {
        printf("ERROR axis2_msg_info_headers_set_action\n");
    }

    status = AXIS2_FAILURE;
    /* status = axis2_msg_info_headers_free(axis2_msg_info_headers, env); */
    if (status)
        printf("SUCCESS axis2_msg_info_headers_free\n");
    else
    {
        printf("ERROR axis2_msg_info_headers_free\n");
    }
    return 0;
}