예제 #1
0
axis2_status_t AXIS2_CALL
axis2_statistics_admin_global_request_count_handler_invoke(struct axis2_handler *handler, 
                        const axutil_env_t *env,
                        struct axis2_msg_ctx *msg_ctx)
{
    axis2_status_t status = AXIS2_SUCCESS;
    axis2_svc_t *svc = NULL;
    
    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[adminservices] Start:axis2_statistics_admin_global_request_count_handler_invoke");
    AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);

    svc = axis2_msg_ctx_get_svc(msg_ctx, env);
    if(svc)
    {
        long *time_now = NULL;
        axutil_property_t *property = NULL;
       
        time_now = AXIS2_MALLOC(env->allocator, sizeof(long));
        *time_now = service_admin_util_get_current_time_in_millis(env);
        property = axutil_property_create_with_args(env, 0, 0, 0, time_now);
        axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_REQUEST_RECEIVED_TIME, property);
    }
    
    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[adminservices] End:axis2_statistics_admin_global_request_count_handler_invoke");
    
    return status;
}
예제 #2
0
axis2_status_t AXIS2_CALL
axis2_statistics_admin_out_op_count_handler_invoke(struct axis2_handler *handler, 
                        const axutil_env_t *env,
                        struct axis2_msg_ctx *msg_ctx)
{
    axis2_status_t status = AXIS2_SUCCESS;
    service_admin_counter_t *counter = NULL;
    axutil_param_t *param = NULL;
    axis2_op_t *op = NULL;
    axis2_svc_t *svc = NULL;
    const axis2_char_t *svc_name = NULL;
    
    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[adminservices] Start:axis2_statistics_admin_out_op_count_handler_invoke");
    AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);

    svc = axis2_msg_ctx_get_svc(msg_ctx, env);
    if(svc)
    {
        svc_name = axis2_svc_get_name(svc, env);
    }
    op = axis2_msg_ctx_get_op(msg_ctx, env);
    if(op)
    {
        param = axis2_op_get_param(op, env, AXIS2_OUT_OPERATION_COUNTER);
        if(param)
        {
            counter = axutil_param_get_value(param, env);
            if(counter)
            {
                service_admin_counter_increment(counter, env, msg_ctx);
            }
        }
        else
        {
            axis2_char_t *op_name = NULL;

            op_name = axutil_qname_get_localpart(axis2_op_get_qname(op, env), env);
            axutil_allocator_switch_to_global_pool(env->allocator);
            counter = service_admin_counter_create(env, svc_name, op_name);
            if(counter)
            {
                service_admin_counter_increment(counter, env, msg_ctx);
                param = axutil_param_create(env, AXIS2_OUT_OPERATION_COUNTER, counter);
                if(param)
                {
                    axis2_op_add_param(op, env, param);
                }
            }
            axutil_allocator_switch_to_local_pool(env->allocator);
        }
    }
    
    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[adminservices] End:axis2_statistics_admin_out_op_count_handler_invoke");
    
    return status;
}
예제 #3
0
AXIS2_EXTERN axutil_url_t* AXIS2_CALL
service_admin_util_get_server_url(
	const axutil_env_t *env,
	axis2_msg_ctx_t *msg_ctx)
{

	axis2_endpoint_ref_t *epr = NULL;
	axis2_char_t *address = NULL;
	axis2_conf_ctx_t *conf_ctx = NULL;
	axis2_conf_t *conf = NULL;
	axis2_transport_in_desc_t *transport_in = NULL;
	axis2_svc_t *svc = NULL;
	axis2_char_t *svc_name = NULL;
	conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
	conf = axis2_conf_ctx_get_conf(conf_ctx, env);
	
	svc = axis2_msg_ctx_get_svc(msg_ctx, env);
	svc_name = axis2_svc_get_name(svc, env);

	transport_in = axis2_conf_get_transport_in(conf, env, AXIS2_TRANSPORT_ENUM_HTTP);

	if(transport_in)
	{
		axutil_url_t *url = NULL;
		axis2_transport_receiver_t *receiver = NULL;
		receiver = axis2_transport_in_desc_get_recv(transport_in, env);
		if(!receiver)
		{
			AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Transport Receiver Not found ");
			return NULL;
		}
		epr = axis2_transport_receiver_get_epr_for_service(receiver, env, svc_name);
		if(!epr)
		{
			AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Endpoint reference null");
			return NULL;
		}
		address = (axis2_char_t*)axis2_endpoint_ref_get_address(epr,env);
return axutil_url_parse_string(env, address);
		
	}
	return NULL;



}
예제 #4
0
axis2_status_t AXIS2_CALL
sandesha2_out_handler_invoke(
    struct axis2_handler *handler, 
    const axutil_env_t *env,
    struct axis2_msg_ctx *msg_ctx)
{
    axutil_property_t *temp_prop = NULL;
    axis2_conf_ctx_t *conf_ctx = NULL;
    axis2_conf_t *conf = NULL;
    axis2_char_t *str_done = NULL;
    axis2_char_t *dummy_msg_str = NULL;
    axis2_bool_t dummy_msg = AXIS2_FALSE;
    axis2_svc_t *svc = NULL;
    axutil_qname_t *module_qname = NULL;
    sandesha2_msg_ctx_t *rm_msg_ctx = NULL;
    sandesha2_msg_processor_t *msg_processor = NULL;
    int msg_type = -1;

    AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2] Entry:sandesha2_out_handler_invoke");
            
    temp_prop = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_SEQ_PROP_MAKE_CONNECTION_OUT_PATH);
    if (temp_prop)
    {
        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
            "[sandesha2] In make connection out path. So return here.");
        return AXIS2_SUCCESS;
        temp_prop = NULL;
    }

    if(sandesha2_util_is_rstr_msg(env, msg_ctx))
    {
        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
            "[sandesha2] A RSTR message. Sandesha don't process.");
        return AXIS2_SUCCESS;
    }

    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
    if(!conf_ctx)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
            "[sandesha2] Configuration Context is NULL");
        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CONF_CTX_NULL, AXIS2_FAILURE);
        return AXIS2_FAILURE;
    }
    svc = axis2_msg_ctx_get_svc(msg_ctx, env);
    if(!svc)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Axis2 Service is NULL");
        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SVC_NULL, AXIS2_FAILURE);
        return AXIS2_FAILURE;
    }
    module_qname = axutil_qname_create(env, SANDESHA2_MODULE, NULL, NULL);
    if(!axis2_svc_is_module_engaged(svc, env, module_qname))
    {
        if(module_qname)
        {
            axutil_qname_free(module_qname, env);
        }

        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]RM is not engaged. So return here");
        return AXIS2_SUCCESS;
    }

    if(module_qname)
    {
        axutil_qname_free(module_qname, env);
    }

    temp_prop = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_APPLICATION_PROCESSING_DONE);
    if(temp_prop)
    {
        str_done = (axis2_char_t *) axutil_property_get_value(temp_prop, env); 
    }

    if(str_done && 0 == axutil_strcmp(AXIS2_VALUE_TRUE, str_done))
    {
        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
            "[sandesha2]Application Processing Done. So return here.");
        return AXIS2_SUCCESS; 
    }

    temp_prop = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
    axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_APPLICATION_PROCESSING_DONE, temp_prop);
    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
    if(!sandesha2_permanent_storage_mgr_create_db(env, conf_ctx))
    {
        return AXIS2_FAILURE;
    }

    /* Getting rm message */ 
    rm_msg_ctx = sandesha2_msg_init_init_msg(env, msg_ctx);
    temp_prop = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_CLIENT_DUMMY_MESSAGE);
    if(NULL != temp_prop)
    {
        dummy_msg_str = (axis2_char_t *) axutil_property_get_value(temp_prop, env); 
    }

    if(dummy_msg_str && 0 == axutil_strcmp(AXIS2_VALUE_TRUE, dummy_msg_str))
    {
        dummy_msg = AXIS2_TRUE;
    }

    temp_prop = axis2_msg_ctx_get_property(msg_ctx, env, AXIS2_SVC_CLIENT_CLOSED);
    if(temp_prop)
    {
        axis2_char_t *spec_version = NULL;

        axis2_endpoint_ref_t *reply_to = axis2_msg_ctx_get_reply_to(msg_ctx, env);
        if(reply_to)
        {
            axis2_char_t *address = axis2_endpoint_ref_get_address(reply_to, env);
            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "dam_reply_to_address:%s", address);
        }
        spec_version = sandesha2_utils_get_rm_version(env, msg_ctx);

        if(!axutil_strcmp(SANDESHA2_SPEC_VERSION_1_1, spec_version))
        {
            axis2_char_t *action = NULL;
            axutil_string_t *str_action = NULL;

            action = sandesha2_spec_specific_consts_get_terminate_seq_action(env, spec_version);
            str_action = axutil_string_create(env, action);
            axis2_msg_ctx_set_soap_action(msg_ctx, env, str_action);
            axutil_string_free(str_action, env);
            /*axis2_msg_ctx_set_reply_to(msg_ctx, env, NULL);*/
            msg_type = sandesha2_msg_ctx_set_msg_type(rm_msg_ctx, env, 
                SANDESHA2_MSG_TYPE_CLOSE_SEQ);
        }
        else if(!axutil_strcmp(SANDESHA2_SPEC_VERSION_1_0, spec_version))
        {
            axutil_property_t *property = NULL;
            axutil_string_t *str_action = NULL;
            
            /*axis2_msg_info_headers_set_action(axis2_msg_ctx_get_msg_info_headers(msg_ctx, env), 
             * env, SANDESHA2_SPEC_2005_02_SOAP_ACTION_LAST_MESSAGE); */
            str_action = axutil_string_create(env, SANDESHA2_SPEC_2005_02_SOAP_ACTION_LAST_MESSAGE);
            axis2_msg_ctx_set_soap_action(msg_ctx, env, str_action);
            axutil_string_free(str_action, env);
            property = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
            axis2_msg_ctx_set_property(msg_ctx, env, "Sandesha2LastMessage", property);
            /*axis2_msg_ctx_set_reply_to(msg_ctx, env, NULL);*/
        }
    }

    msg_type = sandesha2_msg_ctx_get_msg_type(rm_msg_ctx, env);
    if(msg_type == SANDESHA2_MSG_TYPE_UNKNOWN)
    {
        axis2_msg_ctx_t *req_msg_ctx = NULL;
        axis2_op_ctx_t *op_ctx = NULL;

        op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
        req_msg_ctx =  axis2_op_ctx_get_msg_ctx(op_ctx, env, AXIS2_WSDL_MESSAGE_LABEL_IN);
        if(req_msg_ctx) /* For the server side */
        {
            sandesha2_msg_ctx_t *req_rm_msg_ctx = NULL;
            sandesha2_seq_t *seq_part = NULL;

            req_rm_msg_ctx = sandesha2_msg_init_init_msg(env, req_msg_ctx);
            seq_part = sandesha2_msg_ctx_get_sequence(req_rm_msg_ctx, env);
            if(seq_part)
            {
                msg_processor = (sandesha2_msg_processor_t *) 
                sandesha2_app_msg_processor_create(env); /* rm intended msg */
            }
            if(req_rm_msg_ctx)
                sandesha2_msg_ctx_free(req_rm_msg_ctx, env);
        }
        else if(!axis2_msg_ctx_get_server_side(msg_ctx, env))
        {
            msg_processor = (sandesha2_msg_processor_t *) sandesha2_app_msg_processor_create(env);
        }
    }
    else
    {
        msg_processor = sandesha2_msg_processor_create_msg_processor(env, rm_msg_ctx);
    }
    if(msg_processor)
    {
        sandesha2_msg_processor_process_out_msg(msg_processor, env, rm_msg_ctx);
        sandesha2_msg_processor_free(msg_processor, env);
    }
    if(AXIS2_SUCCESS != AXIS2_ERROR_GET_STATUS_CODE(env->error))
    {
        /* Message should not be sent in an exception situation */

        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Pausing message context");
        axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
        if(rm_msg_ctx)
        {
            sandesha2_msg_ctx_free(rm_msg_ctx, env);
        }
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Error in processing the message");
        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CANNOT_PROCESS_MSG, AXIS2_FAILURE);
        return AXIS2_FAILURE;
    }
    
    temp_prop = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_APPLICATION_PROCESSING_DONE);
    if(temp_prop)
    {
        axutil_property_set_value(temp_prop, env, AXIS2_VALUE_FALSE);
    }

    if(rm_msg_ctx)
    {
        sandesha2_msg_ctx_free(rm_msg_ctx, env);
    }

    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2]Exit:sandesha2_out_handler_invoke");

    return AXIS2_SUCCESS;
}
/**
* auto generated function definition signature
* for "getKeyStores|http://service.keystore.security.carbon.wso2.org" operation.
* @param env environment ( mandatory)* @param MessageContext the outmessage context
*
* @return adb_getKeyStoresResponse_t*
*/
adb_getKeyStoresResponse_t* 
axis2_skel_KeyStoreAdminService_getKeyStores(const axutil_env_t *env , 
											 axis2_msg_ctx_t *msg_ctx,
											 axis2_skel_KeyStoreAdminService_getKeyStores_fault *fault )
{
	axis2_svc_t* svc = NULL;
	axutil_param_t* param = NULL;
	axis2_char_t* primary_keystore = NULL;
	axis2_bool_t is_primary_keystore = AXIS2_FALSE;
	axis2_conf_ctx_t* conf_ctx = NULL;
	axis2_conf_t* conf = NULL;
	axis2_char_t* repo_path = NULL;
	axutil_array_list_t* keystore_filenames = NULL;
	int keystore_file_count = 0;
	int index = 0;
	adb_getKeyStoresResponse_t* response = NULL;
	axis2_char_t* keystore_filename = NULL;
	axis2_char_t* keystore_name = NULL;
	axis2_char_t* extension = NULL;
	axis2_char_t* keystore_type = NULL;
	axis2_char_t* provider = NULL;
	axis2_bool_t private_store = AXIS2_FALSE;
	axis2_char_t* tok = NULL;
	adb_KeyStoreData_t* data = NULL;

	/* Get primary keystore filename */
	svc = axis2_msg_ctx_get_svc(msg_ctx, env);
	param = axis2_svc_get_param(svc, env, "PrimaryKeystore");
	if (param)
	{
		primary_keystore = (axis2_char_t*)
			axutil_param_get_value(param, env);
	}

	/* Form keystore directory name*/
	conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
    repo_path = axis2_conf_get_repo(conf, env);

	/* Read file names in keystore directory */	
	keystore_filenames = keystore_admin_util_get_keystore_filenames(
		env, repo_path);

	if (!keystore_filenames) return NULL;
	
	/* Create response */
	response = adb_getKeyStoresResponse_create(env);

	/* Fill data */
	keystore_file_count = axutil_array_list_size(keystore_filenames, env);
	for (index = 0; index < keystore_file_count; ++index)
	{
		axis2_char_t* filename = NULL;

		keystore_filename = NULL;
		keystore_name = NULL;
		extension = NULL;
		keystore_type = NULL;
		provider = NULL;
		private_store = AXIS2_FALSE;
		tok = NULL;

		/* Get name */
		filename = (axis2_char_t*)axutil_array_list_get(keystore_filenames, env, index);
		keystore_filename = axutil_strdup(env, filename);

		tok = strtok(filename, ".");
		if (tok) /* Keystore name */
		{
			keystore_name = tok;
			
			tok = strtok(NULL, " .");
			if (tok) /* Extension */
			{
				extension = tok;
			}
		}

		if (NULL == extension) /* No extension found */
		{
			AXIS2_FREE(env->allocator, filename);
			AXIS2_FREE(env->allocator, keystore_filename);
			keystore_filename = filename = NULL;
			continue;
		}

		if (0 == axutil_strcmp(extension, "p12")) /* PKCS12 */
		{
			keystore_type = "PKCS12";
		}
		else
		{
			AXIS2_FREE(env->allocator, filename);
			AXIS2_FREE(env->allocator, keystore_filename);
			keystore_filename = filename = NULL;
			continue;
		}

		is_primary_keystore = 
			(0 == axutil_strcmp(keystore_filename, primary_keystore)) ? AXIS2_TRUE : AXIS2_FALSE;

		if (is_primary_keystore)
		{
			/* Primary keystore */
			provider = axutil_strcat(env, " ", NULL);
			private_store = AXIS2_TRUE;
		}
		else
		{
			axis2_char_t password_tmp[10];
			axis2_char_t provider_tmp[20];
			axis2_char_t pvt_key_pass_tmp[10];

			/* Get password, provider and pvt_key_pass */
			if (!keystore_admin_util_get_keystore_details(env, repo_path, keystore_name, 
				password_tmp, provider_tmp, pvt_key_pass_tmp))
			{
				AXIS2_FREE(env->allocator, filename);
				AXIS2_FREE(env->allocator, keystore_filename);
				keystore_filename = filename = NULL;
				continue;
			}

			provider = axutil_strdup(env, provider_tmp);

			private_store = keystore_admin_util_get_private_store(env, repo_path,
				keystore_name, password_tmp);
		}
		
		data = adb_KeyStoreData_create(env);

		adb_KeyStoreData_set_keyStoreName(data, env, keystore_filename);
		adb_KeyStoreData_set_keyStoreType(data, env, keystore_type);
		adb_KeyStoreData_set_provider(data, env, provider);
		adb_KeyStoreData_set_privateStore(data, env, private_store);

		adb_getKeyStoresResponse_add_return(response, env, data);
	}

	axutil_array_list_free(keystore_filenames, env);
	
	return response;
}
/**
* auto generated function definition signature
* for "deleteStore|http://service.keystore.security.carbon.wso2.org" operation.
* @param env environment ( mandatory)* @param MessageContext the outmessage context
* @param _deleteStore of the adb_deleteStore_t*
*
* @return 
*/
axis2_status_t  
axis2_skel_KeyStoreAdminService_deleteStore(const axutil_env_t *env , 
											axis2_msg_ctx_t *msg_ctx,
											adb_deleteStore_t* _deleteStore,
											axis2_skel_KeyStoreAdminService_deleteStore_fault *fault )
{
	axis2_svc_t* svc = NULL;
	axutil_param_t* param = NULL;
	axis2_char_t* primary_keystore = NULL;
	axis2_char_t* keystore_name = NULL;
	axis2_conf_ctx_t* conf_ctx = NULL;
	axis2_conf_t* conf = NULL;
	axis2_char_t* repo_path = NULL;
	axis2_char_t* keystore_file = NULL;
	axis2_char_t* keystore_details_file = NULL;
	int status = 0;

	/* Get required keystore name*/
	keystore_name = axutil_strdup(
		env, adb_deleteStore_get_keyStoreName(_deleteStore, env));
	if (!keystore_name) return AXIS2_FAILURE;

	/* Get primary keystore filename */
	svc = axis2_msg_ctx_get_svc(msg_ctx, env);
	param = axis2_svc_get_param(svc, env, "PrimaryKeystore");
	if (param)
	{
		primary_keystore = (axis2_char_t*)
			axutil_param_get_value(param, env);
	}

	/* Primary keystore should not be deleted*/
	if (0 == axutil_strcmp(keystore_name, primary_keystore))
		return AXIS2_FAILURE;

	keystore_name = strtok(keystore_name, ".");

	/* Form keystore file names*/
	conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
    conf = axis2_conf_ctx_get_conf(conf_ctx, env);
    repo_path = axis2_conf_get_repo(conf, env);
	keystore_file = axutil_strcat(env, repo_path, AXIS2_PATH_SEP_STR, "services", 
		AXIS2_PATH_SEP_STR, "KeyStoreAdminService", AXIS2_PATH_SEP_STR, "keystores", 
		AXIS2_PATH_SEP_STR, keystore_name, ".p12", NULL);
	keystore_details_file = axutil_strcat(env, repo_path, AXIS2_PATH_SEP_STR, "services", 
		AXIS2_PATH_SEP_STR, "KeyStoreAdminService", AXIS2_PATH_SEP_STR, "keystores", 
		AXIS2_PATH_SEP_STR, keystore_name, ".dat", NULL);

	/* Remove keystore and detail files*/
	status = remove(keystore_file);
	if (0 == status)
		status = remove(keystore_details_file);

	AXIS2_FREE(env->allocator, keystore_name);
	AXIS2_FREE(env->allocator, keystore_file);
	AXIS2_FREE(env->allocator, keystore_details_file);
	
	if (0 != status) return AXIS2_FAILURE;

	return AXIS2_SUCCESS;
}
static axis2_status_t AXIS2_CALL
axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync(
    axis2_msg_recv_t * msg_recv,
    const axutil_env_t * env,
    axis2_msg_ctx_t * msg_ctx,
    axis2_msg_ctx_t * new_msg_ctx)
{
    axis2_svc_skeleton_t *svc_obj = NULL;
    axis2_op_ctx_t *op_ctx = NULL;
    axis2_op_t *op_desc = NULL;
    const axis2_char_t *style = NULL;
    axiom_node_t *om_node = NULL;
    axiom_element_t *om_element = NULL;
    axis2_char_t *local_name = NULL;
    axiom_node_t *result_node = NULL;
    axiom_node_t *body_content_node = NULL;
    axiom_element_t *body_content_element = NULL;
    axiom_soap_envelope_t *default_envelope = NULL;
    axiom_soap_body_t *out_body = NULL;
    axiom_soap_header_t *out_header = NULL;
    axiom_soap_fault_t *soap_fault = NULL;
    axiom_node_t *out_node = NULL;
    axis2_status_t status = AXIS2_SUCCESS;
    axis2_bool_t skel_invoked = AXIS2_FALSE;
    const axis2_char_t *soap_ns = AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
    int soap_version = AXIOM_SOAP12;
    axiom_namespace_t *env_ns = NULL;
    axiom_node_t *fault_node = NULL;
    axiom_soap_fault_detail_t *fault_detail;
    axis2_bool_t is_fault = AXIS2_FALSE;

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

    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
        "[axis2]Entry:axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync");

    /* get the implementation class for the Web Service */
    svc_obj = axis2_msg_recv_make_new_svc_obj(msg_recv, env, msg_ctx);

    if(!svc_obj)
    {
        const axis2_char_t *svc_name = NULL;
        axis2_svc_t *svc = axis2_msg_ctx_get_svc(msg_ctx, env);

        if(svc)
        {
            svc_name = axis2_svc_get_name(svc, env);
        }
        else
        {
            svc_name = "unknown";
        }

        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Impl object for service '%s' not set in message receiver. %d :: %s", svc_name,
            env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error));

        status = AXIS2_FAILURE;
    }
    else
    {
        op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
        op_desc = axis2_op_ctx_get_op(op_ctx, env);

        style = axis2_op_get_style(op_desc, env);
        if(0 == axutil_strcmp(AXIS2_STYLE_DOC, style))
        {
            axiom_soap_envelope_t *envelope = NULL;
            axiom_soap_body_t *body = NULL;

            envelope = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
            body = axiom_soap_envelope_get_body(envelope, env);
            om_node = axiom_soap_body_get_base_node(body, env);
            om_element = axiom_node_get_data_element(om_node, env);
            om_node = axiom_node_get_first_element(om_node, env);
        }
        else if(0 == axutil_strcmp(AXIS2_STYLE_RPC, style))
        {
            axiom_soap_envelope_t *envelope = NULL;
            axiom_soap_body_t *body = NULL;
            axiom_node_t *op_node = NULL;
            axiom_element_t *op_element = NULL;

            envelope = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
            body = axiom_soap_envelope_get_body(envelope, env);
            op_node = axiom_soap_body_get_base_node(body, env);
            op_element = axiom_node_get_data_element(op_node, env);
            if(op_element)
            {
                local_name = axiom_element_get_localname(op_element, env);
                if(local_name)
                {
                    axutil_array_list_t *function_arr = NULL;
                    int i = 0;
                    int size = 0;
                    axis2_bool_t matches = AXIS2_FALSE;

                    function_arr = svc_obj->func_array;
                    if(function_arr)
                    {
                        size = axutil_array_list_size(function_arr, env);
                    }

                    for(i = 0; i < size; i++)
                    {
                        axis2_char_t *function_name = NULL;

                        function_name = (axis2_char_t *)axutil_array_list_get(function_arr, env, i);
                        if(!axutil_strcmp(function_name, local_name))
                        {
                            matches = AXIS2_TRUE;

                        }
                    }

                    if(matches)
                    {
                        om_node = axiom_node_get_first_child(op_node, env);
                        om_element = axiom_node_get_data_element(om_node, env);
                    }
                    else
                    {
                        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_OM_ELEMENT_MISMATCH, AXIS2_FAILURE);
                        status = AXIS2_FAILURE;
                    }
                }
                else
                {
                    AXIS2_ERROR_SET(env->error, AXIS2_ERROR_OM_ELEMENT_INVALID_STATE, AXIS2_FAILURE);
                    status = AXIS2_FAILURE;
                }
            }
            else
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_RPC_NEED_MATCHING_CHILD, AXIS2_FAILURE);
                status = AXIS2_FAILURE;
            }
        }
        else
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_UNKNOWN_STYLE, AXIS2_FAILURE);
            status = AXIS2_FAILURE;
        }

        if(status == AXIS2_SUCCESS)
        {
            skel_invoked = AXIS2_TRUE;
            result_node = AXIS2_SVC_SKELETON_INVOKE(svc_obj, env, om_node, new_msg_ctx);
        }

        if(result_node)
        {
            if(0 == axutil_strcmp(style, AXIS2_STYLE_RPC))
            {
                axiom_namespace_t *ns = NULL;
                axis2_char_t *res_name = NULL;

                res_name = axutil_stracat(env, local_name, "Response");
                ns = axiom_namespace_create(env, "http://soapenc/", "res");
                if(!ns)
                {
                    status = AXIS2_FAILURE;
                }
                else
                {
                    body_content_element = axiom_element_create(env, NULL, res_name, ns,
                        &body_content_node);
                    axiom_node_add_child(body_content_node, env, result_node);
                }
            }
            else
            {
                body_content_node = result_node;
            }
        }
        else
        {
            axis2_char_t *mep = (axis2_char_t *)axis2_op_get_msg_exchange_pattern(op_desc, env);
            if(axutil_strcmp(mep, AXIS2_MEP_URI_IN_ONLY) && axutil_strcmp(mep,
				AXIS2_MEP_URI_ROBUST_IN_ONLY) && axutil_strcmp(mep, AXIS2_MEP_URI_IN_ONLY_WSDL2) &&						axutil_strcmp(mep, AXIS2_MEP_URI_ROBUST_IN_ONLY_WSDL2))
            {
                status = AXIS2_ERROR_GET_STATUS_CODE(env->error);
                if(status == AXIS2_SUCCESS)
                {
                    axis2_msg_ctx_set_no_content(new_msg_ctx, env, AXIS2_TRUE);
                }
                else
                {
                    axis2_msg_ctx_set_status_code(msg_ctx, env, axis2_msg_ctx_get_status_code(
                        new_msg_ctx, env));
                }
                /* The new_msg_ctx is passed to the service. The status code must
                 * be taken from here and set to the old message context which is
                 * used by the worker when the request processing fails.
                 */
                if(svc_obj->ops->on_fault)
                {
                    fault_node = AXIS2_SVC_SKELETON_ON_FAULT(svc_obj, env, om_node);
                }
                is_fault = AXIS2_TRUE;
            }
            else
            {
                /* If we have a in only message result node is NULL. We create fault only if
                 * an error is set
                 */
                status = AXIS2_ERROR_GET_STATUS_CODE(env->error);
                if(status == AXIS2_SUCCESS)
                {
                    axis2_msg_ctx_set_no_content(new_msg_ctx, env, AXIS2_TRUE);
                }
                else
                {
                    axis2_msg_ctx_set_status_code(msg_ctx, env, axis2_msg_ctx_get_status_code(
                        new_msg_ctx, env));
					if((!axutil_strcmp(mep, AXIS2_MEP_URI_ROBUST_IN_ONLY)) || 
						(!axutil_strcmp(mep, AXIS2_MEP_URI_ROBUST_IN_ONLY_WSDL2)))
                    {
                        /* The new_msg_ctx is passed to the service. The status code must
                         * be taken from here and set to the old message context which is
                         * used by the worker when the request processing fails.
                         */
                        if(svc_obj->ops->on_fault)
                        {
                            fault_node = AXIS2_SVC_SKELETON_ON_FAULT(svc_obj, env, om_node);
                        }
                        is_fault = AXIS2_TRUE;
                    }
                }
            }
        }
    }

    if(msg_ctx && axis2_msg_ctx_get_is_soap_11(msg_ctx, env))
    {
        soap_ns = AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI; /* default is 1.2 */
        soap_version = AXIOM_SOAP11;
    }

    if(axis2_msg_ctx_get_soap_envelope(new_msg_ctx, env))
    {
        /* service implementation has set the envelope,
         useful when setting a SOAP fault.
         No need to further process */
        return AXIS2_SUCCESS;
    }

    /* create the soap envelope here */
    env_ns = axiom_namespace_create(env, soap_ns, "soapenv");
    if(!env_ns)
    {
        return AXIS2_FAILURE;
    }

    default_envelope = axiom_soap_envelope_create(env, env_ns);
	axiom_namespace_free(env_ns, env);

    if(!default_envelope)
    {
        return AXIS2_FAILURE;
    }

    out_header = axiom_soap_header_create_with_parent(env, default_envelope);
    if(!out_header)
    {
        return AXIS2_FAILURE;
    }

    out_body = axiom_soap_body_create_with_parent(env, default_envelope);
    if(!out_body)
    {
        return AXIS2_FAILURE;
    }

    out_node = axiom_soap_body_get_base_node(out_body, env);
    if(!out_node)
    {
        return AXIS2_FAILURE;
    }

    if(status != AXIS2_SUCCESS || is_fault)
    {
        /* something went wrong. set a SOAP Fault */
        const axis2_char_t *fault_value_str = "soapenv:Sender";
        const axis2_char_t *fault_reason_str = NULL;
        const axis2_char_t *err_msg = NULL;

        if(!skel_invoked)
        {
            if(axis2_msg_ctx_get_is_soap_11(msg_ctx, env))
            {
fault_value_str            =
            AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":"
            AXIOM_SOAP11_FAULT_CODE_RECEIVER;
        }
        else
        {
            fault_value_str =
            AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":"
            AXIOM_SOAP12_SOAP_FAULT_VALUE_RECEIVER;
        }
    }

    err_msg = AXIS2_ERROR_GET_MESSAGE(env->error);
    if (err_msg && axutil_strcmp(err_msg, ""))
    {
        if(!axutil_strcmp(err_msg, "No Error"))
        {
            fault_reason_str = "An error has occurred, but could not determine exact details";
        }
        else
        {
            fault_reason_str = err_msg;
        }
    }
    else
    {
        fault_reason_str = "An error has occurred, but could not determine exact details";
    }

    soap_fault = axiom_soap_fault_create_default_fault(env, out_body, fault_value_str,
        fault_reason_str, soap_version);

    if (fault_node)
    {
        axiom_node_t *fault_detail_node = NULL;
        axis2_char_t *om_str = NULL;

        fault_detail = axiom_soap_fault_detail_create_with_parent(env, soap_fault);
        fault_detail_node = axiom_soap_fault_detail_get_base_node(fault_detail, env);

        om_str = axiom_node_to_string(fault_detail_node, env);
        if (om_str)
        {
            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "fault_detail:%s", om_str);
            AXIS2_FREE(env->allocator, om_str);
        }

        axiom_soap_fault_detail_add_detail_entry(fault_detail, env, fault_node);
    }
}

if (body_content_node)
{
    axiom_node_add_child(out_node, env, body_content_node);
    status = axis2_msg_ctx_set_soap_envelope(new_msg_ctx, env, default_envelope);
}
else if (soap_fault)
{
    axis2_msg_ctx_set_soap_envelope(new_msg_ctx, env, default_envelope);
    status = AXIS2_SUCCESS;
}
else
{
    /* we should free the memory as the envelope is not used, one way case */
    axiom_soap_envelope_free(default_envelope, env);
    default_envelope = NULL;
}

AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
    "[axis2]Exit:axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync");

return status;
}
예제 #8
0
AXIS2_EXTERN axis2_svc_grp_ctx_t *AXIS2_CALL
axis2_conf_ctx_fill_ctxs(
    axis2_conf_ctx_t * conf_ctx,
    const axutil_env_t * env,
    axis2_msg_ctx_t * msg_ctx)
{
    axis2_char_t *svc_grp_ctx_id = NULL;
    axis2_svc_grp_ctx_t *svc_grp_ctx = NULL;
    axis2_svc_ctx_t *svc_ctx = NULL;
    axis2_svc_t *svc = NULL;
    axis2_svc_grp_t *svc_grp = NULL;
    const axutil_qname_t *qname = NULL;
    axis2_char_t *svc_id = NULL;
    axis2_op_ctx_t *op_ctx = NULL;

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

    svc = axis2_msg_ctx_get_svc(msg_ctx, env);
    if(!svc)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SERVICE_NOT_YET_FOUND, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
            "Service not yet found in message context. Cannot proceed");

        return NULL;
    }

    qname = axis2_svc_get_qname(svc, env);
    if(!qname)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Service found in message context has no name.");
        return NULL;
    }

    svc_id = axutil_qname_get_localpart(qname, env);
    if(!svc_id)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Service found in message context has no name.");
        return NULL;
    }

    svc_grp = axis2_svc_get_parent(svc, env);
    if(svc_grp)
    {
        svc_grp_ctx_id = (axis2_char_t *)axis2_svc_grp_get_name(svc_grp, env);
    }

    if(!svc_grp_ctx_id)
    {
        svc_grp_ctx_id = (axis2_char_t *)axutil_string_get_buffer(axis2_msg_ctx_get_svc_grp_ctx_id(
            msg_ctx, env), env);
    }

    /* By this time service group context id must have a value, either from transport or from 
     * addressing 
     */
    if(svc_grp_ctx_id)
    {
        svc_grp_ctx = (axis2_svc_grp_ctx_t *)axutil_hash_get(conf_ctx->svc_grp_ctx_map,
            svc_grp_ctx_id, AXIS2_HASH_KEY_STRING);

        if(svc_grp_ctx)
        {
            svc_ctx = axis2_svc_grp_ctx_get_svc_ctx(svc_grp_ctx, env, svc_id);
            if(!svc_ctx)
            {
                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC_GRP, AXIS2_FAILURE);
                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                    "Service group context has no servie context set for service %s", svc_id);

                return NULL;
            }
        }
    }

    if(!svc_grp_ctx_id)
    {
        svc_grp_ctx_id = axutil_uuid_gen(env);
        if(svc_grp_ctx_id)
        {
            axutil_string_t *svc_grp_ctx_id_str = axutil_string_create_assume_ownership(env,
                &svc_grp_ctx_id);

            axis2_msg_ctx_set_svc_grp_ctx_id(msg_ctx, env, svc_grp_ctx_id_str);
            axutil_string_free(svc_grp_ctx_id_str, env);
        }
    }

    if(!svc_grp_ctx)
    {
        axis2_svc_grp_t *svc_group;
        svc_group = axis2_svc_get_parent(svc, env);
        svc_grp_ctx = axis2_svc_grp_get_svc_grp_ctx(svc_group, env, conf_ctx);
        svc_ctx = axis2_svc_grp_ctx_get_svc_ctx(svc_grp_ctx, env, svc_id);
        if(!svc_ctx)
        {
            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC_GRP, AXIS2_FAILURE);
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                "Service group context has no servie context set for service %s", svc_id);

            return NULL;
        }

        axis2_svc_grp_ctx_set_id(svc_grp_ctx, env, svc_grp_ctx_id);
        axis2_conf_ctx_register_svc_grp_ctx(conf_ctx, env, svc_grp_ctx_id, svc_grp_ctx);
    }

    /* When you come here operation context MUST have already been assigned
     to the message context */
    op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
    if(!op_ctx)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_MSG_CTX, AXIS2_FAILURE);
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Operation context not set for message context");
        return NULL;
    }

    axis2_op_ctx_set_parent(op_ctx, env, svc_ctx);
    axis2_msg_ctx_set_svc_ctx(msg_ctx, env, svc_ctx);
    axis2_msg_ctx_set_svc_grp_ctx(msg_ctx, env, svc_grp_ctx);
    return svc_grp_ctx;
}
static axis2_status_t AXIS2_CALL 
sandesha2_ack_req_msg_processor_process_in_msg (
    sandesha2_msg_processor_t *msg_processor,
    const axutil_env_t *env,
    sandesha2_msg_ctx_t *rm_msg_ctx)
{
    sandesha2_ack_requested_t *ack_requested = NULL;
    axis2_msg_ctx_t *msg_ctx = NULL;
    axis2_char_t *seq_id = NULL;
    axis2_conf_ctx_t *conf_ctx = NULL;
    sandesha2_storage_mgr_t *storage_mgr = NULL;
    sandesha2_seq_property_mgr_t *seq_prop_mgr = NULL;
    sandesha2_seq_property_bean_t *acks_to_bean = NULL;
    axis2_endpoint_ref_t *acks_to = NULL;
    axis2_char_t *acks_to_str = NULL;
    axis2_op_t *ack_op = NULL;
    axis2_op_t *rm_msg_op = NULL;
    axis2_msg_ctx_t *ack_msg_ctx = NULL;
    axutil_property_t *property = NULL;
    sandesha2_msg_ctx_t *ack_rm_msg = NULL;
    axiom_soap_envelope_t *envelope = NULL;
    axis2_char_t *wsa_version = NULL;
    axis2_char_t *dbname = NULL;
    
    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
        "[sandesha2]Entry:sandesha2_ack_req_msg_processor_process_in_msg");
    AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
    
    ack_requested = sandesha2_msg_ctx_get_ack_requested(rm_msg_ctx, env);
    if(!ack_requested)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
            "[sandesha2]Ack requested part is missing");
        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_REQD_MSG_PART_MISSING,
            AXIS2_FAILURE);
        return AXIS2_FAILURE;
    }
    sandesha2_ack_requested_set_must_understand(ack_requested, env, AXIS2_FALSE);
    sandesha2_msg_ctx_add_soap_envelope(rm_msg_ctx, env);
    
    msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
    seq_id = sandesha2_identifier_get_identifier(
        sandesha2_ack_requested_get_identifier(ack_requested, env), env);
    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
    dbname = sandesha2_util_get_dbname(env, conf_ctx);
    storage_mgr = sandesha2_utils_get_storage_mgr(env, dbname);
    if(!storage_mgr)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Could not create storage manager.");
        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_COULD_NOT_CREATE_STORAGE_MANAGER, 
                AXIS2_FAILURE);
        return AXIS2_FAILURE;
    }
    seq_prop_mgr = sandesha2_permanent_seq_property_mgr_create(env, dbname);
    acks_to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, seq_id,
        SANDESHA2_SEQ_PROP_ACKS_TO_EPR);
    acks_to_str = sandesha2_seq_property_bean_get_value(acks_to_bean, env);
    
    if(!acks_to_str)
    {
        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]acks_to_str"\
            " seqeunce property is not set correctly");
        if(seq_prop_mgr)
            sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
        if(storage_mgr)
            sandesha2_storage_mgr_free(storage_mgr, env);
        return AXIS2_FAILURE;
    }
    acks_to = axis2_endpoint_ref_create(env, acks_to_str);
    ack_op = axis2_op_create(env);
    axis2_op_set_msg_exchange_pattern(ack_op, env, AXIS2_MEP_URI_IN_ONLY);
    rm_msg_op = axis2_msg_ctx_get_op(msg_ctx, env);
    if(rm_msg_op)
    {
        axutil_array_list_t *out_flow = NULL;
        axutil_array_list_t *new_out_flow = NULL;
        axutil_array_list_t *out_fault_flow = NULL;
        axutil_array_list_t *new_out_fault_flow = NULL;
        out_flow = axis2_op_get_out_flow(rm_msg_op, env);
        new_out_flow = axis2_phases_info_copy_flow(env, out_flow);
        out_fault_flow = axis2_op_get_out_flow(rm_msg_op, env);
        new_out_fault_flow = axis2_phases_info_copy_flow(env, out_fault_flow);
        if(new_out_flow)
            axis2_op_set_out_flow(ack_op, env, new_out_flow);
        if(new_out_fault_flow)
            axis2_op_set_fault_out_flow(ack_op, env, new_out_fault_flow);
    }

    ack_msg_ctx = sandesha2_utils_create_new_related_msg_ctx(env, rm_msg_ctx);

    property = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
    axis2_msg_ctx_set_property(ack_msg_ctx, env, 
        SANDESHA2_APPLICATION_PROCESSING_DONE, property);
    ack_rm_msg = sandesha2_msg_init_init_msg(env, ack_msg_ctx);
    sandesha2_msg_ctx_set_rm_ns_val(ack_rm_msg, env, 
        sandesha2_msg_ctx_get_rm_ns_val(rm_msg_ctx, env));
    axis2_msg_ctx_set_message_id(ack_msg_ctx, env, axutil_uuid_gen(env));
    
    envelope = axiom_soap_envelope_create_default_soap_envelope(env, 
        sandesha2_utils_get_soap_version(env, 
        axis2_msg_ctx_get_soap_envelope(msg_ctx, env)));
    axis2_msg_ctx_set_soap_envelope(ack_msg_ctx, env, envelope);
    axis2_msg_ctx_set_to(ack_msg_ctx, env, acks_to);
    axis2_msg_ctx_set_reply_to(ack_msg_ctx, env, axis2_msg_ctx_get_to(msg_ctx, 
        env));
    sandesha2_msg_creator_add_ack_msg(env, ack_rm_msg, seq_id, seq_prop_mgr);
    axis2_msg_ctx_set_server_side(ack_msg_ctx, env, AXIS2_TRUE);
    
    property = axis2_msg_ctx_get_property(msg_ctx, env, AXIS2_WSA_VERSION);
    if(property)
        wsa_version = axutil_property_get_value(property, env);
    
    property = axutil_property_create_with_args(env, 0, 0, 0, wsa_version);
    if(property)
    {
        axis2_msg_ctx_set_property(ack_msg_ctx, env, AXIS2_WSA_VERSION, property);
        property = NULL;
    }
    
    if(sandesha2_utils_is_anon_uri(env, acks_to_str))
    {
        axis2_engine_t *engine = NULL;
        axis2_op_ctx_t *op_ctx = NULL;
        
        if(!axis2_msg_ctx_get_op(msg_ctx, env))
        {
            axis2_op_t *operation = NULL;
            axis2_op_ctx_t *op_ctx = NULL;
            
            operation = axis2_op_create(env);
            axis2_op_set_msg_exchange_pattern(operation, env, 
                AXIS2_MEP_URI_IN_OUT);
            op_ctx = axis2_op_ctx_create(env, operation, NULL);
            axis2_msg_ctx_set_op(msg_ctx, env, operation);
            axis2_msg_ctx_set_op_ctx(msg_ctx, env, op_ctx);            
        }
        op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
        axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
        
        property = axutil_property_create_with_args(env, 0, 0, 0, 
            AXIS2_VALUE_TRUE);
        axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_ACK_WRITTEN, 
            property);
        
        engine = axis2_engine_create(env, conf_ctx);
        if(AXIS2_FAILURE == axis2_engine_send(engine, env, ack_msg_ctx))
        {
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
                "[sandesha2]ack sending failed");
            AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SENDING_ACK, 
                AXIS2_FAILURE);
            if(engine)
            {
                axis2_engine_free(engine, env);
                engine = NULL;
            }
            if(seq_prop_mgr)
                sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
            if(storage_mgr)
                sandesha2_storage_mgr_free(storage_mgr, env);
            return AXIS2_FAILURE;
        }        
        if(engine)
        {
            axis2_engine_free(engine, env);
            engine = NULL;
        }
    }
    else
    {
        sandesha2_sender_mgr_t *sender_mgr = NULL;
        axis2_char_t *key = NULL;
        sandesha2_sender_bean_t *ack_bean = NULL;
        sandesha2_sender_bean_t *find_bean = NULL;
        sandesha2_property_bean_t *prop_bean = NULL;
        long ack_interval = 0;
        long time_to_send = 0;
        axutil_array_list_t *found_list = NULL;
        axis2_msg_ctx_t *msg_ctx = NULL;
        axis2_engine_t *engine = NULL;
        axis2_transport_out_desc_t *transport_out = NULL;
        axis2_svc_t *svc = NULL;
        
        sender_mgr = sandesha2_permanent_sender_mgr_create(env, dbname);
        key = axutil_uuid_gen(env);
        ack_bean = sandesha2_sender_bean_create(env);
        sandesha2_sender_bean_set_msg_ctx_ref_key(ack_bean, env, key);
        sandesha2_sender_bean_set_msg_id(ack_bean, env, 
            (axis2_char_t*)axis2_msg_ctx_get_msg_id(ack_msg_ctx, env));
        sandesha2_sender_bean_set_resend(ack_bean, env, AXIS2_FALSE);
        sandesha2_sender_bean_set_seq_id(ack_bean, env, seq_id);
        sandesha2_sender_bean_set_send(ack_bean, env, AXIS2_TRUE);
        sandesha2_sender_bean_set_msg_type(ack_bean, env, SANDESHA2_MSG_TYPE_ACK);
                        
        property = axutil_property_create_with_args(env, 0, 0, 0, 
            AXIS2_VALUE_FALSE);
        axis2_msg_ctx_set_property(ack_msg_ctx, env, 
            SANDESHA2_QUALIFIED_FOR_SENDING, property);
        
        /* Avoid retrieving property bean from operation until it is availbale */
        /*prop_bean = sandesha2_utils_get_property_bean_from_op(env, 
            axis2_msg_ctx_get_op(msg_ctx, env));*/
    
        svc = axis2_msg_ctx_get_svc(ack_msg_ctx, env);
        if(!svc)
        {
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                "[sandesha2][ack_req_msg_processor.c] service is NULL");
            return AXIS2_FAILURE;
        }

        prop_bean = sandesha2_utils_get_property_bean(env, svc);
        if(!prop_bean)
        {
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                "[sandesha2][ack_req_msg_processor.c] Property bean is NULL");
            return AXIS2_FAILURE;
        }

        /*prop_bean = sandesha2_utils_get_property_bean(env, 
            axis2_conf_ctx_get_conf(conf_ctx, env));*/
        prop_bean = sandesha2_utils_get_property_bean(env, svc);    
        ack_interval = sandesha2_property_bean_get_ack_interval(prop_bean, env);
        time_to_send = sandesha2_utils_get_current_time_in_millis(env) +
            ack_interval;
                        
        find_bean = sandesha2_sender_bean_create(env);
        sandesha2_sender_bean_set_resend(find_bean, env, AXIS2_FALSE);
        sandesha2_sender_bean_set_send(find_bean, env, AXIS2_TRUE);
        sandesha2_sender_bean_set_msg_type(find_bean, env, 
            SANDESHA2_MSG_TYPE_ACK);
                        
        found_list = sandesha2_sender_mgr_find_by_sender_bean(sender_mgr, env, 
            find_bean);
        if(find_bean)
            sandesha2_sender_bean_free(find_bean, env);
        if(found_list)
        {
            int i = 0;
            for(i = 0; i < axutil_array_list_size(found_list, env); i++)
            {
                axis2_char_t *msg_stored_key = NULL;
                sandesha2_sender_bean_t *old_ack_bean = NULL;
                old_ack_bean = axutil_array_list_get(found_list, env, i);
                time_to_send = sandesha2_sender_bean_get_time_to_send(
                    old_ack_bean, env);
                /*char *msg_id = sandesha2_sender_bean_get_msg_id(old_ack_bean, env);*/
                sandesha2_sender_mgr_remove(sender_mgr, env, 
                    sandesha2_sender_bean_get_msg_id(old_ack_bean, env));
                /* Removing the message from the storage */
                msg_stored_key = sandesha2_sender_bean_get_msg_ctx_ref_key(
                    old_ack_bean, env);
                sandesha2_storage_mgr_remove_msg_ctx(storage_mgr, env, 
                    msg_stored_key, conf_ctx, -1);
            }
        }
        sandesha2_sender_bean_set_time_to_send(ack_bean, env, time_to_send); 
        /*axis2_msg_ctx_set_keep_alive(ack_msg_ctx, env, AXIS2_TRUE);*/
        sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, key, ack_msg_ctx, AXIS2_FALSE);
        sandesha2_sender_mgr_insert(sender_mgr, env, ack_bean);
        
        transport_out = axis2_msg_ctx_get_transport_out_desc(ack_msg_ctx, env);
        property = axutil_property_create_with_args(env, 0, 0,
            axis2_transport_out_desc_free_void_arg, transport_out);
        axis2_msg_ctx_set_property(ack_msg_ctx, env, 
            SANDESHA2_ORIGINAL_TRANSPORT_OUT_DESC, property);
        
        property = axutil_property_create_with_args(env, 0, 0, 0, 
            AXIS2_VALUE_TRUE);
        axis2_msg_ctx_set_property(ack_msg_ctx, env, 
            SANDESHA2_SET_SEND_TO_TRUE, property);
        
        property = axutil_property_create_with_args(env, 0, 0, 0, key);
        axis2_msg_ctx_set_property(ack_msg_ctx, env, 
            SANDESHA2_MESSAGE_STORE_KEY, property);
                        
        axis2_msg_ctx_set_transport_out_desc(ack_msg_ctx, env, 
            sandesha2_utils_get_transport_out(env));
        engine = axis2_engine_create(env, conf_ctx);
        if(AXIS2_FAILURE == axis2_engine_send(engine, env, ack_msg_ctx))
        {
            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
                "[sandesha2]ack sending failed");
            AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SENDING_ACK, 
                AXIS2_FAILURE);
            if(engine)
                axis2_engine_free(engine, env);
            if(seq_prop_mgr)
                sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
            if(sender_mgr)
                sandesha2_sender_mgr_free(sender_mgr, env);
            if(storage_mgr)
                sandesha2_storage_mgr_free(storage_mgr, env);
            return AXIS2_FAILURE;
        }
        if(engine)
            axis2_engine_free(engine, env);
        sandesha2_utils_start_sender_for_seq(env, conf_ctx, seq_id, AXIS2_FALSE);
        axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
        if(sender_mgr)
            sandesha2_sender_mgr_free(sender_mgr, env);
    }
    if(seq_prop_mgr)
        sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
    if(storage_mgr)
        sandesha2_storage_mgr_free(storage_mgr, env);
    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
        "[sandesha2]Exit:sandesha2_ack_req_msg_processor_process_in_msg");
    return AXIS2_SUCCESS;
}