You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by da...@apache.org on 2008/08/29 08:56:38 UTC

svn commit: r690127 [8/11] - in /webservices/sandesha/trunk/c: ./ build/win32/ config/ ides/vc8/sandesha2/sandesha2/ include/ include/sandesha2/ samples/ samples/RMSampleService/ samples/rm_echo_1_0/ samples/rm_echo_1_0_large_sequence/ samples/rm_echo_...

Modified: webservices/sandesha/trunk/c/src/util/ack_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/ack_mgr.c?rev=690127&r1=690126&r2=690127&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/ack_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/util/ack_mgr.c Thu Aug 28 23:56:29 2008
@@ -45,95 +45,72 @@
 {
     axis2_msg_ctx_t *ref_msg = NULL;
     axis2_conf_ctx_t *conf_ctx = 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 *ref_op = NULL;
+
+    axis2_endpoint_ref_t *to = NULL;
+    axis2_endpoint_ref_t *temp_to = 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 *soap_env = NULL;
+    /*axiom_soap_envelope_t *soap_env = NULL;*/
     axis2_op_ctx_t *op_ctx = NULL;
+    axis2_char_t *uuid = NULL;
     
     AXIS2_PARAM_CHECK(env->error, seq_id, NULL);
     AXIS2_PARAM_CHECK(env->error, seq_prop_mgr, NULL);
     
     ref_msg = sandesha2_msg_ctx_get_msg_ctx(ref_rm_msg, env);
     conf_ctx = axis2_msg_ctx_get_conf_ctx(ref_msg, env);
-    acks_to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
-        seq_id, SANDESHA2_SEQ_PROP_ACKS_TO_EPR);
-    if(acks_to_bean)
-    {
-        acks_to = axis2_endpoint_ref_create(env, 
-            sandesha2_seq_property_bean_get_value(acks_to_bean, 
-                env));
-        sandesha2_seq_property_bean_free(acks_to_bean, env);
-    }
-    if(acks_to)
-        acks_to_str = (axis2_char_t*)axis2_endpoint_ref_get_address(acks_to, env);
-    if(!acks_to_str)
+   
+    temp_to = axis2_msg_ctx_get_reply_to(ref_msg, env);
+    if(temp_to)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Invalid epr");
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_EPR, AXIS2_FAILURE);
-        return NULL;
+        to = axis2_endpoint_ref_create(env, axis2_endpoint_ref_get_address(temp_to, env));
     }
-    /*ack_op = axis2_op_create(env);
-    axis2_op_set_msg_exchange_pattern(ack_op, env, AXIS2_MEP_URI_OUT_ONLY);*/
-    ref_op = axis2_msg_ctx_get_op(ref_msg, env);
-    /*if(ref_op)
-    {
-        axutil_array_list_t *out_flow = NULL;
-        axutil_array_list_t *out_fault_flow = NULL;
-        axutil_array_list_t *new_out_flow = NULL;
-        axutil_array_list_t *new_out_fault_flow = NULL;
-        out_flow = axis2_op_get_out_flow(ref_op, env);
-        new_out_flow = axis2_phases_info_copy_flow(env, out_flow);
-        out_fault_flow = axis2_op_get_fault_out_flow(ref_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);
-    }*/
+    if(!to)
+    {
+        sandesha2_seq_property_bean_t *acks_to_bean = NULL;
+        axis2_char_t *acks_to_str = NULL;
 
-    ack_msg_ctx = sandesha2_utils_create_new_related_msg_ctx(env, ref_rm_msg, ref_op);
+        acks_to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
+            seq_id, SANDESHA2_SEQ_PROP_ACKS_TO_EPR);
+        if(acks_to_bean)
+        {
+            acks_to_str = sandesha2_seq_property_bean_get_value(acks_to_bean, env);
+            to = axis2_endpoint_ref_create(env, acks_to_str);
+            sandesha2_seq_property_bean_free(acks_to_bean, env);
+        }
+    }
 
-    /*op_ctx = axis2_msg_ctx_get_op_ctx(ref_msg, env);
-    axis2_msg_ctx_set_op_ctx(ack_msg_ctx, env, op_ctx);*/
-    
+    ack_msg_ctx = sandesha2_utils_create_new_related_msg_ctx(env, ref_rm_msg);
     property = axutil_property_create_with_args(env, AXIS2_SCOPE_REQUEST, 
         AXIS2_FALSE, 0, AXIS2_VALUE_TRUE);
     if(property)
     {
-        axis2_msg_ctx_set_property(ack_msg_ctx, env, 
-            SANDESHA2_APPLICATION_PROCESSING_DONE, property);
+        axis2_msg_ctx_set_property(ack_msg_ctx, env, SANDESHA2_APPLICATION_PROCESSING_DONE, property);
         property = NULL;
     }
 
     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(ref_rm_msg, env));
-    axis2_msg_ctx_set_wsa_message_id(ack_msg_ctx, env, axutil_uuid_gen(env));
-    soap_env = axiom_soap_envelope_create_default_soap_envelope(env, 
-        sandesha2_utils_get_soap_version(env, 
-        axis2_msg_ctx_get_soap_envelope(ref_msg, env)));
-    axis2_msg_ctx_set_soap_envelope(ack_msg_ctx, env, soap_env);
-    axis2_msg_ctx_set_to(ack_msg_ctx, env, acks_to);
+
+    uuid = axutil_uuid_gen(env);
+    if(uuid)
+    {
+        axis2_msg_ctx_set_wsa_message_id(ack_msg_ctx, env, uuid);
+        AXIS2_FREE(env->allocator, uuid);
+    }
+
+    /*soap_env = axiom_soap_envelope_create_default_soap_envelope(env, 
+     * sandesha2_utils_get_soap_version(env, axis2_msg_ctx_get_soap_envelope(ref_msg, env)));
+    axis2_msg_ctx_set_soap_envelope(ack_msg_ctx, env, soap_env);*/
+
+    axis2_msg_ctx_set_to(ack_msg_ctx, env, to);
 
     /* Adding the sequence acknowledgement part */
     sandesha2_msg_creator_add_ack_msg(env, ack_rm_msg, seq_id, seq_prop_mgr);
     axis2_msg_ctx_set_property(ack_msg_ctx, env, AXIS2_TRANSPORT_IN, NULL);
-
-    /*if(!op_ctx)
-    {
-        axis2_op_t *op = axis2_op_create(env);
-        axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_IN_OUT);
-        op_ctx = axis2_op_ctx_create(env, op, NULL);
-        axis2_msg_ctx_set_op(ref_msg, env, op);
-        axis2_msg_ctx_set_op_ctx(ref_msg, env, op_ctx);            
-    }*/
-
+    
     op_ctx = axis2_msg_ctx_get_op_ctx(ref_msg, env);
     axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
     
@@ -141,12 +118,13 @@
         AXIS2_FALSE, 0, AXIS2_VALUE_TRUE);
     axis2_msg_ctx_set_property(ref_msg, env, SANDESHA2_ACK_WRITTEN, property);
     axis2_msg_ctx_set_server_side(ack_msg_ctx, env, AXIS2_TRUE);
+
     return ack_rm_msg;
 }
 
 /**
  * This is used to get the acked messages of a sequence. If this is an outgoing 
- * message the sequence_identifier should be the internal sequenceID.
+ * message the sequence_identifier should be the outgoing sequenceID.
  * 
  * @param sequence_identifier
  * @param out_going_msg
@@ -155,7 +133,7 @@
 AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
 sandesha2_ack_mgr_get_client_completed_msgs_list(
         const axutil_env_t *env,
-        axis2_char_t *seq_id,
+        axis2_char_t *rms_seq_id,
         sandesha2_seq_property_mgr_t *seq_prop_mgr)
 {
     sandesha2_seq_property_bean_t *internal_seq_bean = NULL;
@@ -165,7 +143,7 @@
     
     /* First trying to get it from the internal sequence id.*/
     internal_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
-            seq_id, SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID);
+            rms_seq_id, SANDESHA2_SEQUENCE_PROPERTY_RMS_INTERNAL_SEQ_ID);
     if(internal_seq_bean != NULL)
     {
         internal_seq_id = sandesha2_seq_property_bean_get_value(
@@ -180,7 +158,7 @@
     if(completed_msgs_bean == NULL)
     {
         completed_msgs_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, 
-                env, seq_id, 
+                env, rms_seq_id, 
                 SANDESHA2_SEQ_PROP_CLIENT_COMPLETED_MESSAGES);
     }
     if(completed_msgs_bean != NULL)
@@ -203,14 +181,14 @@
 AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
 sandesha2_ack_mgr_get_svr_completed_msgs_list(
     const axutil_env_t *env,
-    axis2_char_t *seq_id,
+    axis2_char_t *rmd_seq_id,
     sandesha2_seq_property_mgr_t *seq_prop_mgr)
 {
     sandesha2_seq_property_bean_t *completed_msgs_bean = NULL;
     axutil_array_list_t *completed_msg_list = NULL;
     
     completed_msgs_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, 
-        env, seq_id, 
+        env, rmd_seq_id, 
         SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES);
     if(completed_msgs_bean)
     {
@@ -255,23 +233,32 @@
     while(AXIS2_TRUE)
     {
         sandesha2_ack_range_t *ack_range = NULL;
+		long upper_value = -1;
+
         sprintf(tmp, "%ld", start);
         ack_range = axutil_hash_get(hash, tmp, AXIS2_HASH_KEY_STRING);
         
+        
         if(!ack_range)
         {
             break;
         }
-        if(sandesha2_ack_range_get_upper_value(ack_range, env) >= last_msg_no)
+        upper_value = sandesha2_ack_range_get_upper_value(ack_range, env);
+        if(upper_value >= last_msg_no)
         {
             if(hash)
+            {
                 axutil_hash_free(hash, env);
+            }
             return AXIS2_TRUE;
         }
         start = sandesha2_ack_range_get_upper_value(ack_range, env) + 1;        
     }
+
     if(hash)
+    {
         axutil_hash_free(hash, env);
+    }
     return AXIS2_FALSE;
 }
 
@@ -279,7 +266,8 @@
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 sandesha2_ack_mgr_piggyback_acks_if_present(
     const axutil_env_t *env,
-    sandesha2_msg_ctx_t *rm_msg_ctx,
+    axis2_char_t *seq_id,
+    sandesha2_msg_ctx_t *target_rm_msg_ctx,
     sandesha2_storage_mgr_t *storage_mgr,
     sandesha2_seq_property_mgr_t *seq_prop_mgr,
     sandesha2_sender_mgr_t *sender_mgr)
@@ -287,76 +275,158 @@
     axis2_conf_ctx_t *conf_ctx = NULL;
     sandesha2_sender_bean_t *find_bean = NULL;
     axis2_char_t *to_str = NULL;
-    axis2_msg_ctx_t *msg_ctx = NULL;
-    axis2_endpoint_ref_t *to = NULL;
+    axis2_msg_ctx_t *target_msg_ctx = NULL;
+    axis2_endpoint_ref_t *to_epr = NULL;
     axutil_array_list_t *found_list = NULL;
-    int i = 0;
     
-    AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, target_rm_msg_ctx, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, storage_mgr, AXIS2_FAILURE);
     
-    msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
-    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-    
+    target_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(target_rm_msg_ctx, env);
+    conf_ctx = axis2_msg_ctx_get_conf_ctx(target_msg_ctx, env);
+
     find_bean = sandesha2_sender_bean_create(env);
     sandesha2_sender_bean_set_msg_type(find_bean, env, SANDESHA2_MSG_TYPE_ACK);
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "dam_seq_id:%s", seq_id);
+    sandesha2_sender_bean_set_seq_id(find_bean, env, seq_id);
     sandesha2_sender_bean_set_send(find_bean, env, AXIS2_TRUE);
     sandesha2_sender_bean_set_resend(find_bean, env, AXIS2_FALSE);
 
-    to = sandesha2_msg_ctx_get_to(rm_msg_ctx, env);
-    if(to)
-        to_str = (axis2_char_t*)axis2_endpoint_ref_get_address(to, env);
+    to_epr = sandesha2_msg_ctx_get_to(target_rm_msg_ctx, env);
+    if(to_epr)
+    {
+        to_str = (axis2_char_t*)axis2_endpoint_ref_get_address(to_epr, env);
+    }
                         
-    found_list = sandesha2_sender_mgr_find_by_sender_bean(sender_mgr, env, 
-        find_bean);
+    found_list = sandesha2_sender_mgr_find_by_sender_bean(sender_mgr, env, find_bean);
     if(find_bean)
+    {
         sandesha2_sender_bean_free(find_bean, env);
-    for(i = 0; i < axutil_array_list_size(found_list, env); i++)
+    }
+
+    if(found_list)
     {
-        sandesha2_sender_bean_t *sender_bean = NULL;
-        long timenow = 0;
-        
-        timenow = sandesha2_utils_get_current_time_in_millis(env);
-        sender_bean = axutil_array_list_get(found_list, env, i);
-        
-        if(sandesha2_sender_bean_get_time_to_send(sender_bean, env) > timenow)
+        int i = 0, j = 0, size = 0;
+
+        size = axutil_array_list_size(found_list, env);
+        for(i = 0; i < size; i++)
         {
-            axis2_msg_ctx_t *msg_ctx1 = NULL;
-            axis2_char_t *to = NULL;
-            sandesha2_msg_ctx_t *ack_rm_msg = NULL;
-            sandesha2_seq_ack_t *seq_ack = NULL;
-            axis2_char_t *msg_ctx_ref_key = NULL;
-            axis2_endpoint_ref_t *to_ref = NULL;
+            sandesha2_sender_bean_t *sender_bean = NULL;
+            long timenow = 0;
+            
+            timenow = sandesha2_utils_get_current_time_in_millis(env);
+            sender_bean = axutil_array_list_get(found_list, env, i);
             
-            msg_ctx_ref_key = sandesha2_sender_bean_get_msg_ctx_ref_key(
-                sender_bean, env);
-            msg_ctx1 = sandesha2_storage_mgr_retrieve_msg_ctx(storage_mgr, env,
-                msg_ctx_ref_key, conf_ctx, AXIS2_FALSE);
-            to_ref = axis2_msg_ctx_get_to(msg_ctx1, env);
-            if(to_ref)
-                to = (axis2_char_t*)axis2_endpoint_ref_get_address(to_ref, env);
-            else
-                continue;
-            if(0 == axutil_strcmp(to, to_str))
-                continue; 
-            sandesha2_sender_mgr_remove(sender_mgr, env, 
-                sandesha2_sender_bean_get_msg_id(sender_bean, env));
-            sandesha2_storage_mgr_remove_msg_ctx(storage_mgr, env, 
-                msg_ctx_ref_key, conf_ctx, -1);
-            ack_rm_msg = sandesha2_msg_init_init_msg(env, msg_ctx1);
-            if(SANDESHA2_MSG_TYPE_ACK != sandesha2_msg_ctx_get_msg_type(ack_rm_msg, 
-                env))
+            if(sender_bean && sandesha2_sender_bean_get_time_to_send(sender_bean, env) <= timenow)
             {
-                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Invalid"
-                    " ack message entry");
-                return AXIS2_FAILURE;
+                axis2_msg_ctx_t *ack_msg_ctx = NULL;
+                axis2_char_t *to = NULL;
+                sandesha2_msg_ctx_t *ack_rm_msg_ctx = NULL;
+                sandesha2_seq_ack_t *seq_ack = NULL;
+                axis2_char_t *msg_ctx_ref_key = NULL;
+                axis2_endpoint_ref_t *to_ref = NULL;
+                
+                msg_ctx_ref_key = sandesha2_sender_bean_get_msg_ctx_ref_key(sender_bean, env);
+                ack_msg_ctx = sandesha2_storage_mgr_retrieve_msg_ctx(storage_mgr, env, msg_ctx_ref_key, 
+                        conf_ctx, AXIS2_FALSE);
+
+                if(ack_msg_ctx)
+                {
+                    to_ref = axis2_msg_ctx_get_to(ack_msg_ctx, env);
+                }
+
+                if(to_ref)
+                {
+                    to = (axis2_char_t*)axis2_endpoint_ref_get_address(to_ref, env);
+                }
+                else
+                {
+                    if(ack_msg_ctx)
+                    {
+                        axis2_msg_ctx_free(ack_msg_ctx, env);
+                    }
+                
+                    sandesha2_sender_bean_free(sender_bean, env);
+                    continue;
+                }
+
+                if(axutil_strcmp(to, to_str))
+                {
+                    if(ack_msg_ctx)
+                    {
+                        axis2_msg_ctx_free(ack_msg_ctx, env);
+                    }
+                    
+                    sandesha2_sender_bean_free(sender_bean, env);
+                    continue; 
+                }
+
+                sandesha2_sender_mgr_remove(sender_mgr, env, sandesha2_sender_bean_get_msg_id(
+                            sender_bean, env));
+
+                sandesha2_storage_mgr_remove_msg_ctx(storage_mgr, env, msg_ctx_ref_key, conf_ctx, -1);
+                ack_rm_msg_ctx = sandesha2_msg_init_init_msg(env, ack_msg_ctx);
+
+                if(SANDESHA2_MSG_TYPE_ACK != sandesha2_msg_ctx_get_msg_type(ack_rm_msg_ctx, env))
+                {
+                    AXIS2_LOG_WARNING(env->log, AXIS2_LOG_SI, "[sandesha2] Invalid ack message entry");
+                    if(ack_msg_ctx)
+                    {
+                        axis2_msg_ctx_free(ack_msg_ctx, env);
+                    }
+
+                    if(ack_rm_msg_ctx)
+                    {
+                        sandesha2_msg_ctx_free(ack_rm_msg_ctx, env);
+                    }
+
+                    sandesha2_sender_bean_free(sender_bean, env);
+                    continue;
+                }
+
+                seq_ack = sandesha2_msg_ctx_get_seq_ack(ack_rm_msg_ctx, env);
+                /* When we set seq_ack to target rm message context taken from acknowledgment rm message 
+                 * context ,there happen freeing at both contexts if we do not increment ref.*/
+                sandesha2_seq_ack_increment_ref(seq_ack, env);
+                sandesha2_msg_ctx_set_seq_ack(target_rm_msg_ctx, env, seq_ack);
+                sandesha2_msg_ctx_add_soap_envelope(target_rm_msg_ctx, env);
+
+                if(ack_msg_ctx)
+                {
+                    axis2_msg_ctx_free(ack_msg_ctx, env);
+                }
+
+                if(ack_rm_msg_ctx)
+                {
+                    sandesha2_msg_ctx_free(ack_rm_msg_ctx, env);
+                }
+
+                sandesha2_sender_bean_free(sender_bean, env);
+                break;
+            }
+
+            for(j = i++; j < size; j++)
+            {
+                sandesha2_sender_bean_t *sender_bean = NULL;
+                
+                sender_bean = axutil_array_list_get(found_list, env, j);
+
+                if(sender_bean)
+                {
+                    sandesha2_sender_bean_free(sender_bean, env);
+                    sender_bean = NULL;
+                }
+            }
+
+            if(sender_bean)
+            {
+                sandesha2_sender_bean_free(sender_bean, env);
             }
-            seq_ack = sandesha2_msg_ctx_get_seq_ack(ack_rm_msg, env);
-            sandesha2_msg_ctx_set_seq_ack(rm_msg_ctx, env, seq_ack);
-            sandesha2_msg_ctx_add_soap_envelope(rm_msg_ctx, env);
-            break;
         }
+
+        axutil_array_list_free(found_list, env);
     }
+
     return AXIS2_SUCCESS;
 }
 

Modified: webservices/sandesha/trunk/c/src/util/fault_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/fault_mgr.c?rev=690127&r1=690126&r2=690127&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/fault_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/util/fault_mgr.c Thu Aug 28 23:56:29 2008
@@ -36,44 +36,50 @@
 sandesha2_msg_ctx_t* AXIS2_CALL 
 sandesha2_fault_mgr_check_for_create_seq_refused (
     const axutil_env_t *env,
-    axis2_msg_ctx_t *create_seq_msg,
+    sandesha2_msg_ctx_t *rm_create_seq_msg_ctx,
     sandesha2_seq_property_mgr_t *seq_prop_mgr)
 {
-    sandesha2_msg_ctx_t *rm_msg_ctx = NULL;
     sandesha2_create_seq_t *create_seq = NULL;
     axis2_bool_t refuse_seq = AXIS2_FALSE;
     
-    AXIS2_PARAM_CHECK(env->error, create_seq_msg, NULL);
+    AXIS2_PARAM_CHECK(env->error, rm_create_seq_msg_ctx, NULL);
     AXIS2_PARAM_CHECK(env->error, seq_prop_mgr, NULL);
     
-    rm_msg_ctx = sandesha2_msg_init_init_msg(env, create_seq_msg);
-    create_seq = sandesha2_msg_ctx_get_create_seq(rm_msg_ctx, env);
+    create_seq = sandesha2_msg_ctx_get_create_seq(rm_create_seq_msg_ctx, env);
     
-    if(NULL == create_seq)
+    if(!create_seq)
     {
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_REQD_MSG_PART_MISSING, 
-                        AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_REQD_MSG_PART_MISSING, AXIS2_FAILURE);
         return NULL;
     }
-    if(AXIS2_TRUE == refuse_seq)
+    if(refuse_seq)
     {
+        axiom_soap_envelope_t *soap_envelope = NULL;
         sandesha2_fault_data_t *fault_data = NULL;
+
         fault_data = sandesha2_fault_data_create(env);
         sandesha2_fault_data_set_type(fault_data, env, 
                         SANDESHA2_SOAP_FAULT_TYPE_CREATE_SEQ_REFUSED);
-        if(SANDESHA2_SOAP_VERSION_1_1 == sandesha2_utils_get_soap_version(env, 
-                        sandesha2_msg_ctx_get_soap_envelope(rm_msg_ctx, env)))
-            sandesha2_fault_data_set_code(fault_data, env, 
-                        AXIOM_SOAP11_FAULT_CODE_SENDER);
+
+        soap_envelope = sandesha2_msg_ctx_get_soap_envelope(rm_create_seq_msg_ctx, env);
+        if(SANDESHA2_SOAP_VERSION_1_1 == sandesha2_utils_get_soap_version(env, soap_envelope))
+        {
+            sandesha2_fault_data_set_code(fault_data, env, AXIOM_SOAP11_FAULT_CODE_SENDER);
+        }
         else
-            sandesha2_fault_data_set_code(fault_data, env, 
-                        AXIOM_SOAP12_FAULT_CODE_SENDER);
+        {
+            sandesha2_fault_data_set_code(fault_data, env, AXIOM_SOAP12_FAULT_CODE_SENDER);
+        }
+
         sandesha2_fault_data_set_sub_code(fault_data, env, 
-                        SANDESHA2_SOAP_FAULT_SUBCODE_CREATE_SEQ_REFUSED);
+                SANDESHA2_SOAP_FAULT_SUBCODE_CREATE_SEQ_REFUSED);
+
         sandesha2_fault_data_set_reason(fault_data, env, "");
-        return sandesha2_fault_mgr_get_fault(env, rm_msg_ctx, fault_data,
-            sandesha2_msg_ctx_get_addr_ns_val(rm_msg_ctx, env), seq_prop_mgr);
+
+        return sandesha2_fault_mgr_get_fault(env, rm_create_seq_msg_ctx, fault_data,
+            sandesha2_msg_ctx_get_addr_ns_val(rm_create_seq_msg_ctx, env), seq_prop_mgr);
     }
+
     return NULL;
 }
             
@@ -160,43 +166,56 @@
 {
     int type = -1;
     axis2_bool_t valid_seq = AXIS2_TRUE;
-    
+
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2] sandesha2_fault_mgr_check_for_unknown_seq");
+
     AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, NULL);
     AXIS2_PARAM_CHECK(env->error, seq_prop_mgr, NULL);
     AXIS2_PARAM_CHECK(env->error, create_seq_mgr, NULL);
     AXIS2_PARAM_CHECK(env->error, seq_id, NULL);
     
     type = sandesha2_msg_ctx_get_msg_type(rm_msg_ctx, env);
-    if(SANDESHA2_MSG_TYPE_ACK == type || 
-        SANDESHA2_MSG_TYPE_CREATE_SEQ_RESPONSE == type ||
-        SANDESHA2_MSG_TYPE_TERMINATE_SEQ_RESPONSE == type ||
+    if(SANDESHA2_MSG_TYPE_ACK == type || SANDESHA2_MSG_TYPE_CREATE_SEQ_RESPONSE == type ||
+        SANDESHA2_MSG_TYPE_TERMINATE_SEQ_RESPONSE == type || 
         SANDESHA2_MSG_TYPE_CLOSE_SEQ_RESPONSE == type)
     {
         sandesha2_create_seq_bean_t *find_bean = NULL;
         axutil_array_list_t *list = NULL;
+
         find_bean = sandesha2_create_seq_bean_create(env);
-        sandesha2_create_seq_bean_set_seq_id(find_bean, env, seq_id);
-        list = sandesha2_create_seq_mgr_find(create_seq_mgr, env, 
-                        find_bean);
+        sandesha2_create_seq_bean_set_rms_sequence_id(find_bean, env, seq_id);
+        list = sandesha2_create_seq_mgr_find(create_seq_mgr, env, find_bean);
         if(find_bean)
+        {
             sandesha2_create_seq_bean_free(find_bean, env);
+        }
+
         if(list)
         {
             int i = 0, size = 0;
             size = axutil_array_list_size(list, env);
             if(0 == size)
+            {
+                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Not a valid sequence message");
                 valid_seq = AXIS2_FALSE;
+            }
+
             for(i = 0; i < size; i++)
             {
-                sandesha2_create_seq_bean_t *create_seq_bean = 
-                    axutil_array_list_get(list, env, i);
+                sandesha2_create_seq_bean_t *create_seq_bean = axutil_array_list_get(list, env, i);
                 if(create_seq_bean)
+                {
                     sandesha2_create_seq_bean_free(create_seq_bean, env);
+                }
             }
+
             axutil_array_list_free(list, env);
         }
         else
+        {
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Not a valid sequence message");
             valid_seq = AXIS2_FALSE;        
+        }
     }
     else
     {
@@ -214,33 +233,50 @@
                 axis2_char_t *tmp_id = NULL;
                 
                 next_bean = axutil_array_list_get(list, env, i);
-                tmp_id = sandesha2_next_msg_bean_get_seq_id(
-                    next_bean, env);
+                tmp_id = sandesha2_next_msg_bean_get_seq_id(next_bean, env);
+                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] tmp_sequence_id:%s", tmp_id);
+                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] sequence_id:%s", seq_id);
                 if(contains)
                 {
                     if(next_bean)
+                    {
                         sandesha2_next_msg_bean_free(next_bean, env);
+                    }
+
                     continue;
                 }
-                if(0 == axutil_strcmp(seq_id, tmp_id))
+                if(!axutil_strcmp(seq_id, tmp_id))
                 {
                     if(next_bean)
+                    {
                         sandesha2_next_msg_bean_free(next_bean, env);
+                    }
+
                     contains = AXIS2_TRUE;
                 }
                 else
                 {
                     if(next_bean)
+                    {
                         sandesha2_next_msg_bean_free(next_bean, env);
+                    }
                 }
             }
+
             axutil_array_list_free(list, env);
         }
+
         if(contains)
+        {
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Not a valid sequence message");
             valid_seq = AXIS2_TRUE;
+        }
         else
+        {
             valid_seq = AXIS2_FALSE;
+        }
     }
+
     if(!valid_seq)
     {
         sandesha2_fault_data_t *fault_data = NULL;
@@ -253,25 +289,33 @@
         rm_ns_val = sandesha2_msg_ctx_get_rm_ns_val(rm_msg_ctx, env);
         if(SANDESHA2_SOAP_VERSION_1_1 == sandesha2_utils_get_soap_version(env, 
                         sandesha2_msg_ctx_get_soap_envelope(rm_msg_ctx, env)))
-            sandesha2_fault_data_set_code(fault_data, env, 
-                        AXIOM_SOAP11_FAULT_CODE_SENDER);
+        {
+            sandesha2_fault_data_set_code(fault_data, env, AXIOM_SOAP11_FAULT_CODE_SENDER);
+        }
         else
-            sandesha2_fault_data_set_code(fault_data, env, 
-                        AXIOM_SOAP12_FAULT_CODE_SENDER);
-        sandesha2_fault_data_set_sub_code(fault_data, env, 
-                        SANDESHA2_SOAP_FAULT_SUBCODE_UNKNOWN_SEQ);
+        {
+            sandesha2_fault_data_set_code(fault_data, env, AXIOM_SOAP12_FAULT_CODE_SENDER);
+        }
+
+        sandesha2_fault_data_set_sub_code(fault_data, env, SANDESHA2_SOAP_FAULT_SUBCODE_UNKNOWN_SEQ);
         qname = axutil_qname_create(env, SANDESHA2_WSRM_COMMON_IDENTIFIER,
                         rm_ns_val, SANDESHA2_WSRM_COMMON_NS_PREFIX_RM);
-        detail_ele = axiom_element_create_with_qname(env, NULL, qname, 
-                        &detail_node);
+        detail_ele = axiom_element_create_with_qname(env, NULL, qname, &detail_node);
         if(qname)
+        {
             axutil_qname_free(qname, env);
+        }
+
         sandesha2_fault_data_set_detail(fault_data, env, detail_node);
-        sandesha2_fault_data_set_reason(fault_data, env, "A sequence with the" \
-                        " given sequenceID has NOT been established");
+        sandesha2_fault_data_set_reason(fault_data, env, 
+                "A sequence with the given sequenceID has NOT been established");
+
         return sandesha2_fault_mgr_get_fault(env, rm_msg_ctx, fault_data,
             sandesha2_msg_ctx_get_addr_ns_val(rm_msg_ctx, env), seq_prop_mgr);
     }
+    
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2] sandesha2_fault_mgr_check_for_unknown_seq");
+
     return NULL;
 }
 

Modified: webservices/sandesha/trunk/c/src/util/msg_creator.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/msg_creator.c?rev=690127&r1=690126&r2=690127&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/msg_creator.c (original)
+++ webservices/sandesha/trunk/c/src/util/msg_creator.c Thu Aug 28 23:56:29 2008
@@ -67,10 +67,12 @@
 
 /**
  * Create a new create_seq_msg
+ * @param env
  * @param application_rm_msg
  * @param internal_seq_id
  * @param acks_to
- * @return
+ * @param seq_prop_mgr
+ * @return sandesha2_msg_ctx_t
  */
 sandesha2_msg_ctx_t *AXIS2_CALL
 sandesha2_msg_creator_create_create_seq_msg(
@@ -82,10 +84,8 @@
 {
     axis2_msg_ctx_t *application_msg_ctx = NULL;
     axis2_msg_ctx_t *create_seq_msg_ctx = NULL;
-    axis2_conf_ctx_t *ctx = NULL;
-    axis2_op_t *create_seq_op = NULL;
+    axis2_conf_ctx_t *conf_ctx = NULL;
     axis2_op_t *app_msg_op_desc = NULL;
-    /*axis2_op_ctx_t *create_seq_op_ctx = NULL;*/
     axis2_op_ctx_t *op_ctx = NULL;
     axis2_char_t *create_seq_msg_id = NULL;
     axis2_char_t *rm_version = NULL;
@@ -97,10 +97,8 @@
     axutil_string_t *temp_soap_action = NULL;
     axis2_endpoint_ref_t *to_epr = NULL;
     axis2_endpoint_ref_t *temp_to = NULL;
-    axis2_endpoint_ref_t *reply_to_epr = NULL;
     axis2_endpoint_ref_t *acks_to_epr = NULL;
     axis2_endpoint_ref_t *temp_reply_to = NULL;
-    axutil_qname_t *qname = NULL;
     sandesha2_create_seq_t *create_seq_part = NULL;
     sandesha2_seq_property_bean_t *reply_to_bean = NULL;
     sandesha2_seq_property_bean_t *to_bean = NULL;
@@ -108,80 +106,47 @@
     sandesha2_address_t *temp_address = NULL;
     sandesha2_acks_to_t *temp_acks_to = NULL;
     axutil_property_t *property = NULL;
+    const axis2_char_t *reply_to_address = NULL;
 
     application_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(application_rm_msg, env);
     if(!application_msg_ctx)
     {
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_APPLICATION_MSG_NULL, 
-                AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_APPLICATION_MSG_NULL, AXIS2_FAILURE);
         return NULL;
     }
-    ctx = axis2_msg_ctx_get_conf_ctx(application_msg_ctx, env);
-    if(!ctx)
+
+    conf_ctx = axis2_msg_ctx_get_conf_ctx(application_msg_ctx, env);
+    if(!conf_ctx)
     {
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CONF_CTX_NULL, AXIS2_FAILURE);
         return NULL;
     }
-    /* Creating by copying common contents. (This will not see contexts except
-     * for conf_ctx)
+
+    /* Creating by copying common contents.
      */
-    qname = axutil_qname_create(env, "CreateSequenceOperation", NULL, NULL);
-    create_seq_op = axis2_op_create_with_qname(env, qname);
-    if(qname)
-        axutil_qname_free(qname, env);
-
-    create_seq_msg_ctx = sandesha2_utils_create_new_related_msg_ctx(env, 
-            application_rm_msg, create_seq_op);
-    sandesha2_msg_creator_init_creation(env, application_msg_ctx, 
-            create_seq_msg_ctx);
-    /*create_seq_op_ctx = axis2_msg_ctx_get_op_ctx(create_seq_msg_ctx, env);*/
+    create_seq_msg_ctx = sandesha2_utils_create_new_related_msg_ctx(env, application_rm_msg);
+
+    sandesha2_msg_creator_init_creation(env, application_msg_ctx, create_seq_msg_ctx);
+
     create_seq_msg_id = axutil_uuid_gen(env);
     axis2_msg_ctx_set_message_id(create_seq_msg_ctx, env, create_seq_msg_id);
-    /*axutil_allocator_switch_to_global_pool(env->allocator);
-    axis2_conf_ctx_register_op_ctx(ctx, env, create_seq_msg_id, create_seq_op_ctx);
-    axutil_allocator_switch_to_local_pool(env->allocator);*/
+    AXIS2_FREE(env->allocator, create_seq_msg_id);
+
     app_msg_op_desc = axis2_msg_ctx_get_op(application_msg_ctx, env);
-    /*create_seq_op = axis2_msg_ctx_get_op(create_seq_msg_ctx, env);*/
-    if(app_msg_op_desc)
-    {
-        axutil_array_list_t *outflow = NULL;
-        axutil_array_list_t *out_fault_flow = NULL;
-        axutil_array_list_t *in_fault_flow = NULL;
-        axutil_array_list_t *inflow = NULL;
-        axutil_array_list_t *new_outflow = NULL;
-        axutil_array_list_t *new_out_fault_flow = NULL;
-        axutil_array_list_t *new_in_fault_flow = NULL;
-        axutil_array_list_t *new_inflow = NULL;
-
-        outflow = axis2_op_get_out_flow(app_msg_op_desc, env);
-        new_outflow = axis2_phases_info_copy_flow(env, outflow);
-        axis2_op_set_out_flow(create_seq_op, env, new_outflow);
-        out_fault_flow = axis2_op_get_fault_out_flow(app_msg_op_desc, env);
-        new_out_fault_flow = axis2_phases_info_copy_flow(env, out_fault_flow);
-        axis2_op_set_fault_out_flow(create_seq_op, env, new_out_fault_flow);
-        in_fault_flow = axis2_op_get_fault_in_flow(app_msg_op_desc, env);
-        new_in_fault_flow = axis2_phases_info_copy_flow(env, in_fault_flow);
-        axis2_op_set_fault_in_flow(create_seq_op, env, new_in_fault_flow);
-        inflow = axis2_op_get_in_flow(app_msg_op_desc, env);
-        new_inflow = axis2_phases_info_copy_flow(env, inflow);
-        axis2_op_set_in_flow(create_seq_op, env, new_inflow);
-    }
-    /*axis2_msg_ctx_set_op(create_seq_msg_ctx, env, create_seq_op);*/
-    property = axis2_msg_ctx_get_property(application_msg_ctx, env, 
-        AXIS2_TARGET_EPR);
+
+    property = axis2_msg_ctx_get_property(application_msg_ctx, env, AXIS2_TARGET_EPR);
     if(property)
     {
         temp_to = axutil_property_get_value(property, env);
-        to_epr = axis2_endpoint_ref_create(env, axis2_endpoint_ref_get_address(
-            temp_to, env));
+        to_epr = axis2_endpoint_ref_create(env, axis2_endpoint_ref_get_address(temp_to, env));
     }
+
     if (!to_epr)
     {
         temp_to = sandesha2_msg_ctx_get_to(application_rm_msg, env); 
         if (temp_to)
         {
-            to_epr = axis2_endpoint_ref_create(env, axis2_endpoint_ref_get_address(
-                temp_to, env));
+            to_epr = axis2_endpoint_ref_create(env, axis2_endpoint_ref_get_address(temp_to, env));
         }
     }
 
@@ -192,22 +157,38 @@
     }
     
     temp_reply_to = sandesha2_msg_ctx_get_reply_to(application_rm_msg, env); 
-    axis2_msg_ctx_set_reply_to(create_seq_msg_ctx, env, temp_reply_to);
+    if(temp_reply_to)
+    {
+        axis2_endpoint_ref_t *reply_to_epr = NULL;
+
+        reply_to_address = axis2_endpoint_ref_get_address(temp_reply_to, env);
+        reply_to_epr = axis2_endpoint_ref_create(env, reply_to_address);
+        if(reply_to_epr)
+        {
+            axis2_msg_ctx_set_reply_to(create_seq_msg_ctx, env, reply_to_epr);
+        }
+    }
+
     create_seq_rm_msg = sandesha2_msg_ctx_create(env, create_seq_msg_ctx);
-    rm_version = sandesha2_utils_get_rm_version(env, internal_seq_id, 
-        seq_prop_mgr);
+
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "create_seq_internal_seq_id:%s", internal_seq_id);
+    rm_version = sandesha2_utils_get_rm_version(env, internal_seq_id, seq_prop_mgr);
+
     if(!rm_version)
     {
         AXIS2_ERROR_SET(env->error, 
                 SANDESHA2_ERROR_CANNOT_FIND_RM_VERSION_OF_GIVEN_MSG, AXIS2_FAILURE);
         return NULL;
     }
+
     rm_ns_value = sandesha2_spec_specific_consts_get_rm_ns_val(env, rm_version);
+
     addressing_ns_value = sandesha2_utils_get_seq_property(env, internal_seq_id, 
         SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE, seq_prop_mgr);
-    create_seq_part = sandesha2_create_seq_create(env, addressing_ns_value,
-        rm_ns_value);
-    /* Adding sequence offer - if present */
+
+    create_seq_part = sandesha2_create_seq_create(env, addressing_ns_value, rm_ns_value);
+
+    /* Adding sequence offer if present */
     op_ctx = axis2_msg_ctx_get_op_ctx(application_msg_ctx, env);
     if(op_ctx)
     {
@@ -216,90 +197,136 @@
         axis2_ctx_t *ctx = NULL;
 
         ctx = axis2_msg_ctx_get_base(application_msg_ctx, env);
-        property = axis2_ctx_get_property(ctx, env, 
-                SANDESHA2_CLIENT_OFFERED_SEQ_ID);
+        property = axis2_ctx_get_property(ctx, env, SANDESHA2_CLIENT_OFFERED_SEQ_ID);
         if(property)
+        {
             offered_seq = axutil_property_get_value(property, env);
+        }
+
         if(offered_seq && 0 != axutil_strcmp("", offered_seq))
         {
             sandesha2_seq_offer_t *offer_part = NULL;
             sandesha2_identifier_t *identifier = NULL;
+            sandesha2_endpoint_t *endpoint = NULL;
 
-            offer_part = sandesha2_seq_offer_create(env, rm_ns_value);
+            offer_part = sandesha2_seq_offer_create(env, rm_ns_value, addressing_ns_value);
             identifier = sandesha2_identifier_create(env, rm_ns_value);
             sandesha2_identifier_set_identifier(identifier, env, offered_seq);
             sandesha2_seq_offer_set_identifier(offer_part, env, identifier);
+
+            if(!axutil_strcmp(SANDESHA2_SPEC_VERSION_1_1, rm_version))
+            {
+                axis2_endpoint_ref_t *reply_to_epr = NULL;
+                sandesha2_address_t *address = NULL;
+
+                reply_to_epr = axis2_endpoint_ref_create(env, reply_to_address);
+                address = sandesha2_address_create(env, addressing_ns_value, reply_to_epr);
+                endpoint = sandesha2_endpoint_create(env, address, rm_ns_value, 
+                        addressing_ns_value);
+
+                sandesha2_seq_offer_set_endpoint(offer_part, env, endpoint);
+            }
+
             sandesha2_create_seq_set_seq_offer(create_seq_part, env, offer_part);
         }
     }
-    reply_to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
-            internal_seq_id, SANDESHA2_SEQ_PROP_REPLY_TO_EPR);
-    to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
-            internal_seq_id, SANDESHA2_SEQ_PROP_TO_EPR);
+
+    reply_to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, internal_seq_id, 
+            SANDESHA2_SEQ_PROP_REPLY_TO_EPR);
+
+    to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, internal_seq_id, 
+            SANDESHA2_SEQ_PROP_TO_EPR);
     if (to_bean)
     {
         temp_value = sandesha2_seq_property_bean_get_value(to_bean, env);
-    }
     
-    /*if(!to_bean || !temp_value)
-    {
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_TO_EPR_NOT_SET, AXIS2_FAILURE);
-        return NULL;
-    }*/
+        if (temp_value)
+        {
+            to_epr = axis2_endpoint_ref_create(env, temp_value);
+        }
 
-    if (temp_value)
-    {
-        to_epr = axis2_endpoint_ref_create(env, temp_value);
+        sandesha2_seq_property_bean_free(to_bean, env);
     }
 
-    anonymous_uri = sandesha2_spec_specific_consts_get_anon_uri(env, 
-            addressing_ns_value);
-    if(!acks_to || 0 == axutil_strcmp("", acks_to))
-    {
-        acks_to = axutil_strdup(env, anonymous_uri);
-    }
-    acks_to_epr = axis2_endpoint_ref_create(env, acks_to);
+    anonymous_uri = sandesha2_spec_specific_consts_get_anon_uri(env, addressing_ns_value);
     if(reply_to_bean)
     {
+        axis2_endpoint_ref_t *reply_to_epr = NULL;
+
         temp_value = sandesha2_seq_property_bean_get_value(reply_to_bean, env);
-        reply_to_epr = axis2_endpoint_ref_create(env, temp_value);
+        if(temp_value)
+        {
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "dam_reply_to:%s", temp_value);
+            reply_to_epr = axis2_endpoint_ref_create(env, temp_value);
+            acks_to = axutil_strdup(env, temp_value);
+        }
+
+        if(reply_to_epr)
+        {
+            sandesha2_msg_ctx_set_reply_to(create_seq_rm_msg, env, reply_to_epr);
+        }
+        
+        sandesha2_seq_property_bean_free(reply_to_bean, env);
     }
+    
+    if(!acks_to || !axutil_strcmp("", acks_to))
+    {
+        acks_to = axutil_strdup(env, anonymous_uri);
+    }
+
+    acks_to_epr = axis2_endpoint_ref_create(env, acks_to);
+
     temp_to = sandesha2_msg_ctx_get_to(create_seq_rm_msg, env);
     if(!temp_to && to_epr)
+    {
         sandesha2_msg_ctx_set_to(create_seq_rm_msg, env, to_epr);
-    /* ReplyTo will be set only if not NULL */
-    if(reply_to_epr)
+    }
+    else
     {
-        sandesha2_msg_ctx_set_reply_to(create_seq_rm_msg, env, reply_to_epr);
+        axis2_endpoint_ref_free(to_epr, env);
     }
+
+
     temp_address = sandesha2_address_create(env, addressing_ns_value, acks_to_epr);
-    temp_acks_to = sandesha2_acks_to_create(env, temp_address, rm_ns_value, 
-            addressing_ns_value);
+    temp_acks_to = sandesha2_acks_to_create(env, temp_address, rm_ns_value, addressing_ns_value);
+
     if(addressing_ns_value)
+    {
         AXIS2_FREE(env->allocator, addressing_ns_value);
+    }
+
     sandesha2_create_seq_set_acks_to(create_seq_part, env,  temp_acks_to);
     sandesha2_msg_ctx_set_create_seq(create_seq_rm_msg, env, create_seq_part);
     sandesha2_msg_ctx_add_soap_envelope(create_seq_rm_msg, env);
-    temp_action = sandesha2_spec_specific_consts_get_create_seq_action(env, 
-            rm_version);
+    temp_action = sandesha2_spec_specific_consts_get_create_seq_action(env, rm_version);
+
     if(rm_version)
+    {
         AXIS2_FREE(env->allocator, rm_version);
+    }
+
     sandesha2_msg_ctx_set_wsa_action(create_seq_rm_msg, env, temp_action);
-    /*temp_soap_action = sandesha2_spec_specific_consts_get_create_seq_action(env, 
-            rm_version);*/
+
     temp_soap_action = axutil_string_create(env, temp_action);
-    sandesha2_msg_ctx_set_soap_action(create_seq_rm_msg, env, temp_soap_action);
-    sandesha2_msg_creator_finalize_creation(env, application_msg_ctx, 
-            create_seq_msg_ctx);
+    if(temp_soap_action)
+    {
+        sandesha2_msg_ctx_set_soap_action(create_seq_rm_msg, env, temp_soap_action);
+        axutil_string_free(temp_soap_action, env);
+    }
+
+    /*sandesha2_msg_creator_finalize_creation(env, application_msg_ctx, create_seq_msg_ctx);*/
+
     return create_seq_rm_msg;
 }
 
 /**
  * Create a new create_seq_response message.
+ * @param env axis2 environment struct
  * @param create_seq_msg
  * @param out_msg
  * @param new_seq_id
- * @return
+ * @param seq_prop_mgr
+ * @return sandesha2_msg_ctx_t
  */
 sandesha2_msg_ctx_t *
 sandesha2_msg_creator_create_create_seq_res_msg(
@@ -310,8 +337,6 @@
     sandesha2_seq_property_mgr_t *seq_prop_mgr)
 {
     axis2_conf_ctx_t *conf_ctx = NULL;
-    /*axis2_ctx_t *ctx = NULL;
-    axutil_property_t *prop = NULL;*/
     axis2_msg_ctx_t *temp_msg_ctx = NULL;
     axis2_char_t *rm_version = NULL;
     axis2_char_t *rm_ns_value = NULL;
@@ -332,102 +357,123 @@
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
         "[sandesha2] Entry:sandesha2_msg_creator_create_create_seq_res_msg");
+
     temp_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(create_seq_msg, env);
     conf_ctx = axis2_msg_ctx_get_conf_ctx(temp_msg_ctx, env);
     cs = sandesha2_msg_ctx_get_create_seq(create_seq_msg, env);
     rm_version = sandesha2_utils_get_rm_version(env, new_seq_id, seq_prop_mgr);
+
     if(!rm_version)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "Cannot find rm version of given message");
-        AXIS2_ERROR_SET(env->error, 
-            SANDESHA2_ERROR_CANNOT_FIND_RM_VERSION_OF_GIVEN_MSG, 
-            AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Cannot find rm version of given message");
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CANNOT_FIND_RM_VERSION_OF_GIVEN_MSG, 
+                AXIS2_FAILURE);
         return NULL;
     }
+
     rm_ns_value = sandesha2_spec_specific_consts_get_rm_ns_val(env, rm_version);
     addressing_ns_value = sandesha2_utils_get_seq_property(env, new_seq_id, 
         SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE, seq_prop_mgr);
     if(!addressing_ns_value)
     {
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "Cannot find addressing namespace value");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Cannot find addressing namespace value");
         return NULL;
     }
-    create_seq_res = sandesha2_create_seq_res_create(env, rm_ns_value, 
-        addressing_ns_value);
+
+    create_seq_res = sandesha2_create_seq_res_create(env, rm_ns_value, addressing_ns_value);
     identifier = sandesha2_identifier_create(env, rm_ns_value);
     sandesha2_identifier_set_identifier(identifier, env, new_seq_id);
     sandesha2_create_seq_res_set_identifier(create_seq_res, env, identifier);
     offer = sandesha2_create_seq_get_seq_offer(cs, env);
+
     if(offer)
     {
         axis2_char_t *out_seq_id = NULL;
         sandesha2_identifier_t *temp_identifier = NULL;
         
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Offer present");
+
         temp_identifier = sandesha2_seq_offer_get_identifier(offer, env);
         out_seq_id = sandesha2_identifier_get_identifier(temp_identifier, env);
-        if(out_seq_id && 0 != axutil_strcmp("", out_seq_id))
+        if(out_seq_id && axutil_strcmp("", out_seq_id))
         {
             sandesha2_accept_t *accept = NULL;
             axis2_endpoint_ref_t *acks_to_epr = NULL;
             sandesha2_acks_to_t *acks_to = NULL;
             sandesha2_address_t *address = NULL;
 
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] out_seq_id present");
+
             accept = sandesha2_accept_create(env, rm_ns_value, addressing_ns_value);
-            acks_to_epr = sandesha2_msg_ctx_get_to(create_seq_msg, env);
-            address = sandesha2_address_create(env, addressing_ns_value, acks_to_epr);
-            acks_to = sandesha2_acks_to_create(env, address, rm_ns_value, addressing_ns_value);
-            sandesha2_address_set_epr(address, env, acks_to_epr);
-            sandesha2_acks_to_set_address(acks_to, env, address);
-            sandesha2_accept_set_acks_to(accept, env, acks_to);
-            sandesha2_create_seq_res_set_accept(create_seq_res, env, accept);
+            if(accept)
+            {
+                axis2_endpoint_ref_t *temp_to_epr = NULL;
+
+                acks_to_epr = sandesha2_msg_ctx_get_to(create_seq_msg, env);
+                if(acks_to_epr)
+                {
+                    temp_to_epr = sandesha2_util_endpoint_ref_clone(env, acks_to_epr);
+                }
+
+                address = sandesha2_address_create(env, addressing_ns_value, temp_to_epr);
+                acks_to = sandesha2_acks_to_create(env, address, rm_ns_value, addressing_ns_value);
+                sandesha2_accept_set_acks_to(accept, env, acks_to);
+                sandesha2_create_seq_res_set_accept(create_seq_res, env, accept);
+            }
+            else
+            {
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Could not create accept element");
+                return NULL;
+            }
         }
     }
+
     temp_envelope = sandesha2_msg_ctx_get_soap_envelope(create_seq_msg, env); 
     soap_version = sandesha2_utils_get_soap_version(env, temp_envelope);
     envelope = axiom_soap_envelope_create_default_soap_envelope(env, soap_version);
     temp_soap_body = axiom_soap_envelope_get_body(envelope, env);
     temp_om_node = axiom_soap_body_get_base_node(temp_soap_body, env);
     sandesha2_create_seq_res_to_om_node(create_seq_res, env, temp_om_node);
-    temp_action = sandesha2_spec_specific_consts_get_create_seq_res_action(
-            env, rm_version);
+    temp_action = sandesha2_spec_specific_consts_get_create_seq_res_action(env, rm_version);
+
     if(rm_version)
+    {
         AXIS2_FREE(env->allocator, rm_version);
+    }
+
     axis2_msg_ctx_set_wsa_action(out_msg, env, temp_action);
-    /*temp_action = 
-        sandesha2_spec_specific_consts_get_create_seq_res_action(env, 
-                rm_version);*/
+
     soap_action = axutil_string_create(env, temp_action);
-    axis2_msg_ctx_set_soap_action(out_msg, env, soap_action);
-    /*ctx = axis2_msg_ctx_get_base(out_msg, env);
-    prop = axis2_ctx_get_property(ctx, env, AXIS2_WSA_VERSION);
-    if(prop)
+    if(soap_action)
     {
-        axutil_property_set_value(prop, env, axutil_strdup(env, 
-            addressing_ns_value)); 
+        axis2_msg_ctx_set_soap_action(out_msg, env, soap_action);
+        axutil_string_free(soap_action, env);
     }
-    else
-    {
-        prop = axutil_property_create_with_args(env, 0, 0, 0, axutil_strdup(env, 
-            addressing_ns_value));
-        axis2_ctx_set_property(ctx, env, AXIS2_WSA_VERSION, prop);
-    }*/
+
     if(addressing_ns_value)
+    {
         AXIS2_FREE(env->allocator, addressing_ns_value);
+    }
+
     new_msg_id = axutil_uuid_gen(env);
-    axis2_msg_ctx_set_message_id(out_msg, env, new_msg_id);
+    if(new_msg_id)
+    {
+        axis2_msg_ctx_set_message_id(out_msg, env, new_msg_id);
+        AXIS2_FREE(env->allocator, new_msg_id);
+    }
+
     axis2_msg_ctx_set_soap_envelope(out_msg, env, envelope);
     temp_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(create_seq_msg, env);
-    sandesha2_msg_creator_init_creation(env, temp_msg_ctx,out_msg);
+    sandesha2_msg_creator_init_creation(env, temp_msg_ctx, out_msg);
     create_seq_res_rm_msg_ctx = sandesha2_msg_init_init_msg(env, out_msg);
-    sandesha2_msg_ctx_set_create_seq_res(create_seq_res_rm_msg_ctx, env, 
-        create_seq_res);
+    sandesha2_msg_ctx_set_create_seq_res(create_seq_res_rm_msg_ctx, env, create_seq_res);
     temp_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(create_seq_msg, env);
     sandesha2_msg_creator_finalize_creation(env, temp_msg_ctx, out_msg);
     axis2_msg_ctx_set_server_side(temp_msg_ctx, env, AXIS2_TRUE);
+
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "[sandesha2] Exit:sandesha2_msg_creator_create_create_seq_res_msg");
+            "[sandesha2] Exit:sandesha2_msg_creator_create_create_seq_res_msg");
+
     return create_seq_res_rm_msg_ctx;
 }
  
@@ -521,15 +567,11 @@
     axis2_msg_ctx_t *ref_msg_ctx = NULL;
     axis2_msg_ctx_t *terminate_seq_msg_ctx = NULL;
     axis2_conf_ctx_t *conf_ctx = NULL;
-    axis2_op_t *terminate_seq_op = NULL;
-    axis2_op_t *ref_msg_op = NULL;
-    /*axis2_op_ctx_t *terminate_seq_op_ctx = NULL;*/
     axis2_char_t *terminate_seq_msg_id = NULL;
     axis2_char_t *temp_msg_id = NULL;
     axis2_char_t *rm_version = NULL;
     axis2_char_t *rm_ns_value = NULL;
     axis2_bool_t is_seq_res_reqd = AXIS2_FALSE;
-    axiom_soap_envelope_t *envelope = NULL;
     axiom_soap_envelope_t *temp_envelope = NULL;
     sandesha2_msg_ctx_t *terminate_rm_msg = NULL;
     sandesha2_terminate_seq_t *terminate_seq = NULL;
@@ -544,54 +586,17 @@
                 AXIS2_FAILURE);
         return NULL;
     }
-    terminate_seq_op = axis2_op_create(env);
-    if(!terminate_seq_op)
-    {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        return NULL;
-    }
+
     conf_ctx = axis2_msg_ctx_get_conf_ctx(ref_msg_ctx, env);
     if(!conf_ctx)
     {
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CONF_CTX_NULL, AXIS2_FAILURE);
         return NULL;
     }
-    terminate_seq_msg_ctx = sandesha2_utils_create_new_related_msg_ctx(env, 
-            ref_rm_msg, terminate_seq_op);
-    /*terminate_seq_op_ctx = axis2_msg_ctx_get_op_ctx(terminate_seq_msg_ctx, env);*/
+    terminate_seq_msg_ctx = sandesha2_utils_create_new_related_msg_ctx(env, ref_rm_msg);
     terminate_seq_msg_id = (axis2_char_t*)axis2_msg_ctx_get_msg_id(
                         terminate_seq_msg_ctx, env);
-    /*axutil_allocator_switch_to_global_pool(env->allocator);
-    if(terminate_seq_msg_id)
-        axis2_conf_ctx_register_op_ctx(conf_ctx, env, terminate_seq_msg_id, 
-            terminate_seq_op_ctx);
-    axutil_allocator_switch_to_local_pool(env->allocator);*/
-    ref_msg_op = axis2_msg_ctx_get_op(ref_msg_ctx, env);
-    terminate_seq_op = axis2_msg_ctx_get_op(terminate_seq_msg_ctx, env);
-    if(ref_msg_op)
-    {
-        axutil_array_list_t *outflow = NULL;
-        axutil_array_list_t *out_fault_flow = NULL;
-        axutil_array_list_t *in_fault_flow = NULL;
-        axutil_array_list_t *inflow = NULL;
-        axutil_array_list_t *new_outflow = NULL;
-        axutil_array_list_t *new_out_fault_flow = NULL;
-        axutil_array_list_t *new_in_fault_flow = NULL;
-        axutil_array_list_t *new_inflow = NULL;
-
-        outflow = axis2_op_get_out_flow(ref_msg_op, env);
-        new_outflow = axis2_phases_info_copy_flow(env, outflow);
-        axis2_op_set_out_flow(terminate_seq_op, env, new_outflow);
-        out_fault_flow = axis2_op_get_fault_out_flow(ref_msg_op, env);
-        new_out_fault_flow = axis2_phases_info_copy_flow(env, out_fault_flow);
-        axis2_op_set_fault_out_flow(terminate_seq_op, env, new_out_fault_flow);
-        in_fault_flow = axis2_op_get_fault_in_flow(ref_msg_op, env);
-        new_in_fault_flow = axis2_phases_info_copy_flow(env, in_fault_flow);
-        axis2_op_set_fault_in_flow(terminate_seq_op, env, new_in_fault_flow);
-        inflow = axis2_op_get_in_flow(ref_msg_op, env);
-        new_inflow = axis2_phases_info_copy_flow(env, inflow);
-        axis2_op_set_in_flow(terminate_seq_op, env, new_inflow);
-    }
+
     rm_version = sandesha2_utils_get_rm_version(env, internal_seq_id, seq_prop_mgr);
     if(!rm_version)
     {
@@ -599,42 +604,43 @@
             SANDESHA2_ERROR_CANNOT_FIND_RM_VERSION_OF_GIVEN_MSG, AXIS2_FAILURE);
         return NULL;
     }
+
     rm_ns_value = sandesha2_spec_specific_consts_get_rm_ns_val(env, rm_version);
     sandesha2_msg_creator_init_creation(env, ref_msg_ctx, terminate_seq_msg_ctx);
-    is_seq_res_reqd = sandesha2_spec_specific_consts_is_term_seq_res_reqd(env, 
-        rm_version);
+
+    is_seq_res_reqd = sandesha2_spec_specific_consts_is_term_seq_res_reqd(env, rm_version);
+
     if(rm_version)
+    {
         AXIS2_FREE(env->allocator, rm_version);
+    }
 
     if(!is_seq_res_reqd)
     {
-        axis2_msg_ctx_set_property(terminate_seq_msg_ctx, env, AXIS2_TRANSPORT_IN, 
-                NULL);
+        axis2_msg_ctx_set_property(terminate_seq_msg_ctx, env, AXIS2_TRANSPORT_IN, NULL);
     }
+
     terminate_rm_msg = sandesha2_msg_init_init_msg(env, terminate_seq_msg_ctx);
     if(!terminate_rm_msg)
     {
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_NULL_MSG_CTX, AXIS2_FAILURE);
         return NULL;
     }
+
     temp_msg_id = axutil_uuid_gen(env);
     axis2_msg_ctx_set_message_id(terminate_seq_msg_ctx, env, temp_msg_id);
     AXIS2_FREE(env->allocator, temp_msg_id);
     temp_envelope = sandesha2_msg_ctx_get_soap_envelope(ref_rm_msg, env);
     soap_version = sandesha2_utils_get_soap_version(env, temp_envelope);
-    envelope = axiom_soap_envelope_create_default_soap_envelope(env, soap_version);
-    sandesha2_msg_ctx_set_soap_envelope(terminate_rm_msg, env, envelope);
 
     terminate_seq = sandesha2_terminate_seq_create(env, rm_ns_value);
     identifier = sandesha2_identifier_create(env, rm_ns_value);
     sandesha2_identifier_set_identifier(identifier, env, seq_id);
     sandesha2_terminate_seq_set_identifier(terminate_seq, env, identifier);
-    sandesha2_msg_ctx_set_terminate_seq(terminate_rm_msg, env, 
-        terminate_seq);
-    sandesha2_msg_creator_finalize_creation(env, ref_msg_ctx, 
-                        terminate_seq_msg_ctx);
-    axis2_msg_ctx_set_property(terminate_seq_msg_ctx, env, AXIS2_TRANSPORT_IN,
-        NULL);
+    sandesha2_msg_ctx_set_terminate_seq(terminate_rm_msg, env, terminate_seq);
+    sandesha2_msg_creator_finalize_creation(env, ref_msg_ctx, terminate_seq_msg_ctx);
+    axis2_msg_ctx_set_property(terminate_seq_msg_ctx, env, AXIS2_TRANSPORT_IN, NULL);
+
     return terminate_rm_msg;
 }
 
@@ -678,22 +684,27 @@
     rm_version = sandesha2_utils_get_rm_version(env, seq_id, seq_prop_mgr);
     if(!rm_version)
     {
-        rm_version = sandesha2_msg_ctx_get_rm_spec_ver(ref_rm_msg, env);
+        rm_version = axutil_strdup(env, sandesha2_msg_ctx_get_rm_spec_ver(ref_rm_msg, env));
     }
-    temp_action = sandesha2_spec_specific_consts_get_teminate_seq_res_action(
-        env, rm_version);
+
+    temp_action = sandesha2_spec_specific_consts_get_teminate_seq_res_action(env, rm_version);
     if(rm_version)
+    {
         AXIS2_FREE(env->allocator, rm_version);
+    }
+
     axis2_msg_ctx_set_wsa_action(out_msg, env, temp_action);
     soap_action = axutil_string_create(env, temp_action);
-    axis2_msg_ctx_set_soap_action(out_msg, env, soap_action); 
-    sandesha2_msg_creator_init_creation(env, sandesha2_msg_ctx_get_msg_ctx(
-                        ref_rm_msg, env), out_msg);
+    axis2_msg_ctx_set_soap_action(out_msg, env, soap_action);
+    axutil_string_free(soap_action, env);
+    sandesha2_msg_creator_init_creation(env, sandesha2_msg_ctx_get_msg_ctx(ref_rm_msg, env), 
+            out_msg);
+
     sandesha2_msg_ctx_add_soap_envelope(ref_rm_msg, env);
-    sandesha2_msg_creator_finalize_creation(env, sandesha2_msg_ctx_get_msg_ctx(
-                        ref_rm_msg, env), out_msg);
-    axis2_msg_ctx_set_server_side(sandesha2_msg_ctx_get_msg_ctx(ref_rm_msg, env), 
-                        env, AXIS2_TRUE);
+    sandesha2_msg_creator_finalize_creation(env, sandesha2_msg_ctx_get_msg_ctx(ref_rm_msg, env), 
+            out_msg);
+
+    axis2_msg_ctx_set_server_side(sandesha2_msg_ctx_get_msg_ctx(ref_rm_msg, env), env, AXIS2_TRUE);
     return res_rm_msg;
 }
 
@@ -703,18 +714,18 @@
     axis2_msg_ctx_t *related_msg,
     axis2_msg_ctx_t *new_msg)
 {
-    axis2_op_t *old_op = NULL;
-    axis2_op_ctx_t *old_op_ctx = NULL;
+    /*axis2_op_t *old_op = NULL;*/
+    /*axis2_op_ctx_t *old_op_ctx = NULL;*/
     axis2_bool_t temp_bool = AXIS2_FALSE;
-    axutil_hash_t *related_msg_props = NULL;
+    /*axutil_hash_t *related_msg_props = NULL;
     axutil_hash_t *new_msg_props = NULL;
     axis2_ctx_t *related_ctx = NULL;
-    axis2_ctx_t *new_ctx = NULL;
+    axis2_ctx_t *new_ctx = NULL;*/
 
     temp_bool = axis2_msg_ctx_get_server_side(related_msg, env);
     axis2_msg_ctx_set_server_side(new_msg, env, temp_bool);
     /* Adding all parameters from old message to the new one */
-    old_op = axis2_msg_ctx_get_op(related_msg, env);
+    /*old_op = axis2_msg_ctx_get_op(related_msg, env);
     if(old_op)
     {
         axutil_array_list_t *op_params = NULL;
@@ -744,9 +755,9 @@
                 axis2_op_add_param(new_op, env, new_param); 
             }
         }
-    }
+    }*/
     /* Operation context properties */
-    old_op_ctx = axis2_msg_ctx_get_op_ctx(related_msg, env);
+    /*old_op_ctx = axis2_msg_ctx_get_op_ctx(related_msg, env);
     if(old_op_ctx)
     {
         axutil_hash_t *old_op_ctx_props = NULL;
@@ -786,9 +797,9 @@
                 }
             }
         }
-    }
+    }*/
     /* Setting options with properties copied from the old one */
-    if(related_msg && new_msg)
+    /*if(related_msg && new_msg)
     {
         related_ctx = axis2_msg_ctx_get_base(related_msg, env);
         related_msg_props = axis2_ctx_get_all_properties(related_ctx, env);
@@ -826,7 +837,7 @@
                 }
             }
         }
-    }
+    }*/
     return AXIS2_SUCCESS;
 }
  
@@ -836,7 +847,7 @@
     axis2_msg_ctx_t *related_msg,
     axis2_msg_ctx_t *new_msg)
 {
-    axis2_svc_t *related_svc = NULL;
+    /*axis2_svc_t *related_svc = NULL;
     axis2_svc_t *new_svc = NULL;
 
     related_svc = axis2_msg_ctx_get_svc(related_msg, env);
@@ -845,19 +856,17 @@
     {
         axutil_param_t *ref_policy_param = NULL;
 
-        ref_policy_param = axis2_svc_get_param(related_svc, env, 
-                SANDESHA2_SANDESHA_PROPERTY_BEAN);
+        ref_policy_param = axis2_svc_get_param(related_svc, env, SANDESHA2_SANDESHA_PROPERTY_BEAN);
         if(ref_policy_param)
         {
             void *value = NULL;
             axutil_param_t *new_policy_param = NULL;
 
             value = axutil_param_get_value(ref_policy_param, env);
-            new_policy_param = axutil_param_create(env, 
-                    SANDESHA2_SANDESHA_PROPERTY_BEAN, value);
+            new_policy_param = axutil_param_create(env, SANDESHA2_SANDESHA_PROPERTY_BEAN, value);
         }
         
-    }
+    }*/
     return AXIS2_SUCCESS;
 }
 
@@ -870,7 +879,7 @@
 axis2_status_t AXIS2_CALL
 sandesha2_msg_creator_add_ack_msg(
     const axutil_env_t *env,
-    sandesha2_msg_ctx_t *app_msg,
+    sandesha2_msg_ctx_t *target_rm_msg_ctx,
     axis2_char_t *seq_id,
     sandesha2_seq_property_mgr_t *seq_prop_mgr)
 {
@@ -894,24 +903,26 @@
     int i = 0, size = 0;
     
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "[sandesha2]Entry:sandesha2_msg_creator_add_ack_msg");
-    envelope = sandesha2_msg_ctx_get_soap_envelope(app_msg, env);
+        "[sandesha2] Entry:sandesha2_msg_creator_add_ack_msg");
+
+    envelope = sandesha2_msg_ctx_get_soap_envelope(target_rm_msg_ctx, env);
     if(!envelope)
     {
         AXIS2_ERROR_SET(env->error, 
                 AXIS2_ERROR_NULL_SOAP_ENVELOPE_IN_MSG_CTX, AXIS2_FAILURE);
         return AXIS2_FAILURE;
     }
-    msg_ctx = sandesha2_msg_ctx_get_msg_ctx(app_msg, env);
+
+    msg_ctx = sandesha2_msg_ctx_get_msg_ctx(target_rm_msg_ctx, env);
     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
     rm_version = sandesha2_utils_get_rm_version(env, seq_id, seq_prop_mgr);
     if(!rm_version)
     {
         AXIS2_ERROR_SET(env->error, 
-                SANDESHA2_ERROR_CANNOT_FIND_RM_VERSION_OF_GIVEN_MSG, 
-                AXIS2_FAILURE);
+                SANDESHA2_ERROR_CANNOT_FIND_RM_VERSION_OF_GIVEN_MSG, AXIS2_FAILURE);
         return AXIS2_FAILURE;
     }
+
     rm_ns_value = sandesha2_spec_specific_consts_get_rm_ns_val(env, rm_version);
     seq_ack = sandesha2_seq_ack_create(env, rm_ns_value);
     id = sandesha2_identifier_create(env, rm_ns_value);
@@ -919,15 +930,23 @@
     sandesha2_seq_ack_set_identifier(seq_ack, env, id);
     seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, seq_id, 
             SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES);
+
     if(seq_bean)
-        msg_no_list = (axis2_char_t *) sandesha2_seq_property_bean_get_value(
-            seq_bean, env); 
-    ack_range_list = sandesha2_utils_get_ack_range_list(env, msg_no_list, 
-            rm_ns_value);
+    {
+        msg_no_list = (axis2_char_t *) sandesha2_seq_property_bean_get_value(seq_bean, env); 
+    }
+
+    ack_range_list = sandesha2_utils_get_ack_range_list(env, msg_no_list, rm_ns_value);
     if(seq_bean)
+    {
         sandesha2_seq_property_bean_free(seq_bean, env);
+    }
+
     if(ack_range_list)
+    {
         size = axutil_array_list_size(ack_range_list, env);
+    }
+
     for(i = 0; i < size; i++)
     {
         sandesha2_ack_range_t *ack_range = NULL;
@@ -935,12 +954,20 @@
         ack_range = axutil_array_list_get(ack_range_list, env, i);
         sandesha2_seq_ack_add_ack_range(seq_ack, env, ack_range);
     }
+
     if(ack_range_list)
+    {
         axutil_array_list_free(ack_range_list, env);
+    }
+
     seq_closed_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, seq_id, 
             SANDESHA2_SEQ_PROP_SEQ_CLOSED);
+
     if(seq_closed_bean)
+    {
         str_value = sandesha2_seq_property_bean_get_value(seq_closed_bean, env);
+    }
+
     if(seq_closed_bean && 0 == axutil_strcmp(AXIS2_VALUE_TRUE, str_value))
     {
         axis2_bool_t is_allowed = AXIS2_FALSE;
@@ -956,33 +983,48 @@
             sandesha2_seq_ack_set_ack_final(seq_ack, env, ack_final);
         }
     }
+
     if(seq_closed_bean)
+    {
         sandesha2_seq_property_bean_free(seq_closed_bean, env);
-    sandesha2_msg_ctx_set_seq_ack(app_msg, env, seq_ack);
+    }
+
+    sandesha2_msg_ctx_set_seq_ack(target_rm_msg_ctx, env, seq_ack);
     soap_header = axiom_soap_envelope_get_header(envelope, env);
     sandesha2_seq_ack_to_om_node(seq_ack, env, soap_header);
 
-    ack_req_action = sandesha2_msg_ctx_get_wsa_action(app_msg, env);
-    if((!ack_req_action) || (axutil_strcmp(ack_req_action, "") == 0))
+    ack_req_action = sandesha2_msg_ctx_get_wsa_action(target_rm_msg_ctx, env);
+    if((!ack_req_action) || (!axutil_strcmp(ack_req_action, "")))
     {
-        ack_req_action = sandesha2_spec_specific_consts_get_seq_ack_action(env, 
-            rm_version);
-        sandesha2_msg_ctx_set_wsa_action(app_msg, env, ack_req_action); 
+        ack_req_action = sandesha2_spec_specific_consts_get_seq_ack_action(env, rm_version);
+        sandesha2_msg_ctx_set_wsa_action(target_rm_msg_ctx, env, ack_req_action); 
     }
-    temp_action = 
-        sandesha2_spec_specific_consts_get_seq_ack_soap_action(env, 
-                rm_version);
+
+    temp_action = sandesha2_spec_specific_consts_get_seq_ack_soap_action(env, rm_version);
     if(rm_version)
+    {
         AXIS2_FREE(env->allocator, rm_version);
-    ack_req_soap_action = axutil_string_create(env, temp_action); 
-    sandesha2_msg_ctx_set_soap_action(app_msg, env, ack_req_soap_action); 
+    }
+
+    ack_req_soap_action = axutil_string_create(env, temp_action);
+    if(ack_req_soap_action)
+    {
+        sandesha2_msg_ctx_set_soap_action(target_rm_msg_ctx, env, ack_req_soap_action); 
+        axutil_string_free(ack_req_soap_action, env);
+    }
+
     uuid = axutil_uuid_gen(env);
-    sandesha2_msg_ctx_set_msg_id(app_msg, env, uuid);
+    sandesha2_msg_ctx_set_msg_id(target_rm_msg_ctx, env, uuid);
+
+    if(uuid)
+    {
+        AXIS2_FREE(env->allocator, uuid);
+    }
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "[sandesha2]Exit:sandesha2_msg_creator_add_ack_msg");
+        "[sandesha2] Exit:sandesha2_msg_creator_add_ack_msg");
+
     return AXIS2_SUCCESS;
-        
 }
 
 sandesha2_msg_ctx_t *AXIS2_CALL
@@ -990,38 +1032,37 @@
     const axutil_env_t *env,
     sandesha2_msg_ctx_t *ref_rm_msg_ctx, 
     axis2_char_t *make_conn_seq_id,
+    const axis2_char_t *internal_seq_id,
     axis2_char_t *make_conn_anon_uri,
     sandesha2_seq_property_mgr_t *seq_prop_mgr)
 {
     axis2_msg_ctx_t *ref_msg_ctx = NULL;
     axis2_msg_ctx_t *make_conn_msg_ctx = NULL;
     axis2_char_t *rm_ns_value = NULL;
-    axis2_char_t *rm_version = NULL;
-    axis2_op_t *make_conn_op = NULL;
+    axis2_char_t *mc_ns_value = NULL;
     axis2_char_t *wsa_action = NULL;
-    axutil_qname_t *qname = NULL;
     sandesha2_make_connection_t *make_conn = NULL;
     sandesha2_msg_ctx_t *make_conn_rm_msg_ctx = NULL;
    
+    rm_ns_value = sandesha2_spec_specific_consts_get_rm_ns_val(env, SANDESHA2_SPEC_VERSION_1_1);
+    
+    mc_ns_value = MAKE_CONNECTION_SPEC_2007_02_NS_URI;
+
     if(ref_rm_msg_ctx)
     {
         ref_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(ref_rm_msg_ctx, env);
-        rm_ns_value = sandesha2_msg_ctx_get_rm_ns_val(ref_rm_msg_ctx, env);
-        rm_version = sandesha2_msg_ctx_get_rm_spec_ver(ref_rm_msg_ctx, env);
     }
-    qname = axutil_qname_create(env, "MakeConnectionOperation", NULL, NULL);
-    make_conn_op = axis2_op_create_with_qname(env, qname);
-    if(qname)
-        axutil_qname_free(qname, env);
-    make_conn_msg_ctx = sandesha2_utils_create_new_related_msg_ctx(env, 
-        ref_rm_msg_ctx, make_conn_op);
+    
+    make_conn_msg_ctx = sandesha2_utils_create_new_related_msg_ctx(env, ref_rm_msg_ctx);
     if(make_conn_msg_ctx)
-        make_conn_rm_msg_ctx = sandesha2_msg_init_init_msg(env, 
-            make_conn_msg_ctx);
+    {
+        make_conn_rm_msg_ctx = sandesha2_msg_init_init_msg(env, make_conn_msg_ctx);
+    }
+
     /* This if block is an hack to add the addressing handlers to the outflow.
      * Check whether this is not a hack
      */
-    if(ref_msg_ctx)
+    /*if(ref_msg_ctx)
     {
         axis2_op_t *op = axis2_msg_ctx_get_op(ref_msg_ctx, env);
         axis2_op_t *make_conn_op = axis2_msg_ctx_get_op(make_conn_msg_ctx, env);
@@ -1059,8 +1100,9 @@
             }
             axis2_op_set_in_flow(make_conn_op, env, new_flow);
         }
-    }
-    make_conn = sandesha2_make_connection_create(env, rm_ns_value);
+    }*/
+
+    make_conn = sandesha2_make_connection_create(env, mc_ns_value);
     if(make_conn_seq_id)
     {
         sandesha2_identifier_t *identifier = sandesha2_identifier_create(env, 
@@ -1071,40 +1113,56 @@
         if(make_conn)
             sandesha2_make_connection_set_identifier(make_conn, env, identifier);
     }
+
     if(make_conn_anon_uri)
     {
-        sandesha2_address_t *address = sandesha2_address_create(env, 
-            rm_ns_value, NULL);
-        axis2_endpoint_ref_t *epr = axis2_endpoint_ref_create(env, 
-            make_conn_anon_uri);  
+        sandesha2_mc_address_t *address = NULL;
+        axis2_endpoint_ref_t *epr = NULL;
+
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] make_conn_anon_uri:%s", 
+                make_conn_anon_uri);
+
+        address = sandesha2_mc_address_create(env, mc_ns_value, NULL);
+        epr = axis2_endpoint_ref_create(env, make_conn_anon_uri);
+
         if(address)
-            sandesha2_address_set_epr(address, env, epr);
+        {
+            sandesha2_mc_address_set_epr(address, env, epr);
+        }
+
         if(make_conn)
+        {
             sandesha2_make_connection_set_address(make_conn, env, address);
+        }
     }
+
     if(make_conn_msg_ctx)
     {
         axis2_endpoint_ref_t *to = NULL;
         axis2_endpoint_ref_t *reply_to = NULL;
         axis2_char_t *address = NULL;
+        axutil_string_t *soap_action = NULL;
+
         /* Setting the addressing properties */
         to = axis2_msg_ctx_get_to(ref_msg_ctx, env);
-        address = (axis2_char_t *) axis2_endpoint_ref_get_address(
-            (const axis2_endpoint_ref_t *) to, env);
+        address = (axis2_char_t *) axis2_endpoint_ref_get_address((const axis2_endpoint_ref_t *) to, env);
         to = axis2_endpoint_ref_create(env, address);
         axis2_msg_ctx_set_to(make_conn_msg_ctx, env, to);
         reply_to = axis2_endpoint_ref_create(env, AXIS2_WSA_ANONYMOUS_URL);
         axis2_msg_ctx_set_reply_to(make_conn_msg_ctx, env, reply_to);
-        wsa_action = sandesha2_spec_specific_consts_get_make_connection_action(
-            env, rm_version);
+        wsa_action = sandesha2_spec_specific_consts_get_make_connection_action(env, SANDESHA2_SPEC_VERSION_1_1);
         axis2_msg_ctx_set_wsa_action(make_conn_msg_ctx, env, wsa_action);
+        soap_action = axutil_string_create(env, wsa_action);
+        axis2_msg_ctx_set_soap_action(make_conn_msg_ctx, env, soap_action);
         axis2_msg_ctx_set_message_id(make_conn_msg_ctx, env, axutil_uuid_gen(env));
-        sandesha2_msg_ctx_set_make_connection(make_conn_rm_msg_ctx, env, 
-            make_conn);
+    
+        sandesha2_msg_ctx_set_make_connection(make_conn_rm_msg_ctx, env, make_conn);
+
        /* Generating the soap envelope */
         sandesha2_msg_ctx_add_soap_envelope(make_conn_rm_msg_ctx, env);
         return make_conn_rm_msg_ctx;
     }
+
     return NULL;
 }
 

Modified: webservices/sandesha/trunk/c/src/util/msg_init.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/msg_init.c?rev=690127&r1=690126&r2=690127&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/msg_init.c (original)
+++ webservices/sandesha/trunk/c/src/util/msg_init.c Thu Aug 28 23:56:29 2008
@@ -130,18 +130,26 @@
     /* If client side and the addressing version is not set. 
      * Assuming the default addressing version.
      */
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "[sandesha2]Entry:populate_rm_msg_ctx");
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2]Entry:populate_rm_msg_ctx");
     if(msg_ctx)
+    {
         ctx = axis2_msg_ctx_get_base(msg_ctx, env);
-    prop = axis2_ctx_get_property(ctx, env, AXIS2_WSA_VERSION);
+        if(ctx)
+        {
+            prop = axis2_ctx_get_property(ctx, env, AXIS2_WSA_VERSION);
+        }
+    }
+
     if(prop)
+    {
         addressing_ns = axutil_property_get_value(prop, env);
+    }
     
     if(!addressing_ns && !axis2_msg_ctx_get_server_side(msg_ctx, env))
     {
         addressing_ns = AXIS2_WSA_NAMESPACE;
     }
+
     rm_elements = sandesha2_rm_elements_create(env);
     envelope = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
     action = (axis2_char_t*)axis2_msg_ctx_get_wsa_action(msg_ctx, env);
@@ -150,18 +158,17 @@
     if(create_seq)
     {
         sandesha2_msg_ctx_set_create_seq(rm_msg_ctx, env, create_seq);
-        rm_ns = sandesha2_create_seq_get_namespace_value(
-                 create_seq, env);
+        rm_ns = sandesha2_create_seq_get_namespace_value(create_seq, env);
     }
+
     create_seq_res = sandesha2_rm_elements_get_create_seq_res(rm_elements, env);
     if(create_seq_res)
     {
-        sandesha2_msg_ctx_set_create_seq_res(rm_msg_ctx, env, 
-            create_seq_res);
-        rm_ns = sandesha2_create_seq_res_get_namespace_value(
-                 create_seq_res, env);
-        add_op_if_null(env, msg_ctx);
+        sandesha2_msg_ctx_set_create_seq_res(rm_msg_ctx, env, create_seq_res);
+        rm_ns = sandesha2_create_seq_res_get_namespace_value(create_seq_res, env);
+        /*add_op_if_null(env, msg_ctx);*/
     }
+
     seq = sandesha2_rm_elements_get_seq(rm_elements, env);
     if(seq)
     {
@@ -175,7 +182,7 @@
         sandesha2_msg_ctx_set_seq_ack(rm_msg_ctx, env, seq_ack);
         rm_ns = sandesha2_seq_ack_get_namespace_value(
                  seq_ack, env);
-        add_op_if_null(env, msg_ctx);
+        /*add_op_if_null(env, msg_ctx);*/
     }
     terminate_seq = sandesha2_rm_elements_get_terminate_seq(rm_elements, env);
     if(terminate_seq)
@@ -183,7 +190,7 @@
         sandesha2_msg_ctx_set_terminate_seq(rm_msg_ctx, env, terminate_seq);
         rm_ns = sandesha2_terminate_seq_get_namespace_value(
                  terminate_seq, env);
-        add_op_if_null(env, msg_ctx);
+        /*add_op_if_null(env, msg_ctx);*/
     }
     terminate_seq_res = sandesha2_rm_elements_get_terminate_seq_res(rm_elements, 
         env);
@@ -193,7 +200,7 @@
             terminate_seq_res);
         rm_ns = sandesha2_terminate_seq_res_get_namespace_value(
                  terminate_seq_res, env);
-        add_op_if_null(env, msg_ctx);
+        /*add_op_if_null(env, msg_ctx);*/
     }
     ack_request = sandesha2_rm_elements_get_ack_requested(rm_elements, env);
     if(ack_request)
@@ -219,35 +226,35 @@
             close_seq_res);
         rm_ns = sandesha2_close_seq_res_get_namespace_value(
                  close_seq_res, env);
-        add_op_if_null(env, msg_ctx);
+        /*add_op_if_null(env, msg_ctx);*/
     }
     make_conn = sandesha2_rm_elements_get_make_connection(rm_elements, env);
     if(make_conn)
     {
-        sandesha2_msg_ctx_set_make_connection(rm_msg_ctx, env, 
-            make_conn);
+        sandesha2_msg_ctx_set_make_connection(rm_msg_ctx, env, make_conn);
         rm_ns = sandesha2_make_connection_get_namespace_value(make_conn, env);
-        add_op_if_null(env, msg_ctx);
+        /*add_op_if_null(env, msg_ctx);*/
     }
     msg_pending = sandesha2_rm_elements_get_msg_pending(rm_elements, env);
     if(msg_pending)
     {
-        sandesha2_msg_ctx_set_msg_pending(rm_msg_ctx, env, 
-            msg_pending);
-        rm_ns = sandesha2_msg_pending_get_namespace_value(
-                 msg_pending, env);
-        add_op_if_null(env, msg_ctx);
+        sandesha2_msg_ctx_set_msg_pending(rm_msg_ctx, env, msg_pending);
+        rm_ns = sandesha2_msg_pending_get_namespace_value(msg_pending, env);
+        /*add_op_if_null(env, msg_ctx);*/
     }
     sandesha2_msg_ctx_set_rm_ns_val(rm_msg_ctx, env, rm_ns);
     if(addressing_ns)
     {
-        sandesha2_msg_ctx_set_addr_ns_val(rm_msg_ctx, env, 
-                addressing_ns);
+        sandesha2_msg_ctx_set_addr_ns_val(rm_msg_ctx, env, addressing_ns);
     }
+
     if(rm_elements)
+    {
         sandesha2_rm_elements_free(rm_elements, env);
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "[sandesha2]Exit:populate_rm_msg_ctx");
+    }
+
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2]Exit:populate_rm_msg_ctx");
+
     return AXIS2_SUCCESS;
 }
 
@@ -363,9 +370,9 @@
     else if(make_conn)
     {
         sandesha2_identifier_t *idf = NULL;
-        sandesha2_address_t *address = NULL;
-        sandesha2_msg_ctx_set_msg_type(rm_msg_ctx, env, 
-            SANDESHA2_MSG_TYPE_MAKE_CONNECTION_MSG);
+        sandesha2_mc_address_t *address = NULL;
+
+        sandesha2_msg_ctx_set_msg_type(rm_msg_ctx, env, SANDESHA2_MSG_TYPE_MAKE_CONNECTION_MSG);
         idf = sandesha2_make_connection_get_identifier(make_conn, env);
         address = sandesha2_make_connection_get_address(make_conn, env);
         if(idf)
@@ -402,7 +409,7 @@
         sandesha2_seq_property_bean_t *internal_seq_id_bean = NULL;
 
         internal_seq_id_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, 
-                env, seq_id, SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID);
+                env, seq_id, SANDESHA2_SEQUENCE_PROPERTY_RMS_INTERNAL_SEQ_ID);
         if(internal_seq_id_bean)
         {
             prop_key = axutil_strdup(env, sandesha2_seq_property_bean_get_value(
@@ -469,19 +476,19 @@
         axutil_qname_t *tmp_qname = NULL;
     
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-            "[sandesha2]Message context operation is NULL. So adding default "\
-            "operation");
-        tmp_qname = axutil_qname_create(env, "__OPERATION_OUT_IN__", NULL, 
-            NULL);
+            "[sandesha2]Message context operation is NULL. So adding default operation");
+        tmp_qname = axutil_qname_create(env, "__OPERATION_OUT_IN__", NULL, NULL);
         if (!tmp_qname)
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, 
-                AXIS2_FAILURE);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
             return;
         }
         svc = axis2_msg_ctx_get_svc(msg_ctx, env);
         if(svc)
+        {
             op = axis2_svc_get_op_with_qname(svc, env, tmp_qname);
+        }
+
         if(!op)
         {
             axis2_status_t status = AXIS2_FAILURE;
@@ -496,6 +503,7 @@
             info = axis2_conf_get_phases_info(conf, env);
             axis2_phases_info_set_op_phases(info, env, op);
             status = axis2_svc_add_op(svc, env, op);
+
             if(AXIS2_SUCCESS == status)
             {
                 status = axis2_msg_ctx_set_op(msg_ctx, env, op);
@@ -511,8 +519,12 @@
                 op = NULL;
             }
         }
+
         if(tmp_qname)
+        {
             axutil_qname_free(tmp_qname, env);
+        }
+
         axis2_msg_ctx_set_op(msg_ctx, env, op);
     }
 }

Modified: webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c?rev=690127&r1=690126&r2=690127&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c (original)
+++ webservices/sandesha/trunk/c/src/util/msg_retrans_adjuster.c Thu Aug 28 23:56:29 2008
@@ -26,7 +26,6 @@
 #include <sandesha2_create_seq_mgr.h>
 #include <sandesha2_sender_mgr.h>
 
-/******************************************************************************/
 sandesha2_sender_bean_t * AXIS2_CALL
 sandesha2_msg_retrans_adjuster_adjust_next_retrans_time(
     const axutil_env_t *env, 
@@ -42,17 +41,13 @@
 static axis2_status_t AXIS2_CALL
 sandesha2_msg_retrans_adjuster_finalize_timedout_seq(
     const axutil_env_t *env,
-    axis2_char_t *int_seq_id,
-    axis2_char_t *seq_id,
-    axis2_msg_ctx_t *msg_ctx,
+    axis2_char_t *internal_sequence_id,
+    axis2_conf_ctx_t *conf_ctx,
     sandesha2_storage_mgr_t *storage_mgr,
     sandesha2_seq_property_mgr_t *seq_prop_mgr,
     sandesha2_create_seq_mgr_t *create_seq_mgr,
     sandesha2_sender_mgr_t *sender_mgr);
 
-/******************************************************************************/
-
-
 AXIS2_EXTERN axis2_bool_t AXIS2_CALL
 sandesha2_msg_retrans_adjuster_adjust_retrans(
     const axutil_env_t *env,
@@ -64,10 +59,7 @@
     sandesha2_sender_mgr_t *sender_mgr)
 {
     axis2_char_t *stored_key = NULL;
-    axis2_msg_ctx_t *msg_ctx = NULL;
-    sandesha2_msg_ctx_t *rm_msg_ctx = NULL;
-    axis2_char_t *int_seq_id = NULL;
-    axis2_char_t *seq_id = NULL;
+    axis2_char_t *internal_sequence_id = NULL;
     sandesha2_property_bean_t *property_bean = NULL;
     int max_attempts = -1;
     int sent_count = -1;
@@ -88,49 +80,48 @@
     if(!stored_key)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "[sandesha2]Stored Key not present in the retransmittable message");
+            "[sandesha2] Stored Key not present in the retransmittable message");
         return AXIS2_FALSE;
     }
-    msg_ctx = sandesha2_storage_mgr_retrieve_msg_ctx(storage_mgr, env, 
-        stored_key, conf_ctx, AXIS2_FALSE);
-    if(msg_ctx)
-        rm_msg_ctx = sandesha2_msg_init_init_msg(env, msg_ctx);
-    int_seq_id = sandesha2_sender_bean_get_internal_seq_id(sender_bean, env);
-    seq_id = sandesha2_sender_bean_get_seq_id(sender_bean, env);
+
+    internal_sequence_id = sandesha2_sender_bean_get_internal_seq_id(sender_bean, env);
    
-    property_bean = sandesha2_utils_get_property_bean(env, 
-        axis2_conf_ctx_get_conf(conf_ctx, env));
+    property_bean = sandesha2_utils_get_property_bean(env, axis2_conf_ctx_get_conf(conf_ctx, env));
     sent_count = sandesha2_sender_bean_get_sent_count(sender_bean, env) + 1;
     sandesha2_sender_bean_set_sent_count(sender_bean, env, sent_count);
-    sandesha2_msg_retrans_adjuster_adjust_next_retrans_time(env, sender_bean,
-        property_bean);
-    max_attempts = sandesha2_property_bean_get_max_retrans_count(property_bean, 
-        env);
+    sandesha2_msg_retrans_adjuster_adjust_next_retrans_time(env, sender_bean, property_bean);
+
+    max_attempts = sandesha2_property_bean_get_max_retrans_count(property_bean, env);
     if(max_attempts > 0 &&  sent_count > max_attempts)
+    {
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+            "[sandesha2] Sent count %d > %d specified in module.xml for sequence with internal "\
+            "sequence id %s", sent_count, max_attempts, internal_sequence_id);
+
         timeout_seq = AXIS2_TRUE;
-    if(rm_msg_ctx)
-        seq_timed_out = sandesha2_seq_mgr_has_seq_timedout(env, int_seq_id, 
-            rm_msg_ctx, seq_prop_mgr, conf_ctx);
+    }
+
+    seq_timed_out = sandesha2_seq_mgr_has_seq_timedout(env, internal_sequence_id, seq_prop_mgr, 
+            conf_ctx);
     
-    if(AXIS2_TRUE == seq_timed_out)
+    if(seq_timed_out)
     {
         timeout_seq = AXIS2_TRUE;
         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
-            "[sandesha2]Sequence with internal_seq_id %s timed out", int_seq_id);
+            "[sandesha2]Sequence with internal_sequence_id %s timed out", internal_sequence_id);
     }
         
     if(timeout_seq)
     {
         sandesha2_sender_bean_set_send(sender_bean, env, AXIS2_FALSE);
-        sandesha2_msg_retrans_adjuster_finalize_timedout_seq(env, int_seq_id,
-            seq_id, msg_ctx, storage_mgr, seq_prop_mgr, create_seq_mgr, 
-            sender_mgr);
+        sandesha2_msg_retrans_adjuster_finalize_timedout_seq(env, internal_sequence_id, 
+            conf_ctx, storage_mgr, seq_prop_mgr, create_seq_mgr, sender_mgr);
         continue_sending = AXIS2_FALSE;
     }
-    if(rm_msg_ctx)
-        sandesha2_msg_ctx_free(rm_msg_ctx, env);
+
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "[sandesha2]Exit:sandesha2_msg_retrans_adjuster_adjust_retrans");
+            "[sandesha2] Exit:sandesha2_msg_retrans_adjuster_adjust_retrans");
+
     return continue_sending;
 }
 
@@ -147,25 +138,28 @@
     long time_now = -1;
    
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "[sandesha2]Entry:sandesha2_msg_retrans_adjuster_adjust_next_retrans_time");
+        "[sandesha2] Entry:sandesha2_msg_retrans_adjuster_adjust_next_retrans_time");
+
     AXIS2_PARAM_CHECK(env->error, sender_bean, NULL);
     AXIS2_PARAM_CHECK(env->error, property_bean, NULL);
     
     count = sandesha2_sender_bean_get_sent_count(sender_bean, env);
-    base_interval = sandesha2_property_bean_get_retrans_interval(property_bean,
-        env);
+    base_interval = sandesha2_property_bean_get_retrans_interval(property_bean, env);
     new_interval = base_interval;
-    if(AXIS2_TRUE == sandesha2_property_bean_is_exp_backoff(property_bean, env))
+    if(sandesha2_property_bean_is_exp_backoff(property_bean, env))
     {
-        new_interval = sandesha2_msg_retrans_adjuster_next_exp_backoff_diff(env,
-            count, base_interval);
+        new_interval = sandesha2_msg_retrans_adjuster_next_exp_backoff_diff(env, count, 
+                base_interval);
     }
+
     time_now = sandesha2_utils_get_current_time_in_millis(env);
     
     new_time_to_send = time_now + new_interval;
     sandesha2_sender_bean_set_time_to_send(sender_bean, env, new_time_to_send);
+
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "[sandesha2]Exit:sandesha2_msg_retrans_adjuster_adjust_next_retrans_time");
+        "[sandesha2] Exit:sandesha2_msg_retrans_adjuster_adjust_next_retrans_time");
+
     return sender_bean;
 }
 
@@ -186,31 +180,24 @@
 static axis2_status_t AXIS2_CALL
 sandesha2_msg_retrans_adjuster_finalize_timedout_seq(
     const axutil_env_t *env,
-    axis2_char_t *int_seq_id,
-    axis2_char_t *seq_id,
-    axis2_msg_ctx_t *msg_ctx,
+    axis2_char_t *internal_sequence_id,
+    axis2_conf_ctx_t *conf_ctx,
     sandesha2_storage_mgr_t *storage_mgr,
     sandesha2_seq_property_mgr_t *seq_prop_mgr,
     sandesha2_create_seq_mgr_t *create_seq_mgr,
     sandesha2_sender_mgr_t *sender_mgr)
 {
-    axis2_conf_ctx_t *conf_ctx = NULL;
-    axis2_ctx_t *ctx = NULL;
-    
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "[sandesha2]Entry:sandesha2_msg_retrans_adjuster_finalize_timedout_seq");
-    AXIS2_PARAM_CHECK(env->error, int_seq_id, AXIS2_FAILURE);
-    AXIS2_PARAM_CHECK(env->error, seq_id, AXIS2_FAILURE);
-    AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
+        "[sandesha2] Entry:sandesha2_msg_retrans_adjuster_finalize_timedout_seq");
+
+    AXIS2_PARAM_CHECK(env->error, internal_sequence_id, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, conf_ctx, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, storage_mgr, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, seq_prop_mgr, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, create_seq_mgr, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, sender_mgr, AXIS2_FAILURE);
     
-    conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-    ctx = axis2_conf_ctx_get_base(conf_ctx, env);
-    
-    sandesha2_terminate_mgr_time_out_sending_side_seq(env, conf_ctx, int_seq_id,
+    sandesha2_terminate_mgr_time_out_sending_side_seq(env, conf_ctx, internal_sequence_id,
         AXIS2_FALSE, storage_mgr, seq_prop_mgr, create_seq_mgr, sender_mgr);
  
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 

Modified: webservices/sandesha/trunk/c/src/util/property_bean.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/property_bean.c?rev=690127&r1=690126&r2=690127&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/property_bean.c (original)
+++ webservices/sandesha/trunk/c/src/util/property_bean.c Thu Aug 28 23:56:29 2008
@@ -34,6 +34,7 @@
     axutil_array_list_t *msg_types_to_drop;
     int max_retrans_count;
     int terminate_delay;
+    int polling_delay;
     axis2_char_t *db_path;
 };
 
@@ -60,6 +61,7 @@
     bean->msg_types_to_drop = NULL;
     bean->max_retrans_count = 0;
     bean->terminate_delay = 0;
+    bean->polling_delay = 0;
     bean->db_path = NULL;
     
 	return bean;
@@ -324,3 +326,21 @@
     return AXIS2_SUCCESS;
 }
 
+int AXIS2_CALL
+sandesha2_property_bean_get_polling_delay (
+    sandesha2_property_bean_t *bean,
+    const axutil_env_t *env)
+{
+    return bean->polling_delay;
+}
+            
+axis2_status_t AXIS2_CALL
+sandesha2_property_bean_set_polling_delay(
+    sandesha2_property_bean_t *bean,
+    const axutil_env_t *env, 
+    int delay)
+{
+    bean->polling_delay = delay;
+    return AXIS2_SUCCESS;
+}
+



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org