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/28 21:48:59 UTC

svn commit: r689953 - in /webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008: config/ include/ src/handlers/ src/msgprocessors/ src/wsrm/

Author: damitha
Date: Thu Aug 28 12:48:58 2008
New Revision: 689953

URL: http://svn.apache.org/viewvc?rev=689953&view=rev
Log:
Fixed SANDESHA2C-56 jira

Modified:
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/config/module.xml
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_app_msg_processor.h
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_global_in_handler.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_in_handler.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/sequence.c

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/config/module.xml
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/config/module.xml?rev=689953&r1=689952&r2=689953&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/config/module.xml (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/config/module.xml Thu Aug 28 12:48:58 2008
@@ -7,7 +7,7 @@
     <inflow>
         <handler name="SandeshaGlobalInHandler" class="sandesha2">
             <!-- Global In handler should come before instance dispatching -->
-            <order phase="Dispatch" before="InstanceDispatcher" />
+            <order phase="PreDispatch" />
         </handler> 
         <handler name="SandeshaInHandler" class="sandesha2">
             <order phase="RMPhase"/>
@@ -23,7 +23,7 @@
     <INfaultflow>        
         <handler name="SandeshaGlobalInHandler" class="sandesha2">
             <!-- Global In handler should come before instance dispatching -->
-            <order phase="Dispatch" before="InstanceDispatcher" />
+            <order phase="PreDispatch" />
         </handler> 
         <handler name="SandeshaInHandler" class="sandesha2">
             <order phase="RMPhase"/>

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_app_msg_processor.h
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_app_msg_processor.h?rev=689953&r1=689952&r2=689953&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_app_msg_processor.h (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/include/sandesha2_app_msg_processor.h Thu Aug 28 12:48:58 2008
@@ -58,7 +58,8 @@
     axis2_char_t *rmd_sequence_id,
     struct sandesha2_storage_mgr *storage_mgr,
     struct sandesha2_sender_mgr *sender_mgr,
-    struct sandesha2_seq_property_mgr *seq_prop_mgr);
+    struct sandesha2_seq_property_mgr *seq_prop_mgr,
+    axis2_bool_t send_msg);
 
 /** @} */
 #ifdef __cplusplus

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_global_in_handler.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_global_in_handler.c?rev=689953&r1=689952&r2=689953&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_global_in_handler.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_global_in_handler.c Thu Aug 28 12:48:58 2008
@@ -102,6 +102,7 @@
         axutil_property_t *property = NULL;
         property = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
         axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_ISOLATED_LAST_MSG, property);
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Isolated last message");
         return AXIS2_SUCCESS;
     }
     if(!soap_action && !wsa_action)
@@ -118,9 +119,34 @@
             {
                 sandesha2_seq_t *sequence = NULL;
                 axiom_node_t *seq_node = NULL;
+                axiom_node_t *header_node = NULL;
+
                 sequence = sandesha2_seq_create(env, SANDESHA2_SPEC_2005_02_NS_URI);
-                seq_node = axiom_soap_header_get_base_node(header, env);
-                sandesha2_seq_from_om_node(sequence, env, seq_node);
+                header_node = axiom_soap_header_get_base_node(header, env);
+                if(header_node)
+                {
+                    axutil_qname_t *seq_qname = NULL;
+                    axiom_element_t *header_element = NULL;
+    
+                    seq_qname = axutil_qname_create(env, SANDESHA2_WSRM_COMMON_SEQ, 
+                            SANDESHA2_SPEC_2005_02_NS_URI, NULL);
+                    if(seq_qname)
+                    {
+                        axiom_element_t *seq_element = NULL;
+
+                        header_element = axiom_node_get_data_element(header_node, env);
+                        seq_element = axiom_element_get_first_child_with_qname(header_element, env,
+                            seq_qname, header_node, &seq_node);
+
+                        axutil_qname_free(seq_qname, env);
+                    }
+                }
+
+                if(sequence && seq_node)
+                {
+                    sandesha2_seq_from_om_node(sequence, env, seq_node);
+                }
+
                 if(sandesha2_seq_get_last_msg(sequence, env))
                 {
                     last_msg_header = AXIS2_TRUE;
@@ -137,15 +163,24 @@
                 if(body && !axiom_node_get_first_element(body_node, env))
                 {
                     axutil_property_t *property = NULL;
-                    axutil_string_t *temp_soap_action = axutil_string_create(env, 
-                        SANDESHA2_SPEC_2005_02_SOAP_ACTION_LAST_MESSAGE);
-                    /* There is an empty body so we know this is the kind of message
-                     * that we are looking for.
+                    axutil_string_t *temp_soap_action = NULL;
+
+                    /* There is an empty body so we know this is the kind of message that we are 
+                     * looking for.
                      */
                     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
                             "[sandesha2] Setting SOAP Action for a WSRM 1.0 last message");
 
-                    axis2_msg_ctx_set_soap_action(msg_ctx, env, temp_soap_action);
+                    temp_soap_action = axutil_string_create(env, 
+                            SANDESHA2_SPEC_2005_02_SOAP_ACTION_LAST_MESSAGE);
+                    if(temp_soap_action)
+                    {
+                        axis2_msg_ctx_set_soap_action(msg_ctx, env, temp_soap_action);
+                        axutil_string_free(temp_soap_action, env);
+                    }
+                    
+                    axis2_msg_ctx_set_wsa_action(msg_ctx, env, 
+                            SANDESHA2_SPEC_2005_02_SOAP_ACTION_LAST_MESSAGE);
 
                     property = axutil_property_create_with_args(env, 0, 0, 0, AXIS2_VALUE_TRUE);
                     axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_ISOLATED_LAST_MSG, property);

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_in_handler.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_in_handler.c?rev=689953&r1=689952&r2=689953&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_in_handler.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/handlers/sandesha2_in_handler.c Thu Aug 28 12:48:58 2008
@@ -400,7 +400,7 @@
                     sandesha2_seq_property_mgr_update(seq_prop_mgr, env, rcvd_msgs_bean);
                     app_msg_processor = sandesha2_app_msg_processor_create(env);
                     sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, bean_value, 
-                            rmd_sequence_id, storage_mgr, sender_mgr, seq_prop_mgr);
+                            rmd_sequence_id, storage_mgr, sender_mgr, seq_prop_mgr, AXIS2_FALSE);
                     sandesha2_msg_processor_free(app_msg_processor, env);
                 }
             }
@@ -539,7 +539,7 @@
                 {
                     app_msg_processor = sandesha2_app_msg_processor_create(env);
                     sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, rcvd_msgs_str, 
-                        rmd_sequence_id, storage_mgr, sender_mgr, seq_prop_mgr);
+                        rmd_sequence_id, storage_mgr, sender_mgr, seq_prop_mgr, AXIS2_FALSE);
                     
                     sandesha2_msg_processor_free(app_msg_processor, env);
                 }

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c?rev=689953&r1=689952&r2=689953&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c Thu Aug 28 12:48:58 2008
@@ -710,6 +710,8 @@
         if(last_msg)
         {
             sandesha2_seq_property_bean_t *seq_prop_bean = NULL;
+            
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Last message");
 
             seq_prop_bean = sandesha2_seq_property_bean_create_with_data(
                 env, rmd_sequence_id, SANDESHA2_SEQ_PROP_LAST_IN_MESSAGE_ID, msg_id);
@@ -733,9 +735,73 @@
     if(!axutil_strcmp(SANDESHA2_SPEC_2005_02_ACTION_LAST_MESSAGE, wsa_action) || 0 == axutil_strcmp(
                 SANDESHA2_SPEC_2005_02_SOAP_ACTION_LAST_MESSAGE, soap_action)) 
     {
-        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]Got WSRM 1.0 last message, aborting");
+        axis2_status_t status = AXIS2_FAILURE;
+        axis2_bool_t send_response = AXIS2_TRUE;
+        axis2_svc_t *temp_svc = NULL;
+
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+                "[sandesha2] Got WSRM 1.0 last message. Send ack and aborting");
+
         sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, msgs_str, rmd_sequence_id, 
-                storage_mgr, sender_mgr, seq_prop_mgr);
+                storage_mgr, sender_mgr, seq_prop_mgr, AXIS2_FALSE);
+
+        temp_svc = axis2_msg_ctx_get_svc(app_msg_ctx, env);
+        if(temp_svc)
+        {
+            const axis2_char_t *svc_name = axis2_svc_get_name(temp_svc, env);
+
+            if(!axutil_strcmp("__ANONYMOUS_SERVICE__", svc_name))
+            {
+                send_response = AXIS2_FALSE;
+                status =  AXIS2_SUCCESS;
+            }
+        }
+        else
+        {
+            send_response = AXIS2_FALSE;
+            status =  AXIS2_SUCCESS;
+        }
+        
+        if(send_response)
+        {
+            axis2_char_t *storage_key = NULL;
+            axis2_char_t *outgoing_int_seq_id = NULL;
+            axis2_msg_ctx_t *out_msg_ctx = NULL;
+            sandesha2_msg_ctx_t *out_rm_msg_ctx = NULL;
+            axis2_op_ctx_t *op_ctx = NULL;
+            axutil_qname_t *temp_qname = NULL;
+            axis2_op_t *anon_out_op = NULL;
+
+            outgoing_int_seq_id = sandesha2_utils_get_internal_sequence_id(env, rmd_sequence_id);
+
+            out_msg_ctx = axis2_core_utils_create_out_msg_ctx(env, app_msg_ctx);
+            if(out_msg_ctx)
+            {
+                out_rm_msg_ctx = sandesha2_msg_init_init_msg(env, out_msg_ctx);
+            }
+            else
+            {
+                return AXIS2_FAILURE;
+            }
+        
+            temp_qname = axutil_qname_create(env, "__OPERATION_OUT_ONLY__", NULL, NULL);
+            if (!temp_qname)
+            {
+                return AXIS2_FAILURE;
+            }
+        
+            anon_out_op = axis2_op_create_with_qname(env, temp_qname);
+            axutil_qname_free(temp_qname, env);
+
+            op_ctx = axis2_op_ctx_create(env, anon_out_op, NULL);
+            status = axis2_op_ctx_add_msg_ctx(op_ctx, env, out_msg_ctx);
+            status = axis2_op_ctx_add_msg_ctx(op_ctx, env, app_msg_ctx);
+            axis2_msg_ctx_set_op_ctx(out_msg_ctx, env, op_ctx);
+
+            storage_key = axutil_uuid_gen(env);
+            status = sandesha2_app_msg_processor_send_app_msg(env, out_rm_msg_ctx, outgoing_int_seq_id, 
+                msg_no, storage_key, storage_mgr, create_seq_mgr, seq_prop_mgr, sender_mgr);
+        }
 
         sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);
 
@@ -756,7 +822,8 @@
         {
             AXIS2_FREE(env->allocator, msgs_str);
         }
-        return AXIS2_SUCCESS;
+
+        return status;
     }
 
     if(axis2_msg_ctx_get_server_side(app_msg_ctx, env) && in_order_invoke)
@@ -852,7 +919,7 @@
     }
 
     if(!sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, msgs_str, rmd_sequence_id, storage_mgr, 
-                sender_mgr, seq_prop_mgr))
+                sender_mgr, seq_prop_mgr, AXIS2_FALSE))
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Sending acknowledgment failed");
 
@@ -1721,7 +1788,8 @@
     axis2_char_t *rmd_sequence_id,
     sandesha2_storage_mgr_t *storage_mgr,
     sandesha2_sender_mgr_t *sender_mgr,
-    sandesha2_seq_property_mgr_t *seq_prop_mgr)
+    sandesha2_seq_property_mgr_t *seq_prop_mgr,
+    axis2_bool_t send_msg)
 {
     /*axis2_endpoint_ref_t *to_epr = NULL;
     axis2_endpoint_ref_t *temp_to_epr = NULL;*/
@@ -1811,7 +1879,7 @@
     is_anonymous_reply_to = !reply_to_addr || (reply_to_addr && sandesha2_utils_is_anon_uri(env, reply_to_addr));
     /*if(sandesha2_utils_is_rm_1_0_anonymous_acks_to(env, rm_version, acks_to_str) 
             && is_anonymous_reply_to && !one_way)*/
-    if(sandesha2_utils_is_anon_uri(env, acks_to_str) && is_anonymous_reply_to && !one_way)
+    if(sandesha2_utils_is_anon_uri(env, acks_to_str) && is_anonymous_reply_to && !one_way && !send_msg)
     {
         /* This means acknowledgment address is anomymous and RM version is 1.0. Flow comes to
          * this block only in the server side.

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/sequence.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/sequence.c?rev=689953&r1=689952&r2=689953&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/sequence.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/sequence.c Thu Aug 28 12:48:58 2008
@@ -131,45 +131,61 @@
     axiom_node_t *lm_node = NULL;
     axutil_qname_t *lm_qname = NULL; 
     AXIS2_PARAM_CHECK(env->error, seq_node, NULL);
+        
     seq_part = axiom_node_get_data_element(seq_node, env);
     if(!seq_part)
     {
-        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_NULL_OM_ELEMENT,
-            AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+                "[sandesha2] Sequence element not found in the sequence node");
+
+        AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_NULL_OM_ELEMENT, AXIS2_FAILURE);
         return NULL;
     }
+
     seq->identifier = sandesha2_identifier_create(env, seq->ns_val);
     if(!seq->identifier)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+                "[sandesha2] Sequence identifier not found in the sequence node");
+
         return NULL;
     }
+
     sandesha2_identifier_from_om_node(seq->identifier, env, seq_node);
     seq->msg_num= sandesha2_msg_number_create(env, seq->ns_val);
     if(!seq->msg_num)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+                "[sandesha2] Sequence message number not found in the sequence node");
+
         return NULL;
     }
+
     sandesha2_msg_number_from_om_node(seq->msg_num, env, seq_node);
-    lm_qname = axutil_qname_create(env, SANDESHA2_WSRM_COMMON_LAST_MSG,
-        seq->ns_val, NULL);
+    lm_qname = axutil_qname_create(env, SANDESHA2_WSRM_COMMON_LAST_MSG, seq->ns_val, NULL);
+    
     if(!lm_qname)
     {
         return NULL;
     }
-    lm_part = axiom_element_get_first_child_with_qname(seq_part, env, 
-        lm_qname, seq_node, &lm_node);
+
+    lm_part = axiom_element_get_first_child_with_qname(seq_part, env, lm_qname, seq_node, &lm_node);
     if(lm_qname)
+    {
         axutil_qname_free(lm_qname, env);
+    }
+
     if(lm_part)
     {
-        seq->last_msg = sandesha2_last_msg_create(env, 
-            seq->ns_val);
+        seq->last_msg = sandesha2_last_msg_create(env, seq->ns_val);
         if(!seq->last_msg)
         {
             return NULL;
         }
+
         sandesha2_last_msg_from_om_node(seq->last_msg, env, lm_node);
     }
+
     return seq;
 }
 



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