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 [4/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/msgprocessors/app_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c?rev=690127&r1=690126&r2=690127&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c (original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Thu Aug 28 23:56:29 2008
@@ -47,15 +47,20 @@
#include <sandesha2_msg_creator.h>
#include <sandesha2_client_constants.h>
#include <sandesha2_terminate_mgr.h>
+#include <sandesha2_msg_retrans_adjuster.h>
#include <axis2_const.h>
+#include <axutil_types.h>
#include <axis2_msg_ctx.h>
#include <axutil_string.h>
#include <axis2_engine.h>
#include <axutil_uuid_gen.h>
#include <axis2_relates_to.h>
+#include <axis2_core_utils.h>
#include <axiom_soap_const.h>
#include <axiom_soap_body.h>
+#include <axis2_http_transport_utils.h>
+#include <platforms/axutil_platform_auto_sense.h>
/**
* @brief Application Message Processor struct impl
@@ -71,7 +76,51 @@
#define SANDESHA2_INTF_TO_IMPL(msg_proc) \
((sandesha2_app_msg_processor_impl_t *)(msg_proc))
-/***************************** Function headers *******************************/
+typedef struct sandesha2_app_msg_processor_args sandesha2_app_msg_processor_args_t;
+
+struct sandesha2_app_msg_processor_args
+{
+ axutil_env_t *env;
+ axis2_conf_ctx_t *conf_ctx;
+ axis2_char_t *internal_sequence_id;
+ axis2_char_t *msg_id;
+ axis2_bool_t is_server_side;
+ int retrans_interval;
+ void *bean;
+ void *msg_ctx;
+};
+
+static void * AXIS2_THREAD_FUNC
+sandesha2_app_msg_processor_create_seq_msg_worker_function(
+ axutil_thread_t *thd,
+ void *data);
+
+static axis2_status_t
+sandesha2_app_msg_processor_start_create_seq_msg_resender(
+ const axutil_env_t *env,
+ axis2_conf_ctx_t *conf_ctx,
+ axis2_char_t *internal_sequence_id,
+ axis2_char_t *msg_id,
+ const axis2_bool_t is_server_side,
+ int retrans_interval,
+ sandesha2_sender_bean_t *create_sequence_sender_bean,
+ axis2_msg_ctx_t *create_seq_msg_ctx);
+
+static void * AXIS2_THREAD_FUNC
+sandesha2_app_msg_processor_application_msg_worker_function(
+ axutil_thread_t *thd,
+ void *data);
+
+static axis2_status_t
+sandesha2_app_msg_processor_start_application_msg_resender(
+ const axutil_env_t *env,
+ axis2_conf_ctx_t *conf_ctx,
+ axis2_char_t *internal_sequence_id,
+ axis2_char_t *msg_id,
+ const axis2_bool_t is_server_side,
+ int retrans_interval,
+ axis2_msg_ctx_t *app_msg_ctx);
+
static axis2_status_t AXIS2_CALL
sandesha2_app_msg_processor_process_in_msg (
sandesha2_msg_processor_t *msg_processor,
@@ -92,7 +141,18 @@
long num);
static axis2_status_t AXIS2_CALL
-sandesha2_app_msg_processor_add_create_seq_msg(
+sandesha2_app_msg_processor_process_create_seq_response(
+ const axutil_env_t *env,
+ axis2_msg_ctx_t *create_seq_msg_ctx,
+ sandesha2_storage_mgr_t *storage_mgr);
+
+static axis2_status_t AXIS2_CALL
+sandesha2_app_msg_processor_process_app_msg_response(
+ const axutil_env_t *env,
+ axis2_msg_ctx_t *app_msg_ctx);
+
+static axis2_status_t AXIS2_CALL
+sandesha2_app_msg_processor_send_create_seq_msg(
const axutil_env_t *env,
sandesha2_msg_ctx_t *msg_ctx,
axis2_char_t *internal_seq_id,
@@ -103,17 +163,30 @@
sandesha2_sender_mgr_t *sender_mgr);
static axis2_status_t AXIS2_CALL
-sandesha2_app_msg_processor_process_response_msg(
+sandesha2_app_msg_processor_send_app_msg(
const axutil_env_t *env,
sandesha2_msg_ctx_t *msg_ctx,
axis2_char_t *internal_seq_id,
- axis2_char_t *out_seq_id,
long msg_num,
axis2_char_t *storage_key,
sandesha2_storage_mgr_t *storage_mgr,
+ sandesha2_create_seq_mgr_t *create_seq_mgr,
sandesha2_seq_property_mgr_t *seq_prop_mgr,
sandesha2_sender_mgr_t *sender_mgr);
+static axis2_status_t
+sandesha2_app_msg_processor_resend(
+ const axutil_env_t *env,
+ axis2_conf_ctx_t *conf_ctx,
+ axis2_char_t *msg_id,
+ axis2_bool_t is_svr_side,
+ const axis2_char_t *internal_seq_id,
+ 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_msg_ctx_t *app_msg_ctx);
+
static axis2_status_t AXIS2_CALL
sandesha2_app_msg_processor_set_next_msg_no(
const axutil_env_t *env,
@@ -126,16 +199,13 @@
sandesha2_msg_processor_t *element,
const axutil_env_t *env);
-/***************************** End of function headers ************************/
-
AXIS2_EXTERN sandesha2_msg_processor_t* AXIS2_CALL
sandesha2_app_msg_processor_create(
const axutil_env_t *env)
{
sandesha2_app_msg_processor_impl_t *msg_proc_impl = NULL;
- msg_proc_impl = (sandesha2_app_msg_processor_impl_t *)AXIS2_MALLOC
- (env->allocator,
+ msg_proc_impl = (sandesha2_app_msg_processor_impl_t *)AXIS2_MALLOC (env->allocator,
sizeof(sandesha2_app_msg_processor_impl_t));
if(!msg_proc_impl)
@@ -173,9 +243,12 @@
msg_proc_impl = SANDESHA2_INTF_TO_IMPL(msg_processor);
if(msg_processor->ops)
+ {
AXIS2_FREE(env->allocator, msg_processor->ops);
+ }
AXIS2_FREE(env->allocator, SANDESHA2_INTF_TO_IMPL(msg_processor));
+
return AXIS2_SUCCESS;
}
@@ -186,7 +259,7 @@
const axutil_env_t *env,
sandesha2_msg_ctx_t *rm_msg_ctx)
{
- axis2_msg_ctx_t *msg_ctx = NULL;
+ axis2_msg_ctx_t *app_msg_ctx = NULL;
axis2_char_t *processed = NULL;
axis2_op_ctx_t *op_ctx = NULL;
axis2_conf_ctx_t *conf_ctx = NULL;
@@ -194,11 +267,11 @@
sandesha2_storage_mgr_t *storage_mgr = NULL;
sandesha2_msg_ctx_t *fault_ctx = NULL;
sandesha2_seq_t *seq = NULL;
- axis2_char_t *str_seq_id = NULL;
+ axis2_char_t *rmd_sequence_id = NULL;
sandesha2_seq_property_bean_t *msgs_bean = NULL;
long msg_no = 0;
long highest_in_msg_no = 0;
- axis2_char_t *msgs_str = "";
+ axis2_char_t *msgs_str = NULL;
axis2_char_t msg_num_str[32];
sandesha2_invoker_mgr_t *invoker_mgr = NULL;
sandesha2_sender_mgr_t *sender_mgr = NULL;
@@ -211,30 +284,18 @@
axis2_char_t *highest_in_msg_no_str = NULL;
axis2_char_t *highest_in_msg_key_str = NULL;
axis2_bool_t msg_no_present_in_list = AXIS2_FALSE;
- axis2_endpoint_ref_t *reply_to_epr = NULL;
- axis2_endpoint_ref_t *to_epr = NULL;
- const axis2_char_t *reply_to_addr = NULL;
- const axis2_char_t *to_addr = NULL;
const axutil_string_t *str_soap_action = NULL;
const axis2_char_t *wsa_action = NULL;
const axis2_char_t *soap_action = NULL;
- axis2_char_t *rm_version = NULL;
- sandesha2_seq_property_bean_t *acks_to_bean = NULL;
- sandesha2_seq_property_bean_t *to_bean = NULL;
- axis2_char_t *acks_to_str = NULL;
- /*axis2_endpoint_ref_t *acks_to = NULL;*/
- axis2_bool_t back_channel_free = AXIS2_FALSE;
- axis2_op_t *op = NULL;
- int mep = -1;
axis2_char_t *dbname = NULL;
- /*axis2_char_t *last_out_msg_no_str = NULL;*/
AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
+
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
"[sandesha2]Entry:sandesha2_app_msg_processor_process_in_msg");
- msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
- if(!msg_ctx)
+ app_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
+ if(!app_msg_ctx)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"[sandesha2]Message context is not set");
@@ -242,6 +303,7 @@
AXIS2_FAILURE);
return AXIS2_FAILURE;
}
+
property = sandesha2_msg_ctx_get_property(rm_msg_ctx, env,
SANDESHA2_APPLICATION_PROCESSING_DONE);
@@ -249,21 +311,20 @@
{
processed = axutil_property_get_value(property, env);
}
- if(processed && 0 == axutil_strcmp(processed, "true"))
+ if(processed && !axutil_strcmp(processed, "true"))
{
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "[sandesha2]Message already processed. So returning here");
+ "[sandesha2] Message already processed. So returning here");
return AXIS2_SUCCESS;
}
- op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
+ op_ctx = axis2_msg_ctx_get_op_ctx(app_msg_ctx, env);
/*axis2_op_ctx_set_in_use(op_ctx, env, AXIS2_TRUE);*/
axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
- conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+ conf_ctx = axis2_msg_ctx_get_conf_ctx(app_msg_ctx, env);
dbname = sandesha2_util_get_dbname(env, conf_ctx);
storage_mgr = sandesha2_utils_get_storage_mgr(env, dbname);
- fault_ctx = sandesha2_fault_mgr_check_for_last_msg_num_exceeded(
- env, rm_msg_ctx, seq_prop_mgr);
+ fault_ctx = sandesha2_fault_mgr_check_for_last_msg_num_exceeded(env, rm_msg_ctx, seq_prop_mgr);
if(fault_ctx)
{
axis2_engine_t *engine = axis2_engine_create(env, conf_ctx);
@@ -271,76 +332,124 @@
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"[sandesha2]sandesha2_app_msg_processor_process_in_msg send Fault");
- if(!axis2_engine_send_fault(engine, env,
- sandesha2_msg_ctx_get_msg_ctx(fault_ctx, env)))
+ if(!axis2_engine_send_fault(engine, env, sandesha2_msg_ctx_get_msg_ctx(fault_ctx, env)))
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"[sandesha2]An error occured while sending the fault");
- AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SENDING_FAULT,
- AXIS2_FAILURE);
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SENDING_FAULT, AXIS2_FAILURE);
if(fault_ctx)
+ {
sandesha2_msg_ctx_free(fault_ctx, env);
+ }
if(engine)
+ {
axis2_engine_free(engine, env);
+ }
if(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
+ }
return AXIS2_FAILURE;
}
+
if(fault_ctx)
+ {
sandesha2_msg_ctx_free(fault_ctx, env);
+ }
if(engine)
+ {
axis2_engine_free(engine, env);
- axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
+ }
+ axis2_msg_ctx_set_paused(app_msg_ctx, env, AXIS2_TRUE);
if(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
+ }
return AXIS2_SUCCESS;
}
+
seq_prop_mgr = sandesha2_permanent_seq_property_mgr_create(env, dbname);
create_seq_mgr = sandesha2_permanent_create_seq_mgr_create(env, dbname);
next_msg_mgr = sandesha2_permanent_next_msg_mgr_create(env, dbname);
invoker_mgr = sandesha2_permanent_invoker_mgr_create(env, dbname);
sender_mgr = sandesha2_permanent_sender_mgr_create(env, dbname);
+
seq = sandesha2_msg_ctx_get_sequence(rm_msg_ctx, env);
sandesha2_seq_set_must_understand(seq, env, AXIS2_FALSE);
- str_seq_id = sandesha2_identifier_get_identifier(
- sandesha2_seq_get_identifier(seq, env), env);
- fault_ctx = sandesha2_fault_mgr_check_for_unknown_seq(env,rm_msg_ctx,
- str_seq_id, seq_prop_mgr, create_seq_mgr, next_msg_mgr);
+ rmd_sequence_id = sandesha2_identifier_get_identifier(sandesha2_seq_get_identifier(seq, env), env);
+ fault_ctx = sandesha2_fault_mgr_check_for_unknown_seq(env,rm_msg_ctx, rmd_sequence_id, seq_prop_mgr,
+ create_seq_mgr, next_msg_mgr);
if(fault_ctx)
{
axis2_engine_t *engine = axis2_engine_create(env, conf_ctx);
+
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"[sandesha2]sandesha2_app_msg_processor_process_in_msg send Fault");
- if(!axis2_engine_send_fault(engine, env,
- sandesha2_msg_ctx_get_msg_ctx(fault_ctx, env)))
+
+ if(seq_prop_mgr)
+ {
+ sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+ }
+ if(create_seq_mgr)
+ {
+ sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+ }
+ if(sender_mgr)
+ {
+ sandesha2_sender_mgr_free(sender_mgr, env);
+ }
+ if(next_msg_mgr)
+ {
+ sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+ }
+ if(invoker_mgr)
+ {
+ sandesha2_invoker_mgr_free(invoker_mgr, env);
+ }
+ if(storage_mgr)
+ {
+ sandesha2_storage_mgr_free(storage_mgr, env);
+ }
+
+ if(!axis2_engine_send_fault(engine, env, sandesha2_msg_ctx_get_msg_ctx(fault_ctx, env)))
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"[sandesha2]An error occured while sending the fault");
- AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SENDING_FAULT,
- AXIS2_FAILURE);
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SENDING_FAULT, AXIS2_FAILURE);
if(fault_ctx)
+ {
sandesha2_msg_ctx_free(fault_ctx, env);
+ }
if(engine)
+ {
axis2_engine_free(engine, env);
- if(seq_prop_mgr)
- sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
- if(create_seq_mgr)
- sandesha2_create_seq_mgr_free(create_seq_mgr, env);
- if(sender_mgr)
- sandesha2_sender_mgr_free(sender_mgr, env);
- if(next_msg_mgr)
- sandesha2_next_msg_mgr_free(next_msg_mgr, env);
- if(invoker_mgr)
- sandesha2_invoker_mgr_free(invoker_mgr, env);
- if(storage_mgr)
- sandesha2_storage_mgr_free(storage_mgr, env);
+ }
return AXIS2_FAILURE;
}
+
if(fault_ctx)
+ {
sandesha2_msg_ctx_free(fault_ctx, env);
+ }
if(engine)
+ {
axis2_engine_free(engine, env);
- axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
+ }
+ axis2_msg_ctx_set_paused(app_msg_ctx, env, AXIS2_TRUE);
+
+ return AXIS2_SUCCESS;
+ }
+
+ sandesha2_msg_ctx_add_soap_envelope(rm_msg_ctx, env);
+
+ fault_ctx = sandesha2_fault_mgr_check_for_seq_closed(env, rm_msg_ctx, rmd_sequence_id, seq_prop_mgr);
+ if(fault_ctx)
+ {
+ axis2_engine_t *engine = axis2_engine_create(env, conf_ctx);
+
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[sandesha2]sandesha2_app_msg_processor_process_in_msg send Fault");
+
if(seq_prop_mgr)
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
if(create_seq_mgr)
@@ -353,92 +462,75 @@
sandesha2_invoker_mgr_free(invoker_mgr, env);
if(storage_mgr)
sandesha2_storage_mgr_free(storage_mgr, env);
- return AXIS2_SUCCESS;
- }
- sandesha2_seq_set_must_understand(seq, env, AXIS2_FALSE);
- sandesha2_msg_ctx_add_soap_envelope(rm_msg_ctx, env);
- fault_ctx = sandesha2_fault_mgr_check_for_seq_closed(env, rm_msg_ctx,
- str_seq_id, seq_prop_mgr);
- if(fault_ctx)
- {
- axis2_engine_t *engine = axis2_engine_create(env, conf_ctx);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "[sandesha2]sandesha2_app_msg_processor_process_in_msg send Fault");
- if(!axis2_engine_send_fault(engine, env,
- sandesha2_msg_ctx_get_msg_ctx(fault_ctx, env)))
+
+ if(!axis2_engine_send_fault(engine, env, sandesha2_msg_ctx_get_msg_ctx(fault_ctx, env)))
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"[sandesha2]An error occured while sending the fault");
- AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SENDING_FAULT,
- AXIS2_FAILURE);
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SENDING_FAULT, AXIS2_FAILURE);
if(fault_ctx)
+ {
sandesha2_msg_ctx_free(fault_ctx, env);
+ }
if(engine)
+ {
axis2_engine_free(engine, env);
- if(seq_prop_mgr)
- sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
- if(create_seq_mgr)
- sandesha2_create_seq_mgr_free(create_seq_mgr, env);
- if(sender_mgr)
- sandesha2_sender_mgr_free(sender_mgr, env);
- if(next_msg_mgr)
- sandesha2_next_msg_mgr_free(next_msg_mgr, env);
- if(invoker_mgr)
- sandesha2_invoker_mgr_free(invoker_mgr, env);
- if(storage_mgr)
- sandesha2_storage_mgr_free(storage_mgr, env);
+ }
return AXIS2_FAILURE;
}
+
if(fault_ctx)
+ {
sandesha2_msg_ctx_free(fault_ctx, env);
+ }
if(engine)
+ {
axis2_engine_free(engine, env);
- axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
- if(seq_prop_mgr)
- sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
- if(create_seq_mgr)
- sandesha2_create_seq_mgr_free(create_seq_mgr, env);
- if(sender_mgr)
- sandesha2_sender_mgr_free(sender_mgr, env);
- if(next_msg_mgr)
- sandesha2_next_msg_mgr_free(next_msg_mgr, env);
- if(invoker_mgr)
- sandesha2_invoker_mgr_free(invoker_mgr, env);
- if(storage_mgr)
- sandesha2_storage_mgr_free(storage_mgr, env);
+ }
+
+ axis2_msg_ctx_set_paused(app_msg_ctx, env, AXIS2_TRUE);
+
return AXIS2_SUCCESS;
}
- sandesha2_seq_mgr_update_last_activated_time(env, str_seq_id,
- seq_prop_mgr);
- msgs_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
- str_seq_id,
- SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES);
- msg_no = sandesha2_msg_number_get_msg_num(sandesha2_seq_get_msg_num(
- seq, env), env);
+
+ sandesha2_seq_mgr_update_last_activated_time(env, rmd_sequence_id, seq_prop_mgr);
+ msg_no = sandesha2_msg_number_get_msg_num(sandesha2_seq_get_msg_num(seq, env), env);
+
if(0 == msg_no)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "[sandesha2]Invalid message number");
- AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_MSG_NUM,
- AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Invalid message number");
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_MSG_NUM, AXIS2_FAILURE);
if(seq_prop_mgr)
+ {
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+ }
if(create_seq_mgr)
+ {
sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+ }
if(sender_mgr)
+ {
sandesha2_sender_mgr_free(sender_mgr, env);
+ }
if(next_msg_mgr)
+ {
sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+ }
if(invoker_mgr)
+ {
sandesha2_invoker_mgr_free(invoker_mgr, env);
+ }
if(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
+ }
+
return AXIS2_FAILURE;
}
- highest_in_msg_no_str = sandesha2_utils_get_seq_property(env, str_seq_id,
- SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_NUMBER, seq_prop_mgr);
- highest_in_msg_key_str = sandesha2_utils_get_seq_property(env, str_seq_id,
- SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_KEY, seq_prop_mgr);
+ highest_in_msg_no_str = sandesha2_utils_get_seq_property(env, rmd_sequence_id,
+ SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_NUMBER, seq_prop_mgr);
+ highest_in_msg_key_str = sandesha2_utils_get_seq_property(env, rmd_sequence_id,
+ SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_KEY, seq_prop_mgr);
if(!highest_in_msg_key_str)
{
highest_in_msg_key_str = axutil_uuid_gen(env);
@@ -455,22 +547,40 @@
sandesha2_seq_property_bean_t *highest_msg_key_bean = NULL;
sandesha2_seq_property_bean_t *highest_msg_id_bean = NULL;
const axis2_char_t *msg_id = NULL;
+ /*axiom_soap_envelope_t *response_envelope = NULL;*/
+ /*int soap_version = -1;*/
+ axutil_property_t *property = NULL;
+ axis2_char_t *client_seq_key = NULL;
highest_in_msg_no = msg_no;
- msg_id = axis2_msg_ctx_get_msg_id(msg_ctx, env);
+ msg_id = axis2_msg_ctx_get_msg_id(app_msg_ctx, env);
highest_msg_no_bean = sandesha2_seq_property_bean_create_with_data(env,
- str_seq_id, SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_NUMBER,
+ rmd_sequence_id, SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_NUMBER,
msg_num_str);
highest_msg_key_bean = sandesha2_seq_property_bean_create_with_data(env,
- str_seq_id, SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_KEY,
+ rmd_sequence_id, SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_KEY,
highest_in_msg_key_str);
highest_msg_id_bean = sandesha2_seq_property_bean_create_with_data(env,
- str_seq_id, SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_ID,
+ rmd_sequence_id, SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_ID,
(axis2_char_t *)msg_id);
sandesha2_storage_mgr_remove_msg_ctx(storage_mgr, env,
highest_in_msg_key_str, conf_ctx, -1);
- sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env,
- highest_in_msg_key_str, msg_ctx);
+ sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, highest_in_msg_key_str, app_msg_ctx,
+ AXIS2_TRUE);
+
+ /*response_envelope = axis2_msg_ctx_get_soap_envelope(app_msg_ctx, env);*/
+ property = axis2_msg_ctx_get_property(app_msg_ctx, env, SANDESHA2_CLIENT_SEQ_KEY);
+ if(property)
+ {
+ client_seq_key = axutil_property_get_value(property, env);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
+ "[sandesha2]Client sequence key:%s found", client_seq_key);
+ }
+ else
+ {
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
+ "[sandesha2]Client sequence key not found");
+ }
if(highest_in_msg_no_str)
{
@@ -497,49 +607,76 @@
if(highest_msg_id_bean)
sandesha2_seq_property_bean_free(highest_msg_id_bean, env);
}
+
if(highest_in_msg_no_str)
+ {
AXIS2_FREE(env->allocator, highest_in_msg_no_str);
+ }
+
if(highest_in_msg_key_str)
+ {
AXIS2_FREE(env->allocator, highest_in_msg_key_str);
+ }
+
+ msgs_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, rmd_sequence_id,
+ SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES);
if(msgs_bean)
{
- msgs_str = sandesha2_seq_property_bean_get_value(msgs_bean, env);
+ axis2_char_t *temp_value = sandesha2_seq_property_bean_get_value(msgs_bean, env);
+ if(temp_value)
+ {
+ msgs_str = axutil_strdup(env, temp_value);
+ }
}
else
{
msgs_bean = sandesha2_seq_property_bean_create(env);
- sandesha2_seq_property_bean_set_seq_id(msgs_bean, env, str_seq_id);
+ sandesha2_seq_property_bean_set_seq_id(msgs_bean, env, rmd_sequence_id);
sandesha2_seq_property_bean_set_name(msgs_bean, env,
SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES);
- sandesha2_seq_property_bean_set_value(msgs_bean, env, msgs_str);
+
+ sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, msgs_bean);
+ }
+
+ if(msgs_str)
+ {
+ msg_no_present_in_list = sandesha2_app_msg_processor_msg_num_is_in_list(env, msgs_str, msg_no);
}
- msg_no_present_in_list = sandesha2_app_msg_processor_msg_num_is_in_list(env,
- msgs_str, msg_no);
- if(msg_no_present_in_list &&
- 0 == axutil_strcmp(SANDESHA2_QOS_DEFAULT_INVOCATION_TYPE,
- SANDESHA2_QOS_EXACTLY_ONCE))
+
+ if(msg_no_present_in_list && !axutil_strcmp(SANDESHA2_QOS_DEFAULT_INVOCATION_TYPE,
+ SANDESHA2_QOS_EXACTLY_ONCE))
{
sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);
}
+
if(!msg_no_present_in_list)
{
- if(msgs_str && 0 < axutil_strlen(msgs_str))
- msgs_str = axutil_strcat(env, msgs_str, ",", msg_num_str, NULL);
+ if(msgs_str)
+ {
+ axis2_char_t *tmp_str = NULL;
+
+ tmp_str = axutil_strcat(env, msgs_str, ",", msg_num_str, NULL);
+ AXIS2_FREE(env->allocator, msgs_str);
+ msgs_str = tmp_str;
+ }
else
+ {
msgs_str = axutil_strdup(env, msg_num_str);
+ }
+
sandesha2_seq_property_bean_set_value(msgs_bean, env, msgs_str);
sandesha2_seq_property_mgr_update(seq_prop_mgr, env, msgs_bean);
- if(msgs_str)
- AXIS2_FREE(env->allocator, msgs_str);
}
- next_msg_bean = sandesha2_next_msg_mgr_retrieve(next_msg_mgr, env,
- str_seq_id);
+
+ sandesha2_seq_property_bean_free(msgs_bean, env);
+
+ next_msg_bean = sandesha2_next_msg_mgr_retrieve(next_msg_mgr, env, rmd_sequence_id);
if(!next_msg_bean)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "[sandesha2]Sequence with seq_id:%s does not exist", str_seq_id);
- AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SEQ_NOT_EXIST,
- AXIS2_FAILURE);
+ "[sandesha2]Sequence with seq_id:%s does not exist", rmd_sequence_id);
+
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SEQ_NOT_EXIST, AXIS2_FAILURE);
if(seq_prop_mgr)
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
if(create_seq_mgr)
@@ -552,64 +689,165 @@
sandesha2_invoker_mgr_free(invoker_mgr, env);
if(storage_mgr)
sandesha2_storage_mgr_free(storage_mgr, env);
+
+ if(msgs_str)
+ {
+ AXIS2_FREE(env->allocator, msgs_str);
+ }
+
return AXIS2_FAILURE;
}
- in_order_invoke = sandesha2_property_bean_is_in_order(
- sandesha2_utils_get_property_bean(env,
+
+ sandesha2_next_msg_bean_free(next_msg_bean, env);
+
+ in_order_invoke = sandesha2_property_bean_is_in_order(sandesha2_utils_get_property_bean(env,
axis2_conf_ctx_get_conf(conf_ctx, env)), env);
/* test code */
- if(axis2_msg_ctx_get_server_side(msg_ctx, env))
+ if(axis2_msg_ctx_get_server_side(app_msg_ctx, env))
{
sandesha2_last_msg_t *last_msg = sandesha2_seq_get_last_msg(seq, env);
- axis2_char_t *msg_id = (axis2_char_t *)axis2_msg_ctx_get_msg_id(msg_ctx, env);
+ axis2_char_t *msg_id = (axis2_char_t *)axis2_msg_ctx_get_msg_id(app_msg_ctx, env);
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, str_seq_id, SANDESHA2_SEQ_PROP_LAST_IN_MESSAGE_ID, msg_id);
- sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, seq_prop_bean);
+ env, rmd_sequence_id, SANDESHA2_SEQ_PROP_LAST_IN_MESSAGE_ID, msg_id);
+ if(seq_prop_bean)
+ {
+ sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, seq_prop_bean);
+ sandesha2_seq_property_bean_free(seq_prop_bean, env);
+ }
}
}
/* end test code */
+
/*
* If this message matches the WSRM 1.0 pattern for an empty last message (e.g.
* the sender wanted to signal the last message, but didn't have an application
* message to send) then we do not need to send the message on to the application.
*/
- str_soap_action = axis2_msg_ctx_get_soap_action(msg_ctx, env);
+ str_soap_action = axis2_msg_ctx_get_soap_action(app_msg_ctx, env);
soap_action = axutil_string_get_buffer(str_soap_action, env);
- wsa_action = axis2_msg_ctx_get_wsa_action(msg_ctx, env);
- if(0 == 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");
- sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, msgs_str,
- storage_mgr, sender_mgr, seq_prop_mgr);
+ wsa_action = axis2_msg_ctx_get_wsa_action(app_msg_ctx, env);
+ 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_status_t status = AXIS2_FAILURE;
+ axis2_bool_t send_response = AXIS2_TRUE;
+ axis2_svc_t *temp_svc = NULL;
+ axis2_op_ctx_t *op_ctx = NULL;
- sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);
- if(seq_prop_mgr)
- sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
- if(create_seq_mgr)
- sandesha2_create_seq_mgr_free(create_seq_mgr, env);
- if(sender_mgr)
- sandesha2_sender_mgr_free(sender_mgr, env);
- if(next_msg_mgr)
- sandesha2_next_msg_mgr_free(next_msg_mgr, env);
- if(invoker_mgr)
- sandesha2_invoker_mgr_free(invoker_mgr, env);
- if(storage_mgr)
- sandesha2_storage_mgr_free(storage_mgr, env);
- return AXIS2_SUCCESS;
- }
- if(axis2_msg_ctx_get_server_side(msg_ctx, env) && in_order_invoke)
- {
- sandesha2_seq_property_bean_t *incoming_seq_list_bean = NULL;
- axutil_array_list_t *incoming_seq_list = NULL;
- axis2_char_t *str_value = NULL;
- axutil_property_t *property = NULL;
- axis2_char_t *str_key = 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);
+
+ op_ctx = axis2_msg_ctx_get_op_ctx(app_msg_ctx, env);
+ if(op_ctx)
+ {
+ int mep = -1;
+ axis2_op_t *op = NULL;
+
+ op = axis2_op_ctx_get_op(op_ctx, env);
+ mep = axis2_op_get_axis_specific_mep_const(op, env);
+ if(mep == AXIS2_MEP_CONSTANT_IN_ONLY)
+ {
+ send_response = 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);
+
+ if(seq_prop_mgr)
+ sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+ if(create_seq_mgr)
+ sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+ if(sender_mgr)
+ sandesha2_sender_mgr_free(sender_mgr, env);
+ if(next_msg_mgr)
+ sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+ if(invoker_mgr)
+ sandesha2_invoker_mgr_free(invoker_mgr, env);
+ if(storage_mgr)
+ sandesha2_storage_mgr_free(storage_mgr, env);
+
+ if(msgs_str)
+ {
+ AXIS2_FREE(env->allocator, msgs_str);
+ }
+
+ return status;
+ }
+
+ if(axis2_msg_ctx_get_server_side(app_msg_ctx, env) && in_order_invoke)
+ {
+ sandesha2_seq_property_bean_t *incoming_seq_list_bean = NULL;
+ axutil_array_list_t *incoming_seq_list = NULL;
+ axis2_char_t *str_value = NULL;
+ axutil_property_t *property = NULL;
+ axis2_char_t *str_key = NULL;
incoming_seq_list_bean = sandesha2_seq_property_mgr_retrieve(
seq_prop_mgr, env, SANDESHA2_SEQ_PROP_ALL_SEQS,
@@ -653,15 +891,20 @@
sandesha2_invoker_mgr_free(invoker_mgr, env);
if(storage_mgr)
sandesha2_storage_mgr_free(storage_mgr, env);
+ if(msgs_str)
+ {
+ AXIS2_FREE(env->allocator, msgs_str);
+ }
+
return status;
}
}
/* Adding current seq to the incoming seq List */
if(!sandesha2_utils_array_list_contains(env,
- incoming_seq_list, str_seq_id))
+ incoming_seq_list, rmd_sequence_id))
{
axis2_char_t *str_seq_list = NULL;
- axutil_array_list_add(incoming_seq_list, env, str_seq_id);
+ axutil_array_list_add(incoming_seq_list, env, rmd_sequence_id);
str_seq_list = sandesha2_utils_array_list_to_string(env,
incoming_seq_list, SANDESHA2_ARRAY_LIST_STRING);
/* saving the property. */
@@ -674,10 +917,9 @@
}
/* save the message */
str_key = axutil_uuid_gen(env);
- sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, str_key,
- msg_ctx);
+ sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, str_key, app_msg_ctx, AXIS2_TRUE);
invoker_bean = sandesha2_invoker_bean_create_with_data(env, str_key,
- msg_no, str_seq_id, AXIS2_FALSE);
+ msg_no, rmd_sequence_id, AXIS2_FALSE);
if(str_key)
AXIS2_FREE(env->allocator, str_key);
sandesha2_invoker_mgr_insert(invoker_mgr, env, invoker_bean);
@@ -688,116 +930,80 @@
SANDESHA2_APPLICATION_PROCESSING_DONE, property);
sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);
/* Start the invoker if stopped */
- sandesha2_utils_start_invoker_for_seq(env, conf_ctx, str_seq_id);
- }
- rm_version = sandesha2_utils_get_rm_version(env, str_seq_id, seq_prop_mgr);
- if(!rm_version)
- {
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "[sandesha2]Unable to find RM spec version for seq_id %s", str_seq_id);
- if(seq_prop_mgr)
- sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
- if(create_seq_mgr)
- sandesha2_create_seq_mgr_free(create_seq_mgr, env);
- if(sender_mgr)
- sandesha2_sender_mgr_free(sender_mgr, env);
- if(next_msg_mgr)
- sandesha2_next_msg_mgr_free(next_msg_mgr, env);
- if(invoker_mgr)
- sandesha2_invoker_mgr_free(invoker_mgr, env);
- if(storage_mgr)
- sandesha2_storage_mgr_free(storage_mgr, env);
- return AXIS2_FAILURE;
+ sandesha2_utils_start_invoker_for_seq(env, conf_ctx, rmd_sequence_id);
}
- reply_to_epr = axis2_msg_ctx_get_reply_to(msg_ctx, env);
- to_epr = axis2_msg_ctx_get_to(msg_ctx, env);
- if(reply_to_epr)
- reply_to_addr = axis2_endpoint_ref_get_address(reply_to_epr, env);
- if(to_epr)
- to_addr = axis2_endpoint_ref_get_address(to_epr, env);
- op = axis2_op_ctx_get_op(op_ctx, env);
- acks_to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, str_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);
- if(!acks_to_str)
+ 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))
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]acks_to_str"
- " seqeunce property is not set correctly");
- if(rm_version)
- AXIS2_FREE(env->allocator, rm_version);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Sending acknowledgment failed");
+
if(seq_prop_mgr)
+ {
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+ }
if(create_seq_mgr)
+ {
sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+ }
if(sender_mgr)
+ {
sandesha2_sender_mgr_free(sender_mgr, env);
+ }
if(next_msg_mgr)
+ {
sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+ }
if(invoker_mgr)
+ {
sandesha2_invoker_mgr_free(invoker_mgr, env);
+ }
if(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
- if(acks_to_bean)
- sandesha2_seq_property_bean_free(acks_to_bean, env);
+ }
+
+ if(msgs_str)
+ {
+ AXIS2_FREE(env->allocator, msgs_str);
+ }
+
return AXIS2_FAILURE;
}
- /*acks_to = axis2_endpoint_ref_create(env, acks_to_str);*/
- mep = axis2_op_get_axis_specific_mep_const(op, env);
- back_channel_free = (reply_to_addr && !sandesha2_utils_is_anon_uri(env,
- reply_to_addr)) || AXIS2_MEP_CONSTANT_IN_ONLY == mep;
- if(!reply_to_epr)
- {
- to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, str_seq_id,
- SANDESHA2_SEQ_PROP_TO_EPR);
- if(to_bean)
- reply_to_addr = sandesha2_seq_property_bean_get_value(to_bean, env);
- }
- if(back_channel_free)
- {
- /* MEP is in only or duplex mode anonymous reply to address.
- * That means we can send an acknowledgment message in the http back channel.
- */
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "[sandesha2]back_channel_free true");
- sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, msgs_str,
- storage_mgr, sender_mgr, seq_prop_mgr);
- }
- else if(sandesha2_utils_is_single_channel(env, rm_version, acks_to_str))
- {
- /* This means acknowledgment address is anomymous and RM version is 1.0.
- * In other words single channel duplex mode. In this case we do not send the
- * acknowledgment message here. Instead we send it in the message out path.
- * See sandesha2_app_msg_processor_process_response_msg() code.
- */
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]is_single_channel true");
- }
- else
+
+ if(msgs_str)
{
- /* This is most probably dual channel duplex mode. */
- sandesha2_app_msg_processor_send_ack_if_reqd(env, rm_msg_ctx, msgs_str,
- storage_mgr, sender_mgr, seq_prop_mgr);
+ AXIS2_FREE(env->allocator, msgs_str);
}
- if(rm_version)
- AXIS2_FREE(env->allocator, rm_version);
- if(acks_to_bean)
- sandesha2_seq_property_bean_free(acks_to_bean, env);
if(seq_prop_mgr)
+ {
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+ }
if(create_seq_mgr)
+ {
sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+ }
if(sender_mgr)
+ {
sandesha2_sender_mgr_free(sender_mgr, env);
+ }
if(next_msg_mgr)
+ {
sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+ }
if(invoker_mgr)
+ {
sandesha2_invoker_mgr_free(invoker_mgr, env);
+ }
if(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
+ }
+
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
"[sandesha2]Exit:sandesha2_app_msg_processor_process_in_msg");
+
return AXIS2_SUCCESS;
}
@@ -815,8 +1021,7 @@
sandesha2_create_seq_mgr_t *create_seq_mgr = NULL;
sandesha2_sender_mgr_t *sender_mgr = NULL;
axis2_bool_t is_svr_side = AXIS2_FALSE;
- axis2_char_t *internal_seq_id = NULL;
- axis2_char_t *out_seq_id = NULL;
+ axis2_char_t *internal_sequence_id = NULL;
axis2_char_t *storage_key = NULL;
axis2_bool_t last_msg = AXIS2_FALSE;
axutil_property_t *property = NULL;
@@ -825,13 +1030,18 @@
long msg_number = -1;
axis2_char_t *dummy_msg_str = NULL;
axis2_bool_t dummy_msg = AXIS2_FALSE;
+ axis2_char_t *rmd_sequence_id = NULL;
+
+ /*axis2_bool_t seq_timed_out = AXIS2_FALSE;*/
+
sandesha2_seq_property_bean_t *res_highest_msg_bean = NULL;
axis2_char_t msg_number_str[32];
axis2_bool_t send_create_seq = AXIS2_FALSE;
+ sandesha2_seq_property_bean_t *spec_ver_bean = NULL;
axis2_char_t *spec_ver = NULL;
axiom_soap_envelope_t *soap_env = NULL;
axis2_endpoint_ref_t *to_epr = NULL;
- sandesha2_seq_property_bean_t *out_seq_bean = NULL;
+ sandesha2_seq_property_bean_t *rms_sequence_bean = NULL;
axis2_char_t *op_name = NULL;
axis2_char_t *to_addr = NULL;
axis2_op_ctx_t *op_ctx = NULL;
@@ -839,6 +1049,8 @@
axis2_relates_to_t *relates_to = NULL;
axis2_char_t *dbname = NULL;
sandesha2_seq_property_bean_t *seq_timeout_bean = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+ sandesha2_msg_ctx_t *req_rm_msg_ctx = NULL;
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
"[sandesha2]Entry:sandesha2_app_msg_processor_process_out_msg");
@@ -847,8 +1059,7 @@
msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
- req_msg_ctx = axis2_op_ctx_get_msg_ctx(op_ctx, env,
- AXIS2_WSDL_MESSAGE_LABEL_IN);
+ req_msg_ctx = axis2_op_ctx_get_msg_ctx(op_ctx, env, AXIS2_WSDL_MESSAGE_LABEL_IN);
/* TODO setting up fault callback */
dbname = sandesha2_util_get_dbname(env, conf_ctx);
@@ -859,7 +1070,9 @@
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"[sandesha2]seq_prop_mgr is NULL");
if(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
+ }
return AXIS2_FAILURE;
}
create_seq_mgr = sandesha2_permanent_create_seq_mgr_create(env, dbname);
@@ -868,32 +1081,41 @@
is_svr_side = axis2_msg_ctx_get_server_side(msg_ctx, env);
to_epr = axis2_msg_ctx_get_to(msg_ctx, env);
- if((!to_epr || !axis2_endpoint_ref_get_address(to_epr, env)
- || 0 == axutil_strlen(axis2_endpoint_ref_get_address(
- to_epr, env))) && !is_svr_side)
+ if((!to_epr || !axis2_endpoint_ref_get_address(to_epr, env) || 0 == axutil_strlen(
+ axis2_endpoint_ref_get_address(to_epr, env))) && !is_svr_side)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "[sandesha2]To epr is not set - a"
- "requirement in sandesha client side");
+ "[sandesha2]To epr is not set - a requirement in sandesha client side");
+
if(seq_prop_mgr)
+ {
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+ }
if(create_seq_mgr)
+ {
sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+ }
if(sender_mgr)
+ {
sandesha2_sender_mgr_free(sender_mgr, env);
+ }
if(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
+ }
+
return AXIS2_FAILURE;
}
if(!axis2_msg_ctx_get_msg_id(msg_ctx, env))
+ {
axis2_msg_ctx_set_message_id(msg_ctx, env, axutil_uuid_gen(env));
+ }
+
if(is_svr_side)
{
sandesha2_seq_t *req_seq = NULL;
long request_msg_no = -1;
- axis2_char_t *incoming_seq_id = NULL;
- sandesha2_msg_ctx_t *req_rm_msg_ctx = NULL;
const axis2_relates_to_t *relates_to = NULL;
axis2_char_t *relates_to_value = NULL;
axis2_char_t *last_req_id = NULL;
@@ -902,316 +1124,418 @@
req_seq = sandesha2_msg_ctx_get_sequence(req_rm_msg_ctx, env);
if(!req_seq)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "[sandesha2]Sequence is NULL");
- AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SEQ_NOT_EXIST,
- AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Sequence is NULL");
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_SEQ_NOT_EXIST, AXIS2_FAILURE);
if(req_rm_msg_ctx)
+ {
sandesha2_msg_ctx_free(req_rm_msg_ctx, env);
+ }
if(seq_prop_mgr)
+ {
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+ }
if(create_seq_mgr)
+ {
sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+ }
if(sender_mgr)
+ {
sandesha2_sender_mgr_free(sender_mgr, env);
+ }
if(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
+ }
+
return AXIS2_FAILURE;
}
- incoming_seq_id = sandesha2_identifier_get_identifier(
- sandesha2_seq_get_identifier(req_seq, env), env);
- if(!incoming_seq_id)
+
+ rmd_sequence_id = sandesha2_identifier_get_identifier(sandesha2_seq_get_identifier(req_seq,
+ env), env);
+ if(!rmd_sequence_id)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "[sandesha2]Sequence ID is NULL");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Sequence ID is NULL");
if(req_rm_msg_ctx)
+ {
sandesha2_msg_ctx_free(req_rm_msg_ctx, env);
+ }
if(seq_prop_mgr)
+ {
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+ }
if(create_seq_mgr)
+ {
sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+ }
if(sender_mgr)
+ {
sandesha2_sender_mgr_free(sender_mgr, env);
+ }
if(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
+ }
+
return AXIS2_FAILURE;
}
- request_msg_no = sandesha2_msg_number_get_msg_num(
- sandesha2_seq_get_msg_num(req_seq, env), env);
- internal_seq_id = sandesha2_utils_get_outgoing_internal_seq_id(env,
- incoming_seq_id);
+
+ request_msg_no = sandesha2_msg_number_get_msg_num(sandesha2_seq_get_msg_num(req_seq, env), env);
+ internal_sequence_id = sandesha2_utils_get_internal_sequence_id(env, rmd_sequence_id);
+
/* Deciding whether this is the last message. We assume it is if it
* relates to a message which arrived with the LastMessage flag on it.
*/
- last_req_id = sandesha2_utils_get_seq_property(env, incoming_seq_id,
+ last_req_id = sandesha2_utils_get_seq_property(env, rmd_sequence_id,
SANDESHA2_SEQ_PROP_LAST_IN_MESSAGE_ID, seq_prop_mgr);
+
relates_to = axis2_msg_ctx_get_relates_to(msg_ctx, env);
relates_to_value = (axis2_char_t *)axis2_relates_to_get_value(relates_to, env);
- if(relates_to && last_req_id && 0 == axutil_strcmp(last_req_id,
- relates_to_value))
+ if(relates_to && last_req_id && !axutil_strcmp(last_req_id, relates_to_value))
{
last_msg = AXIS2_TRUE;
}
+
if(last_req_id)
+ {
AXIS2_FREE(env->allocator, last_req_id);
- if(req_rm_msg_ctx)
- sandesha2_msg_ctx_free(req_rm_msg_ctx, env);
+ }
}
- else
+ else /* Client side */
{
axis2_char_t *to = NULL;
axis2_char_t *seq_key = NULL;
axis2_char_t *last_app_msg = NULL;
to = (axis2_char_t*)axis2_endpoint_ref_get_address(to_epr, env);
- property = axis2_msg_ctx_get_property(msg_ctx, env,
- SANDESHA2_CLIENT_SEQ_KEY);
+ property = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_CLIENT_SEQ_KEY);
if(property)
+ {
seq_key = axutil_property_get_value(property, env);
+ }
+
if(!seq_key)
{
seq_key = axutil_uuid_gen(env);
property = axutil_property_create_with_args(env, 0, 0, 0, seq_key);
- axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_CLIENT_SEQ_KEY,
- property);
+ axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_CLIENT_SEQ_KEY, property);
}
- internal_seq_id = sandesha2_utils_get_internal_seq_id(env,
- to, seq_key);
- property = axis2_msg_ctx_get_property(msg_ctx, env,
- SANDESHA2_CLIENT_LAST_MESSAGE);
+
+ internal_sequence_id = sandesha2_utils_get_client_internal_sequence_id(env, to,
+ seq_key);
+ property = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_CLIENT_LAST_MESSAGE);
if(property)
+ {
last_app_msg = axutil_property_get_value(property, env);
- if(last_app_msg && 0 == axutil_strcmp(last_app_msg, AXIS2_VALUE_TRUE))
+ }
+
+ if(last_app_msg && !axutil_strcmp(last_app_msg, AXIS2_VALUE_TRUE))
{
- axis2_char_t *spec_ver = NULL;
- spec_ver = sandesha2_utils_get_rm_version(env, internal_seq_id,
- seq_prop_mgr);
+ spec_ver = sandesha2_utils_get_rm_version(env, internal_sequence_id, seq_prop_mgr);
if(!spec_ver)
{
axutil_property_t *spec_ver_prop = NULL;
spec_ver_prop = axis2_msg_ctx_get_property(msg_ctx, env,
SANDESHA2_CLIENT_RM_SPEC_VERSION);
- spec_ver = axutil_strdup(env, axutil_property_get_value(
- spec_ver_prop, env));
+
+ spec_ver = axutil_strdup(env, axutil_property_get_value(spec_ver_prop, env));
}
- if(sandesha2_spec_specific_consts_is_last_msg_indicator_reqd
- (env, spec_ver))
+ if(sandesha2_spec_specific_consts_is_last_msg_indicator_reqd(env, spec_ver))
{
last_msg = AXIS2_TRUE;
}
if(spec_ver)
+ {
AXIS2_FREE(env->allocator, spec_ver);
+ spec_ver = NULL;
+ }
}
}
- seq_timeout_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, internal_seq_id,
+ seq_timeout_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, internal_sequence_id,
SANDESHA2_SEQ_PROP_SEQ_TIMED_OUT);
- if(seq_timeout_bean && sandesha2_seq_property_bean_get_value(seq_timeout_bean, env)
- && 0 == axutil_strcmp(AXIS2_VALUE_TRUE, sandesha2_seq_property_bean_get_value(seq_timeout_bean,
- env)))
+
+ if(seq_timeout_bean)
{
- axis2_char_t *temp_int_seq_id = sandesha2_seq_property_bean_get_seq_id(seq_timeout_bean, env);
- axis2_char_t *temp_name = sandesha2_seq_property_bean_get_name(seq_timeout_bean, env);
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "[sandesha2] Removing the sequence property named %s in the sequence %s", temp_name,
- temp_int_seq_id);
- sandesha2_seq_property_mgr_remove(seq_prop_mgr, env, temp_int_seq_id, temp_name);
+ axis2_bool_t exit_system = AXIS2_FALSE;
+ axis2_char_t *str_timeout = sandesha2_seq_property_bean_get_value(seq_timeout_bean, env);
- if(internal_seq_id)
- AXIS2_FREE(env->allocator, internal_seq_id);
- if(seq_prop_mgr)
- sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
- if(create_seq_mgr)
- sandesha2_create_seq_mgr_free(create_seq_mgr, env);
- if(sender_mgr)
- sandesha2_sender_mgr_free(sender_mgr, env);
- if(storage_mgr)
- sandesha2_storage_mgr_free(storage_mgr, env);
- /* We should halt the system here. Otherwise application client keep on sending messages. */
- exit(AXIS2_FAILURE);
+ if(str_timeout && !axutil_strcmp(AXIS2_VALUE_TRUE, str_timeout))
+ {
+ axis2_char_t *temp_int_seq_id = sandesha2_seq_property_bean_get_seq_id(seq_timeout_bean, env);
+ axis2_char_t *temp_name = sandesha2_seq_property_bean_get_name(seq_timeout_bean, env);
+
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
+ "[sandesha2] Removing the sequence property named %s in the sequence %s", temp_name,
+ temp_int_seq_id);
+
+ sandesha2_seq_property_mgr_remove(seq_prop_mgr, env, temp_int_seq_id, temp_name);
+
+ if(req_rm_msg_ctx)
+ {
+ sandesha2_msg_ctx_free(req_rm_msg_ctx, env);
+ }
+ if(internal_sequence_id)
+ {
+ AXIS2_FREE(env->allocator, internal_sequence_id);
+ }
+ if(seq_prop_mgr)
+ {
+ sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+ }
+ if(create_seq_mgr)
+ {
+ sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+ }
+ if(sender_mgr)
+ {
+ sandesha2_sender_mgr_free(sender_mgr, env);
+ }
+ if(storage_mgr)
+ {
+ sandesha2_storage_mgr_free(storage_mgr, env);
+ }
+
+ /* We should halt the system here. Otherwise application client keep on sending messages. */
+ exit_system = AXIS2_TRUE;
+ }
+
+ sandesha2_seq_property_bean_free(seq_timeout_bean, env);
+ if(exit_system)
+ {
+ exit(AXIS2_FAILURE);
+ }
}
- property = axis2_msg_ctx_get_property(msg_ctx, env,
- SANDESHA2_CLIENT_MESSAGE_NUMBER);
+ property = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_CLIENT_MESSAGE_NUMBER);
if(property)
{
msg_num_lng = *(long*)(axutil_property_get_value(property, env));
if(msg_num_lng <= 0)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "[sandesha2]Invalid message number");
- AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_MSG_NUM,
- AXIS2_FAILURE);
- if(internal_seq_id)
- AXIS2_FREE(env->allocator, internal_seq_id);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Invalid message number");
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_MSG_NUM, AXIS2_FAILURE);
+
+ if(req_rm_msg_ctx)
+ {
+ sandesha2_msg_ctx_free(req_rm_msg_ctx, env);
+ }
+ if(internal_sequence_id)
+ {
+ AXIS2_FREE(env->allocator, internal_sequence_id);
+ }
if(seq_prop_mgr)
+ {
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+ }
if(create_seq_mgr)
+ {
sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+ }
if(sender_mgr)
+ {
sandesha2_sender_mgr_free(sender_mgr, env);
+ }
if(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
+ }
+
return AXIS2_FAILURE;
}
}
- system_msg_num = sandesha2_app_msg_processor_get_prev_msg_no(env,
- internal_seq_id, seq_prop_mgr);
+
+ system_msg_num = sandesha2_app_msg_processor_get_prev_msg_no(env, internal_sequence_id, seq_prop_mgr);
+
if(msg_num_lng > 0 && msg_num_lng <= system_msg_num)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "[sandesha2] Invalid Message Number");
- AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_MSG_NUM,
- AXIS2_FAILURE);
- if(internal_seq_id)
- AXIS2_FREE(env->allocator, internal_seq_id);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Invalid Message Number");
+
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_MSG_NUM, AXIS2_FAILURE);
+
+ if(req_rm_msg_ctx)
+ {
+ sandesha2_msg_ctx_free(req_rm_msg_ctx, env);
+ }
+ if(internal_sequence_id)
+ {
+ AXIS2_FREE(env->allocator, internal_sequence_id);
+ }
if(seq_prop_mgr)
+ {
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+ }
if(create_seq_mgr)
+ {
sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+ }
if(sender_mgr)
+ {
sandesha2_sender_mgr_free(sender_mgr, env);
+ }
if(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
+ }
+
return AXIS2_FAILURE;
}
if(msg_num_lng > 0)
+ {
msg_number = msg_num_lng;
+ }
else if(system_msg_num > 0)
+ {
msg_number = system_msg_num + 1;
+ }
else
+ {
msg_number = 1;
+ }
/* A dummy message is a one which will not be processed as a actual
* application message. The RM handlers will simply let these go.
*/
- property = axis2_msg_ctx_get_property(msg_ctx, env,
- SANDESHA2_CLIENT_DUMMY_MESSAGE);
+ property = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_CLIENT_DUMMY_MESSAGE);
if(property)
+ {
dummy_msg_str = axutil_property_get_value(property, env);
+ }
+
if(dummy_msg_str && 0 == axutil_strcmp(dummy_msg_str, AXIS2_VALUE_TRUE))
+ {
dummy_msg = AXIS2_TRUE;
+ }
+
if(!dummy_msg)
- sandesha2_app_msg_processor_set_next_msg_no(env, internal_seq_id,
- msg_number, seq_prop_mgr);
+ {
+ sandesha2_app_msg_processor_set_next_msg_no(env, internal_sequence_id, msg_number, seq_prop_mgr);
+ }
+
sprintf(msg_number_str, "%ld", msg_number);
- res_highest_msg_bean = sandesha2_seq_property_bean_create_with_data(env,
- internal_seq_id, SANDESHA2_SEQ_PROP_HIGHEST_OUT_MSG_NUMBER,
- msg_number_str);
- sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, res_highest_msg_bean);
+ res_highest_msg_bean = sandesha2_seq_property_bean_create_with_data(env, internal_sequence_id,
+ SANDESHA2_SEQ_PROP_HIGHEST_OUT_MSG_NUMBER, msg_number_str);
+
if(res_highest_msg_bean)
+ {
+ sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, res_highest_msg_bean);
sandesha2_seq_property_bean_free(res_highest_msg_bean, env);
+ }
+
relates_to = axis2_msg_ctx_get_relates_to(msg_ctx, env);
if(relates_to)
{
- const axis2_char_t *relates_to_value = axis2_relates_to_get_value(
- relates_to, env);
- sandesha2_seq_property_bean_t *response_relates_to_bean =
- sandesha2_seq_property_bean_create_with_data(env, internal_seq_id,
- SANDESHA2_SEQ_PROP_HIGHEST_OUT_RELATES_TO, (axis2_char_t *)
- relates_to_value);
- sandesha2_seq_property_mgr_insert(seq_prop_mgr, env,
- response_relates_to_bean);
+ sandesha2_seq_property_bean_t *response_relates_to_bean = NULL;
+ const axis2_char_t *relates_to_value = axis2_relates_to_get_value(relates_to, env);
+
+ response_relates_to_bean = sandesha2_seq_property_bean_create_with_data(env,
+ internal_sequence_id, SANDESHA2_SEQ_PROP_HIGHEST_OUT_RELATES_TO,
+ (axis2_char_t *) relates_to_value);
+
+ if(response_relates_to_bean)
+ {
+ sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, response_relates_to_bean);
+ sandesha2_seq_property_bean_free(response_relates_to_bean, env);
+ }
}
- storage_key = axutil_uuid_gen(env);
+
if(last_msg)
{
- sandesha2_seq_property_bean_t *res_highest_msg_key_bean = NULL;
sandesha2_seq_property_bean_t *res_last_msg_key_bean = NULL;
- res_highest_msg_key_bean = sandesha2_seq_property_bean_create_with_data(
- env, internal_seq_id, SANDESHA2_SEQ_PROP_HIGHEST_OUT_MSG_KEY,
- storage_key);
- res_last_msg_key_bean = sandesha2_seq_property_bean_create_with_data(
- env, internal_seq_id, SANDESHA2_SEQ_PROP_LAST_OUT_MESSAGE_NO,
- msg_number_str);
- sandesha2_seq_property_mgr_insert(seq_prop_mgr, env,
- res_highest_msg_key_bean);
- sandesha2_seq_property_mgr_insert(seq_prop_mgr, env,
- res_last_msg_key_bean);
+ res_last_msg_key_bean = sandesha2_seq_property_bean_create_with_data(env,
+ internal_sequence_id, SANDESHA2_SEQ_PROP_LAST_OUT_MESSAGE_NO, msg_number_str);
+
+ if(res_last_msg_key_bean)
+ {
+ sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, res_last_msg_key_bean);
+ sandesha2_seq_property_bean_free(res_last_msg_key_bean, env);
+ }
}
- out_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
- internal_seq_id, SANDESHA2_SEQ_PROP_OUT_SEQ_ID);
+
+
if(is_svr_side)
{
- axis2_char_t *incoming_seq_id = NULL;
- sandesha2_seq_property_bean_t *incoming_to_bean = NULL;
- sandesha2_seq_t *seq = NULL;
- axis2_char_t *req_seq_id = NULL;
- sandesha2_seq_property_bean_t *spec_ver_bean = NULL;
- sandesha2_msg_ctx_t *req_rm_msg_ctx = NULL;
+ sandesha2_seq_property_bean_t *rmd_to_bean = NULL;
- incoming_seq_id = sandesha2_utils_get_svr_side_incoming_seq_id(env,
- internal_seq_id);
- incoming_to_bean = sandesha2_seq_property_mgr_retrieve(
- seq_prop_mgr, env, incoming_seq_id,
- SANDESHA2_SEQ_PROP_TO_EPR);
- if(incoming_to_bean)
- {
- axis2_char_t *incoming_to = NULL;
- axis2_char_t *value = NULL;
-
- value = sandesha2_seq_property_bean_get_value(incoming_to_bean, env);
- incoming_to = axutil_strdup(env, value);
- property = axutil_property_create_with_args(env, 0, 0, 0, incoming_to);
- axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_SEQ_PROP_TO_EPR,
- property);
+ rmd_to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, rmd_sequence_id,
+ SANDESHA2_SEQ_PROP_TO_EPR);
+ if(rmd_to_bean)
+ {
+ axis2_char_t *rmd_to = NULL;
+
+ rmd_to = axutil_strdup(env, sandesha2_seq_property_bean_get_value(rmd_to_bean, env));
+ property = axutil_property_create_with_args(env, 0, AXIS2_TRUE, 0, rmd_to);
+ axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_SEQ_PROP_TO_EPR, property);
+ sandesha2_seq_property_bean_free(rmd_to_bean, env);
}
- req_rm_msg_ctx = sandesha2_msg_init_init_msg(env, req_msg_ctx);
- seq = sandesha2_msg_ctx_get_sequence(req_rm_msg_ctx, env);
-
- req_seq_id = sandesha2_identifier_get_identifier(
- sandesha2_seq_get_identifier(seq, env), env);
- spec_ver_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr,
- env, req_seq_id, SANDESHA2_SEQ_PROP_RM_SPEC_VERSION);
+ spec_ver_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, rmd_sequence_id,
+ SANDESHA2_SEQ_PROP_RM_SPEC_VERSION);
+
if(req_rm_msg_ctx)
+ {
sandesha2_msg_ctx_free(req_rm_msg_ctx, env);
+ }
if(!spec_ver_bean)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"[sandesha2] Invalid spec version");
AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_SPEC_VERSION,
AXIS2_FAILURE);
- if(internal_seq_id)
- AXIS2_FREE(env->allocator, internal_seq_id);
+ if(internal_sequence_id)
+ {
+ AXIS2_FREE(env->allocator, internal_sequence_id);
+ }
if(seq_prop_mgr)
+ {
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+ }
if(create_seq_mgr)
+ {
sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+ }
if(sender_mgr)
+ {
sandesha2_sender_mgr_free(sender_mgr, env);
+ }
if(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
+ }
+
return AXIS2_FAILURE;
}
+
spec_ver = sandesha2_seq_property_bean_get_value(spec_ver_bean, env);
}
else
{
- property = axis2_msg_ctx_get_property(msg_ctx, env,
- SANDESHA2_CLIENT_RM_SPEC_VERSION);
+ property = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_CLIENT_RM_SPEC_VERSION);
if(property)
+ {
spec_ver = axutil_property_get_value(property, env);
+ }
}
+
if(!spec_ver)
+ {
spec_ver = sandesha2_spec_specific_consts_get_default_spec_version(env);
+ }
+
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Spec version:%s", spec_ver);
+
+ rms_sequence_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
+ internal_sequence_id, SANDESHA2_SEQUENCE_PROPERTY_RMS_SEQ_ID);
+
if(1 == msg_number)
{
- if(!out_seq_bean)
+ if(!rms_sequence_bean)
{
send_create_seq = AXIS2_TRUE;
}
- if(is_svr_side)
- {
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Starting the server "\
- "sequence with internal sequence id %s", internal_seq_id);
- sandesha2_seq_mgr_setup_new_client_seq(env, msg_ctx, internal_seq_id,
- spec_ver, seq_prop_mgr, AXIS2_TRUE);
- }
- else
+
+ /*if(!is_svr_side)
{
axutil_property_t *property = NULL;
axis2_ctx_t *ctx = axis2_conf_ctx_get_base(conf_ctx, env);
@@ -1220,91 +1544,110 @@
property = axis2_ctx_get_property(ctx, env, SANDESHA2_MSG_CTX_MAP);
if(!property)
{
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "[sandesha2]msg_ctx_map not found in the conf_ctx");
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
+ "[sandesha2]msg_ctx_map not found in the conf_ctx");
+
msg_ctx_map = axutil_hash_make(env);
- property = axutil_property_create_with_args(env, AXIS2_SCOPE_APPLICATION,
- AXIS2_TRUE, axutil_hash_free_void_arg, msg_ctx_map);
- axis2_ctx_set_property(ctx, env, SANDESHA2_MSG_CTX_MAP,
- property);
- }
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Starting the client "\
- "sequence with internal sequence id %s", internal_seq_id);
- sandesha2_seq_mgr_setup_new_client_seq(env, msg_ctx, internal_seq_id,
- spec_ver, seq_prop_mgr, AXIS2_FALSE);
- }
+ property = axutil_property_create_with_args(env, AXIS2_SCOPE_APPLICATION, AXIS2_TRUE,
+ axutil_hash_free_void_arg, msg_ctx_map);
+
+ axis2_ctx_set_property(ctx, env, SANDESHA2_MSG_CTX_MAP, property);
+ }
+ }*/
+
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
+ "Starting the rms sequence with rms rms internal sequence id %s",
+ internal_sequence_id);
+
+ sandesha2_seq_mgr_setup_new_rms_sequence(env, msg_ctx, internal_sequence_id, spec_ver,
+ seq_prop_mgr);
+ }
+
+ if(rms_sequence_bean)
+ {
+ sandesha2_seq_property_bean_free(rms_sequence_bean, env);
+ }
+
+ if(spec_ver_bean)
+ {
+ sandesha2_seq_property_bean_free(spec_ver_bean, env);
}
+
if(send_create_seq)
{
- sandesha2_seq_property_bean_t *res_create_seq_added = NULL;
+ sandesha2_seq_property_bean_t *create_seq_added = NULL;
axis2_char_t *addr_ns_uri = NULL;
axis2_char_t *anon_uri = NULL;
- res_create_seq_added = sandesha2_seq_property_mgr_retrieve(
- seq_prop_mgr, env, internal_seq_id,
- SANDESHA2_SEQ_PROP_OUT_CREATE_SEQ_SENT);
- addr_ns_uri = sandesha2_utils_get_seq_property(env, internal_seq_id,
- SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE, seq_prop_mgr);
+ create_seq_added = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, internal_sequence_id,
+ SANDESHA2_SEQ_PROP_OUT_CREATE_SEQ_SENT);
+
+ addr_ns_uri = sandesha2_utils_get_seq_property(env, internal_sequence_id,
+ SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE, seq_prop_mgr);
+
anon_uri = sandesha2_spec_specific_consts_get_anon_uri(env, addr_ns_uri);
if(addr_ns_uri)
+ {
AXIS2_FREE(env->allocator, addr_ns_uri);
- if(!res_create_seq_added)
+ }
+
+ if(!create_seq_added)
{
axis2_char_t *acks_to = NULL;
+ sandesha2_seq_property_bean_t *reply_to_epr_bean = NULL;
- res_create_seq_added = sandesha2_seq_property_bean_create_with_data(
- env, internal_seq_id, SANDESHA2_SEQ_PROP_OUT_CREATE_SEQ_SENT,
- AXIS2_VALUE_TRUE);
- sandesha2_seq_property_mgr_insert(seq_prop_mgr, env,
- res_create_seq_added);
+ create_seq_added = sandesha2_seq_property_bean_create_with_data(env,
+ internal_sequence_id, SANDESHA2_SEQ_PROP_OUT_CREATE_SEQ_SENT, AXIS2_VALUE_TRUE);
+
+ sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, create_seq_added);
+
if(axis2_msg_ctx_get_svc_ctx(msg_ctx, env))
{
- property = axis2_msg_ctx_get_property(msg_ctx, env,
- SANDESHA2_CLIENT_ACKS_TO);
+ property = axis2_msg_ctx_get_property(msg_ctx, env, SANDESHA2_CLIENT_ACKS_TO);
if(property)
+ {
acks_to = axutil_property_get_value(property, env);
+ }
}
+
if(is_svr_side)
{
axis2_endpoint_ref_t *acks_to_epr = NULL;
acks_to_epr = axis2_msg_ctx_get_to(req_msg_ctx, env);
- acks_to = (axis2_char_t*)axis2_endpoint_ref_get_address(
- acks_to_epr, env);
+ acks_to = (axis2_char_t*)axis2_endpoint_ref_get_address(acks_to_epr, env);
}
else if(!acks_to)
+ {
acks_to = anon_uri;
+ }
if(!acks_to && is_svr_side)
{
- axis2_char_t *incoming_seq_id = NULL;
- sandesha2_seq_property_bean_t *reply_to_epr_bean = NULL;
-
- incoming_seq_id = sandesha2_utils_get_svr_side_incoming_seq_id(
- env, internal_seq_id);
- reply_to_epr_bean = sandesha2_seq_property_mgr_retrieve(
- seq_prop_mgr, env, incoming_seq_id,
- SANDESHA2_SEQ_PROP_REPLY_TO_EPR);
+ reply_to_epr_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
+ rmd_sequence_id, SANDESHA2_SEQ_PROP_REPLY_TO_EPR);
if(reply_to_epr_bean)
{
- axis2_endpoint_ref_t *acks_epr = NULL;
- acks_epr = axis2_endpoint_ref_create(env,
- sandesha2_seq_property_bean_get_value(reply_to_epr_bean,
- env));
- if(acks_epr)
- acks_to = (axis2_char_t*)axis2_endpoint_ref_get_address(
- acks_epr, env);
+ acks_to = sandesha2_seq_property_bean_get_value(reply_to_epr_bean, env);
}
}
+
/**
* else if()
* TODO handle acks_to == anon_uri case
*/
- sandesha2_app_msg_processor_add_create_seq_msg(env, rm_msg_ctx,
- internal_seq_id, acks_to, storage_mgr, seq_prop_mgr,
- create_seq_mgr, sender_mgr);
+ sandesha2_app_msg_processor_send_create_seq_msg(env, rm_msg_ctx, internal_sequence_id,
+ acks_to, storage_mgr, seq_prop_mgr, create_seq_mgr, sender_mgr);
+
+ if(reply_to_epr_bean)
+ {
+ sandesha2_seq_property_bean_free(reply_to_epr_bean, env);
+ }
}
+
+ sandesha2_seq_property_bean_free(create_seq_added, env);
}
+
soap_env = sandesha2_msg_ctx_get_soap_envelope(rm_msg_ctx, env);
if(!soap_env)
{
@@ -1312,6 +1655,7 @@
AXIOM_SOAP12);
sandesha2_msg_ctx_set_soap_envelope(rm_msg_ctx, env, soap_env);
}
+
if(!sandesha2_msg_ctx_get_msg_id(rm_msg_ctx, env))
{
axis2_char_t *msg_id = NULL;
@@ -1321,7 +1665,7 @@
if(is_svr_side)
{
- /* let the request end with 202 if a ack has not been
+ /* Let the request end with 202 if a ack has not been
* written in the incoming thread
*/
axis2_ctx_t *ctx = NULL;
@@ -1330,8 +1674,11 @@
ctx = axis2_op_ctx_get_base(op_ctx, env);
property = axis2_ctx_get_property(ctx, env, SANDESHA2_ACK_WRITTEN);
if(property)
+ {
written = axutil_property_get_value(property, env);
- if(!written || 0 != axutil_strcmp(written, AXIS2_VALUE_TRUE))
+ }
+
+ if(!written || axutil_strcmp(written, AXIS2_VALUE_TRUE))
{
if (op_ctx)
{
@@ -1339,36 +1686,74 @@
}
}
}
+
op_name = axutil_qname_get_localpart(axis2_op_get_qname( axis2_op_ctx_get_op(
axis2_msg_ctx_get_op_ctx(msg_ctx, env), env), env), env);
+
if (to_epr)
+ {
to_addr = (axis2_char_t*)axis2_endpoint_ref_get_address(to_epr, env);
+ }
+
if(!axis2_msg_ctx_get_wsa_action(msg_ctx, env))
+ {
axis2_msg_ctx_set_wsa_action(msg_ctx, env, to_addr);
+ }
+
if(!axis2_msg_ctx_get_soap_action(msg_ctx, env))
{
axutil_string_t *soap_action = axutil_string_create(env, to_addr);
- axis2_msg_ctx_set_soap_action(msg_ctx, env, soap_action);
+ if(soap_action)
+ {
+ axis2_msg_ctx_set_soap_action(msg_ctx, env, soap_action);
+ axutil_string_free(soap_action, env);
+ }
}
if(!dummy_msg)
- sandesha2_app_msg_processor_process_response_msg(env, rm_msg_ctx,
- internal_seq_id, out_seq_id, msg_number, storage_key, storage_mgr,
- seq_prop_mgr, sender_mgr);
+ {
+ storage_key = axutil_uuid_gen(env);
+
+ status = sandesha2_app_msg_processor_send_app_msg(env, rm_msg_ctx, internal_sequence_id,
+ msg_number, storage_key, storage_mgr, create_seq_mgr, seq_prop_mgr, sender_mgr);
+ if(storage_key)
+ {
+ AXIS2_FREE(env->allocator, storage_key);
+ }
+ }
+
+ if(axis2_msg_ctx_get_server_side(msg_ctx, env))
+ {
+ axis2_core_utils_reset_out_msg_ctx(env, msg_ctx);
+ }
+
axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
- if(internal_seq_id)
- AXIS2_FREE(env->allocator, internal_seq_id);
+
+ if(internal_sequence_id)
+ {
+ AXIS2_FREE(env->allocator, internal_sequence_id);
+ }
if(seq_prop_mgr)
+ {
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
+ }
if(create_seq_mgr)
+ {
sandesha2_create_seq_mgr_free(create_seq_mgr, env);
+ }
if(sender_mgr)
+ {
sandesha2_sender_mgr_free(sender_mgr, env);
+ }
if(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[sandesha2]Exit:sandesha2_app_msg_processor_process_out_msg");
- return AXIS2_SUCCESS;
+ }
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "[sandesha2] Exit:sandesha2_app_msg_processor_process_out_msg");
+
+ return status;
}
static axis2_bool_t AXIS2_CALL
@@ -1379,17 +1764,34 @@
{
axutil_array_list_t *list = NULL;
axis2_char_t str_long[32];
+ axis2_bool_t ret = AXIS2_FALSE;
AXIS2_PARAM_CHECK(env->error, str_list, AXIS2_FALSE);
sprintf(str_long, "%ld", num);
list = sandesha2_utils_get_array_list_from_string(env, str_list);
if(list)
{
+ int i = 0, size = 0;
+
if(axutil_array_list_contains(list, env, str_long))
- return AXIS2_TRUE;
+ {
+ ret = AXIS2_TRUE;
+ }
+
+ size = axutil_array_list_size(list, env);
+ for(i = 0; i < size; i++)
+ {
+ axis2_char_t *str = axutil_array_list_get(list, env, i);
+ if(str)
+ {
+ AXIS2_FREE(env->allocator, str);
+ str = NULL;
+ }
+ }
axutil_array_list_free(list, env);
}
- return AXIS2_FALSE;
+
+ return ret;
}
@@ -1398,133 +1800,323 @@
const axutil_env_t *env,
sandesha2_msg_ctx_t *rm_msg_ctx,
axis2_char_t *msg_str,
+ 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_t *seq = NULL;
- axis2_char_t *seq_id = NULL;
+ /*axis2_endpoint_ref_t *to_epr = NULL;
+ axis2_endpoint_ref_t *temp_to_epr = NULL;*/
+ const axis2_char_t *reply_to_addr = NULL;
+ sandesha2_seq_property_bean_t *acks_to_bean = NULL;
+ axis2_char_t *acks_to_str = NULL;
axis2_conf_ctx_t *conf_ctx = NULL;
sandesha2_ack_requested_t *ack_requested = NULL;
- sandesha2_msg_ctx_t *ack_rm_msg = NULL;
+ sandesha2_msg_ctx_t *ack_rm_msg_ctx = NULL;
axis2_msg_ctx_t *ack_msg_ctx = NULL;
axis2_msg_ctx_t *msg_ctx = NULL;
+ axis2_endpoint_ref_t *reply_to_epr = NULL;
+ long send_time = -1;
+ axis2_char_t *key = NULL;
+ axutil_property_t *property = NULL;
+ sandesha2_sender_bean_t *ack_bean = NULL;
+ sandesha2_seq_property_bean_t *rms_internal_sequence_bean = NULL;
+ axis2_char_t *internal_sequence_id = NULL;
axis2_bool_t sent = AXIS2_FALSE;
- sandesha2_seq_property_bean_t *int_seq_bean = NULL;
+ axis2_op_ctx_t *op_ctx = NULL;
+ axis2_op_t *op = NULL;
+ int mep = -1;
+ axis2_char_t *rm_version = NULL;
+ axis2_bool_t one_way = AXIS2_FALSE;
+ axis2_bool_t is_anonymous_reply_to = AXIS2_FALSE;
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[Sandesha2] Entry:sandesha2_app_msg_processor_send_ack_if_reqd");
- AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
- "[Sandesha2]Entry:sandesha2_app_msg_processor_send_ack_if_reqd");
AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, msg_str, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, seq_prop_mgr, AXIS2_FAILURE);
- seq = sandesha2_msg_ctx_get_sequence(rm_msg_ctx, env);
- seq_id = sandesha2_identifier_get_identifier(
- sandesha2_seq_get_identifier(seq, env), env);
- conf_ctx = axis2_msg_ctx_get_conf_ctx(sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx,
- env), env);
- if(!conf_ctx)
+
+ msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
+
+ acks_to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, rmd_sequence_id,
+ SANDESHA2_SEQ_PROP_ACKS_TO_EPR);
+ if(acks_to_bean)
+ {
+ acks_to_str = axutil_strdup(env, sandesha2_seq_property_bean_get_value(acks_to_bean, env));
+ sandesha2_seq_property_bean_free(acks_to_bean, env);
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] acknowledgment bean is null");
+ return AXIS2_FAILURE;
+ }
+
+ /*temp_to_epr = axis2_msg_ctx_get_to(msg_ctx, env);
+ if(temp_to_epr)
+ {
+ const axis2_char_t *temp_to_addr = NULL;
+
+ temp_to_addr = axis2_endpoint_ref_get_address(temp_to_epr, env);
+ if(temp_to_addr)
+ {
+ to_epr = axis2_endpoint_ref_create(env, temp_to_addr);
+ }
+ }*/
+
+ reply_to_epr = axis2_msg_ctx_get_reply_to(msg_ctx, env);
+ if(reply_to_epr)
+ {
+ reply_to_addr = axis2_endpoint_ref_get_address(reply_to_epr, env);
+ }
+
+ op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
+ if(op_ctx)
+ {
+ op = axis2_op_ctx_get_op(op_ctx, env);
+ mep = axis2_op_get_axis_specific_mep_const(op, env);
+ }
+
+ one_way = AXIS2_MEP_CONSTANT_IN_ONLY == mep;
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "MEP:%d", mep);
+
+ rm_version = sandesha2_utils_get_rm_version(env, rmd_sequence_id, seq_prop_mgr);
+ if(!rm_version)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "[sandesha2] cont_ctx is NULL");
+ "[sandesha2]Unable to find RM spec version for seq_id %s", rmd_sequence_id);
+ if(acks_to_str)
+ {
+ AXIS2_FREE(env->allocator, acks_to_str);
+ }
+ return AXIS2_FAILURE;
+ }
+
+ 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)
+ {
+ /* This means acknowledgment address is anomymous and RM version is 1.0. Flow comes to
+ * this block only in the server side.
+ * In other words this is RM 1.0 replay model in application server side. In this case
+ * we do not send the acknowledgment message here. Instead we send it in the message out path.
+ * See sandesha2_app_msg_processor_send_app_msg() code.
+ */
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] RM 1.0 replay model in application server side");
+
+ if(acks_to_str)
+ {
+ AXIS2_FREE(env->allocator, acks_to_str);
+ }
+
+ if(rm_version)
+ {
+ AXIS2_FREE(env->allocator, rm_version);
+ }
+
+ AXIS2_LOG_INFO(env->log, "[Sandesha2] Exit:sandesha2_app_msg_processor_send_ack_if_reqd");
+
+ return AXIS2_SUCCESS;
+ }
+
+ if(acks_to_str)
+ {
+ AXIS2_FREE(env->allocator, acks_to_str);
+ }
+
+ if(rm_version)
+ {
+ AXIS2_FREE(env->allocator, rm_version);
+ }
+
+ conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
+ if(!conf_ctx)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] cont_ctx is NULL");
AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CONF_CTX_NULL, AXIS2_FAILURE);
return AXIS2_FAILURE;
}
+
ack_requested = sandesha2_msg_ctx_get_ack_requested(rm_msg_ctx, env);
if(ack_requested)
{
- sandesha2_ack_requested_set_must_understand(ack_requested, env,
- AXIS2_FALSE);
+ sandesha2_ack_requested_set_must_understand(ack_requested, env, AXIS2_FALSE);
sandesha2_msg_ctx_add_soap_envelope(rm_msg_ctx, env);
}
- ack_rm_msg = sandesha2_ack_mgr_generate_ack_msg(env, rm_msg_ctx, seq_id,
- seq_prop_mgr);
- ack_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(ack_rm_msg, env);
- int_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
- seq_id, SANDESHA2_SEQ_PROP_SPECIAL_INTERNAL_SEQ_ID);
- /* Following code block send the ack messages through sender. If we comment this
- * it will be sent directly avoiding the sender. We will enter this block only
- * in application client side when sequence offer is on.
+
+ ack_rm_msg_ctx = sandesha2_ack_mgr_generate_ack_msg(env, rm_msg_ctx, rmd_sequence_id, seq_prop_mgr);
+ ack_msg_ctx = sandesha2_msg_ctx_get_msg_ctx(ack_rm_msg_ctx, env);
+
+ /* If it is not one way message we piggyback the acknowledgment messages on the application messages
+ * or terminate message. So here we store them in the database so that when the application/terminate
+ * message sent it pick it up from the database to piggyback. See app_msg_send() function.
*/
- if(int_seq_bean)
+ if(!one_way)
{
- axis2_transport_out_desc_t *transport_out = NULL;
- long send_time = -1;
- axis2_char_t *key = NULL;
- axutil_property_t *property = NULL;
- sandesha2_sender_bean_t *ack_bean = NULL;
- axis2_char_t *int_seq_id = NULL;
+ axis2_relates_to_t *relates_to = NULL;
+ const axis2_char_t *related_msg_id = NULL;
+ axis2_char_t *outgoing_seq_id = NULL;
+ sandesha2_seq_property_bean_t *relates_to_bean = NULL;
+ sandesha2_seq_property_bean_t *outgoing_seq_id_bean = NULL;
+
+ rms_internal_sequence_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
+ rmd_sequence_id, SANDESHA2_SEQUENCE_PROPERTY_RMS_INTERNAL_SEQ_ID);
+
+ if(rms_internal_sequence_bean)
+ {
+ internal_sequence_id = sandesha2_seq_property_bean_get_value(rms_internal_sequence_bean, env);
+ }
+
key = axutil_uuid_gen(env);
ack_bean = sandesha2_sender_bean_create(env);
- sandesha2_sender_bean_set_msg_ctx_ref_key(ack_bean, env, key);
- sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, key,
- ack_msg_ctx);
- send_time = sandesha2_utils_get_current_time_in_millis(env);
+
+ relates_to = axis2_msg_ctx_get_relates_to(msg_ctx, env);
+ if(relates_to)
+ {
+
+ related_msg_id = axis2_relates_to_get_value(relates_to, env);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "related_msg_id:%s", related_msg_id);
+ relates_to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
+ related_msg_id, SANDESHA2_SEQ_PROP_RELATED_MSG_ID);
+ if(relates_to_bean)
+ {
+
+ outgoing_seq_id = sandesha2_seq_property_bean_get_value(relates_to_bean, env);
+
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "outgoing_seq_id:%s", outgoing_seq_id);
+ sandesha2_sender_bean_set_seq_id(ack_bean, env, outgoing_seq_id);
+ sandesha2_seq_property_mgr_remove(seq_prop_mgr, env, (axis2_char_t *) related_msg_id,
+ SANDESHA2_SEQ_PROP_RELATED_MSG_ID);
+ }
+ }
+
+ if(!outgoing_seq_id)
+ {
+ axis2_char_t *outgoing_internal_seq_id = NULL;
+ axis2_char_t *outgoing_seq_id = NULL;
+
+ outgoing_internal_seq_id = sandesha2_utils_get_internal_sequence_id(env, rmd_sequence_id);
+ outgoing_seq_id_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
+ outgoing_internal_seq_id, SANDESHA2_SEQUENCE_PROPERTY_RMS_SEQ_ID);
+ if(outgoing_seq_id_bean)
+ {
+ outgoing_seq_id = sandesha2_seq_property_bean_get_value(outgoing_seq_id_bean, env);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "outgoing_seq_id:%s", outgoing_seq_id);
+ sandesha2_sender_bean_set_seq_id(ack_bean, env, outgoing_seq_id);
+ }
+ }
+
+ sandesha2_sender_bean_set_msg_ctx_ref_key(ack_bean, env, key);
+ send_time = sandesha2_utils_get_current_time_in_millis(env);
sandesha2_sender_bean_set_time_to_send(ack_bean, env, send_time);
- sandesha2_sender_bean_set_msg_id(ack_bean, env,
- sandesha2_msg_ctx_get_msg_id(ack_rm_msg, env));
+ sandesha2_sender_bean_set_msg_id(ack_bean, env, sandesha2_msg_ctx_get_msg_id(ack_rm_msg_ctx, env));
sandesha2_sender_bean_set_send(ack_bean, env, AXIS2_TRUE);
- int_seq_id = sandesha2_seq_property_bean_get_value(int_seq_bean, env);
- sandesha2_sender_bean_set_internal_seq_id(ack_bean, env, int_seq_id);
- sandesha2_sender_bean_set_seq_id(ack_bean, env, seq_id);
[... 2170 lines stripped ...]
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org