Author: damitha
Date: Sat May 24 06:17:02 2008
New Revision: 659816
URL: http://svn.apache.org/viewvc?rev=659816&view=rev
Log:
Sending create sequence in the same thread as client app thread
Modified:
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/msgprocessors/create_seq_msg_processor.c
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c
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=659816&r1=659815&r2=659816&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
Sat May 24 06:17:02 2008
@@ -91,9 +91,14 @@
axis2_char_t *list,
long num);
-static axis2_status_t AXIS2_CALL
+static axis2_bool_t AXIS2_CALL
sandesha2_app_msg_processor_check_for_create_seq_response(
const axutil_env_t *env,
+ axis2_msg_ctx_t *create_seq_msg_ctx);
+
+static axis2_status_t AXIS2_CALL
+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);
@@ -1027,6 +1032,8 @@
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);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]
dam_incoming_seq_id:%s", incoming_seq_id);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]
dam_int_seq_id3:%s", internal_seq_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.
@@ -1067,12 +1074,13 @@
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_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);
if(property)
+ {
last_app_msg = axutil_property_get_value(property, env);
+ }
+
if(last_app_msg && 0 == axutil_strcmp(last_app_msg, AXIS2_VALUE_TRUE))
{
axis2_char_t *spec_ver = NULL;
@@ -1237,6 +1245,7 @@
out_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
internal_seq_id,
SANDESHA2_SEQ_PROP_OUT_SEQ_ID);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] dam_int_seq_id2:%s",
internal_seq_id);
if(is_svr_side)
{
axis2_char_t *incoming_seq_id = NULL;
@@ -1723,6 +1732,11 @@
}
create_seq_msg = sandesha2_msg_ctx_get_msg_ctx(create_seq_rm_msg, env);
+ if(!create_seq_msg)
+ {
+ return AXIS2_FAILURE;
+ }
+
axis2_msg_ctx_set_relates_to(create_seq_msg, env, NULL);
str_key = axutil_uuid_gen(env);
create_seq_bean = sandesha2_create_seq_bean_create_with_data(env,
internal_seq_id,
@@ -1783,8 +1797,11 @@
/*if(!axis2_engine_resume_send(engine, env, create_seq_msg))*/
if(axis2_engine_send(engine, env, create_seq_msg))
{
- status =
sandesha2_app_msg_processor_check_for_create_seq_response(env, create_seq_msg,
- storage_mgr);
+ if(sandesha2_app_msg_processor_check_for_create_seq_response(env,
create_seq_msg))
+ {
+ /*status =
sandesha2_app_msg_processor_process_create_seq_response(env, create_seq_msg,
+ storage_mgr);*/
+ }
}
else
{
@@ -1807,14 +1824,21 @@
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Transport
sender invoke failed");
}
}
- status =
sandesha2_app_msg_processor_check_for_create_seq_response(env, create_seq_msg,
- storage_mgr);
- if(!status)
+ if(sandesha2_app_msg_processor_check_for_create_seq_response(env,
create_seq_msg))
{
- break;
+ status =
sandesha2_app_msg_processor_process_create_seq_response(env, create_seq_msg,
+ storage_mgr);
+
+ if(!status)
+ {
+ break;
+ }
}
out_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
internal_seq_id,
SANDESHA2_SEQ_PROP_OUT_SEQ_ID);
+
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
"came3*********************************");
+
}
create_seq_op_ctx = axis2_msg_ctx_get_op_ctx(create_seq_msg, env);
@@ -1828,23 +1852,13 @@
return status;
}
-static axis2_status_t AXIS2_CALL
+static axis2_bool_t AXIS2_CALL
sandesha2_app_msg_processor_check_for_create_seq_response(
const axutil_env_t *env,
- axis2_msg_ctx_t *create_seq_msg_ctx,
- sandesha2_storage_mgr_t *storage_mgr)
+ axis2_msg_ctx_t *create_seq_msg_ctx)
{
- axutil_property_t *property = NULL;
- axis2_msg_ctx_t *res_msg_ctx = NULL;
axiom_soap_envelope_t *res_envelope = NULL;
axis2_char_t *soap_ns_uri = NULL;
- axis2_svc_ctx_t *svc_ctx = NULL;
- axis2_svc_grp_t *svc_grp = NULL;
- axis2_svc_t *svc = NULL;
- axis2_op_t *op = NULL;
- axis2_conf_ctx_t *conf_ctx = NULL;
- axis2_conf_t *conf = NULL;
- axis2_op_ctx_t *create_seq_res_op_ctx = NULL;
axis2_bool_t svr_side = AXIS2_FALSE;
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
@@ -1852,11 +1866,6 @@
AXIS2_PARAM_CHECK(env->error, create_seq_msg_ctx, AXIS2_FAILURE);
- if(!create_seq_msg_ctx)
- {
- return AXIS2_SUCCESS;
- }
-
svr_side = axis2_msg_ctx_get_server_side(create_seq_msg_ctx, env);
soap_ns_uri = axis2_msg_ctx_get_is_soap_11(create_seq_msg_ctx, env) ?
AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI:
@@ -1865,7 +1874,8 @@
res_envelope =
axis2_msg_ctx_get_response_soap_envelope(create_seq_msg_ctx, env);
if(!res_envelope)
{
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]Response envelope
not found");
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Response envelope
not found");
+
res_envelope = (axiom_soap_envelope_t *)
axis2_http_transport_utils_create_soap_msg(env,
create_seq_msg_ctx, soap_ns_uri);
if(!res_envelope)
@@ -1873,7 +1883,7 @@
/* There is no response message context. Therefore it can be
deduced that this is one
* way message. So return.
*/
- return AXIS2_SUCCESS;
+ return AXIS2_FALSE;
}
}
@@ -1882,7 +1892,55 @@
/* We check and process the sync response only in the application
client
* side.
*/
- return AXIS2_SUCCESS;
+ return AXIS2_FALSE;
+ }
+
+ return AXIS2_TRUE;
+}
+
+static axis2_status_t AXIS2_CALL
+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)
+{
+ axutil_property_t *property = NULL;
+ axis2_msg_ctx_t *res_msg_ctx = NULL;
+ axiom_soap_envelope_t *res_envelope = NULL;
+ axis2_char_t *soap_ns_uri = NULL;
+ axis2_svc_ctx_t *svc_ctx = NULL;
+ axis2_svc_grp_t *svc_grp = NULL;
+ axis2_svc_t *svc = NULL;
+ axis2_op_t *op = NULL;
+ axis2_conf_ctx_t *conf_ctx = NULL;
+ axis2_conf_t *conf = NULL;
+ axis2_op_ctx_t *create_seq_res_op_ctx = NULL;
+
+ AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+ "[sandesha2]
Entry:sandesha2_app_msg_processor_process_create_seq_response");
+
+ AXIS2_PARAM_CHECK(env->error, create_seq_msg_ctx, AXIS2_FAILURE);
+
+ soap_ns_uri = axis2_msg_ctx_get_is_soap_11(create_seq_msg_ctx, env) ?
+ AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI:
+ AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
+
+ res_envelope =
axis2_msg_ctx_get_response_soap_envelope(create_seq_msg_ctx, env);
+ if(!res_envelope)
+ {
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Response envelope
not found");
+ res_envelope = (axiom_soap_envelope_t *)
axis2_http_transport_utils_create_soap_msg(env,
+ create_seq_msg_ctx, soap_ns_uri);
+ if(!res_envelope)
+ {
+ /* There is no response message context. But in single channel
duplex scenario there should be
+ * an CSR in the back channel. So return failure.
+ */
+
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Response
envelope not found");
+
+ return AXIS2_FAILURE;
+ }
}
conf_ctx = axis2_msg_ctx_get_conf_ctx(create_seq_msg_ctx, env);
@@ -2020,7 +2078,7 @@
}
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
-
"[sandesha2]Exit:sandesha2_app_msg_processor_check_for_create_seq_response");
+ "[sandesha2]
Exit:sandesha2_app_msg_processor_process_create_seq_response");
return AXIS2_SUCCESS;
}
Modified:
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
URL:
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c?rev=659816&r1=659815&r2=659816&view=diff
==============================================================================
---
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
(original)
+++
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_msg_processor.c
Sat May 24 06:17:02 2008
@@ -75,6 +75,13 @@
const axutil_env_t *env,
sandesha2_msg_ctx_t *rm_msg_ctx);
+static void AXIS2_CALL
+sandesha2_create_seq_msg_processor_create_seq_msg_already_received(
+ const axutil_env_t *env,
+ axis2_char_t *seq_id,
+ sandesha2_msg_ctx_t *rm_msg_ctx,
+ sandesha2_create_seq_mgr_t *create_seq_mgr);
+
static axis2_bool_t AXIS2_CALL
sandesha2_create_seq_msg_processor_offer_accepted(
const axutil_env_t *env,
@@ -167,7 +174,7 @@
axis2_engine_t *engine = NULL;
axis2_char_t *addr_ns_uri = NULL;
axis2_char_t *anon_uri = NULL;
- axis2_endpoint_ref_t *to_epr = NULL;
+ axis2_char_t *to_addr = NULL;
axis2_op_ctx_t *op_ctx = NULL;
axis2_char_t *dbname = NULL;
sandesha2_create_seq_mgr_t *create_seq_mgr = NULL;
@@ -219,8 +226,9 @@
return AXIS2_SUCCESS;
}
out_msg_ctx = sandesha2_utils_create_out_msg_ctx(env, msg_ctx);
- new_seq_id = sandesha2_seq_mgr_setup_new_seq(env, rm_msg_ctx, seq_prop_mgr,
- next_msg_mgr);
+
+ new_seq_id = sandesha2_seq_mgr_setup_new_seq(env, rm_msg_ctx,
seq_prop_mgr, next_msg_mgr);
+
create_seq_res_msg = sandesha2_msg_creator_create_create_seq_res_msg(env,
rm_msg_ctx, out_msg_ctx, new_seq_id, seq_prop_mgr);
axis2_msg_ctx_set_flow(out_msg_ctx, env, AXIS2_OUT_FLOW);
@@ -240,8 +248,7 @@
sandesha2_msg_ctx_set_property(create_seq_res_msg, env,
SANDESHA2_APPLICATION_PROCESSING_DONE, property);
- create_seq_res_part = sandesha2_msg_ctx_get_create_seq_res(
- create_seq_res_msg, env);
+ create_seq_res_part =
sandesha2_msg_ctx_get_create_seq_res(create_seq_res_msg, env);
seq_offer = sandesha2_create_seq_get_seq_offer(create_seq_part,
env);
/* Offer processing */
@@ -251,26 +258,38 @@
axis2_char_t *offer_seq_id = NULL;
axis2_bool_t offer_accepted = AXIS2_FALSE;
- if(create_seq_res_part)
+ if(create_seq_res_part)
+ {
accept = sandesha2_create_seq_res_get_accept(create_seq_res_part,
env);
+ }
if(!accept)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Accept part "
- "has not genereated for a message with offer");
- AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_REQD_MSG_PART_MISSING,
- AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[sandesha2] Accept part has not genereated for a message
with offer");
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_REQD_MSG_PART_MISSING,
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(next_msg_mgr)
+ {
sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+ }
+
return AXIS2_FAILURE;
}
- offer_seq_id = sandesha2_identifier_get_identifier(
- sandesha2_seq_offer_get_identifier(seq_offer, env),
env);
- offer_accepted = sandesha2_create_seq_msg_processor_offer_accepted(
- env, offer_seq_id, rm_msg_ctx, create_seq_mgr);
+
+ offer_seq_id =
sandesha2_identifier_get_identifier(sandesha2_seq_offer_get_identifier(
+ seq_offer, env), env);
+
+ /* Check whether offered sequence id is valid or create sequence bean
already created */
+ offer_accepted =
sandesha2_create_seq_msg_processor_offer_accepted(env, offer_seq_id,
+ rm_msg_ctx, create_seq_mgr);
+
if(offer_accepted)
{
sandesha2_create_seq_bean_t *create_seq_bean = NULL;
@@ -278,100 +297,120 @@
sandesha2_seq_property_bean_t *out_seq_bean = NULL;
sandesha2_seq_property_bean_t *internal_seq_bean = NULL;
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "[sandesha2] Offer Accepted");
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] Offer
Accepted");
+
+ /*
+ * If previously a create sequence message has arrived with an
offer then there is
+ * a create sequence bean already created in the database. Free
it. Also free
+ * internal_seq_bean, and out_seq_bean.
+ */
+
sandesha2_create_seq_msg_processor_create_seq_msg_already_received(env,
offer_seq_id,
+ rm_msg_ctx, create_seq_mgr);
+
create_seq_bean = sandesha2_create_seq_bean_create(env);
- sandesha2_create_seq_bean_set_seq_id(create_seq_bean, env,
- offer_seq_id);
- internal_seq_id = sandesha2_utils_get_outgoing_internal_seq_id(env,
- new_seq_id);
- sandesha2_create_seq_bean_set_internal_seq_id(create_seq_bean, env,
- internal_seq_id);
- sandesha2_create_seq_bean_set_create_seq_msg_id(create_seq_bean,
env,
- axutil_uuid_gen(env));
+ sandesha2_create_seq_bean_set_seq_id(create_seq_bean, env,
offer_seq_id);
+ internal_seq_id =
sandesha2_utils_get_outgoing_internal_seq_id(env, new_seq_id);
+ sandesha2_create_seq_bean_set_internal_seq_id(create_seq_bean,
env, internal_seq_id);
+ sandesha2_create_seq_bean_set_create_seq_msg_id(create_seq_bean,
env,
+ axutil_uuid_gen(env));
+
sandesha2_create_seq_mgr_insert(create_seq_mgr, env,
create_seq_bean);
out_seq_bean = sandesha2_seq_property_bean_create(env);
- sandesha2_seq_property_bean_set_name(out_seq_bean, env,
- SANDESHA2_SEQ_PROP_OUT_SEQ_ID);
- /*sandesha2_seq_property_bean_set_seq_id(out_seq_bean, env,
- internal_seq_id);*/
- sandesha2_seq_property_bean_set_seq_id(out_seq_bean, env,
- internal_seq_id);
- sandesha2_seq_property_bean_set_value(out_seq_bean, env,
- offer_seq_id);
- sandesha2_seq_property_mgr_insert(seq_prop_mgr, env,
- out_seq_bean);
+ sandesha2_seq_property_bean_set_name(out_seq_bean, env,
SANDESHA2_SEQ_PROP_OUT_SEQ_ID);
+
+ sandesha2_seq_property_bean_set_seq_id(out_seq_bean, env,
internal_seq_id);
+ sandesha2_seq_property_bean_set_value(out_seq_bean, env,
offer_seq_id);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]
new_seq_id:%s", new_seq_id);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]
dam_int_seq_id1:%s", internal_seq_id);
+ sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, out_seq_bean);
internal_seq_bean = sandesha2_seq_property_bean_create(env);
sandesha2_seq_property_bean_set_name(internal_seq_bean, env,
- SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID);
- sandesha2_seq_property_bean_set_seq_id(internal_seq_bean, env,
- offer_seq_id);
- sandesha2_seq_property_bean_set_value(internal_seq_bean, env,
- internal_seq_id);
- sandesha2_seq_property_mgr_insert(seq_prop_mgr, env,
- internal_seq_bean);
+ SANDESHA2_SEQ_PROP_INTERNAL_SEQ_ID);
+
+ sandesha2_seq_property_bean_set_seq_id(internal_seq_bean, env,
offer_seq_id);
+ sandesha2_seq_property_bean_set_value(internal_seq_bean, env,
internal_seq_id);
+ sandesha2_seq_property_mgr_insert(seq_prop_mgr, env,
internal_seq_bean);
}
else
{
- sandesha2_create_seq_res_set_accept(create_seq_res_part, env,
NULL);
sandesha2_msg_ctx_add_soap_envelope(create_seq_res_msg, env);
}
}
acks_to = sandesha2_address_get_epr(sandesha2_acks_to_get_address(
- sandesha2_create_seq_get_acks_to(create_seq_part, env),
- env), env);
- if(!acks_to || !axis2_endpoint_ref_get_address(acks_to,
- env))
+ sandesha2_create_seq_get_acks_to(create_seq_part, env), env),
env);
+ if(!acks_to || !axis2_endpoint_ref_get_address(acks_to, env))
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Acks to is null");
- AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_EPR,
- AXIS2_FAILURE);
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_EPR,
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(next_msg_mgr)
+ {
sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+ }
+
return AXIS2_FAILURE;
}
- acks_to_bean = sandesha2_seq_property_bean_create_with_data(env,
- new_seq_id, SANDESHA2_SEQ_PROP_ACKS_TO_EPR,
- (axis2_char_t*)axis2_endpoint_ref_get_address(acks_to, env));
+
+ acks_to_bean = sandesha2_seq_property_bean_create_with_data(env,
new_seq_id,
+ SANDESHA2_SEQ_PROP_ACKS_TO_EPR,
(axis2_char_t*)axis2_endpoint_ref_get_address(acks_to, env));
+
sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, acks_to_bean);
+
op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
sandesha2_seq_mgr_update_last_activated_time(env, new_seq_id,
seq_prop_mgr);
+
engine = axis2_engine_create(env, conf_ctx);
+
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]axis2_engine_send");
+
axis2_engine_send(engine, env, out_msg_ctx);
if(engine)
+ {
axis2_engine_free(engine, env);
- to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
- new_seq_id, SANDESHA2_SEQ_PROP_TO_EPR);
+ }
+
+ to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
new_seq_id,
+ SANDESHA2_SEQ_PROP_TO_EPR);
if(!to_bean)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]wsa:To is not
set");
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(next_msg_mgr)
+ {
sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+ }
+
return AXIS2_FAILURE;
}
- to_epr = axis2_endpoint_ref_create(env,
- sandesha2_seq_property_bean_get_value(to_bean, env));
+
+ to_addr = sandesha2_seq_property_bean_get_value(to_bean, env);
addr_ns_uri = sandesha2_utils_get_seq_property(env, new_seq_id,
- SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE,
- seq_prop_mgr);
+ 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);
+ }
op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
- if(sandesha2_utils_is_anon_uri(env, axis2_endpoint_ref_get_address(to_epr,
- env)))
+ if(sandesha2_utils_is_anon_uri(env, to_addr))
{
axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
}
@@ -382,13 +421,21 @@
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(next_msg_mgr)
+ {
sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+ }
+
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
"[sandesha2] Exit: sandesha2_create_seq_msg_processor_process_in_msg");
+
return AXIS2_SUCCESS;
}
@@ -407,9 +454,8 @@
return AXIS2_SUCCESS;
}
-
-static axis2_bool_t AXIS2_CALL
-sandesha2_create_seq_msg_processor_offer_accepted(
+static void AXIS2_CALL
+sandesha2_create_seq_msg_processor_create_seq_msg_already_received(
const axutil_env_t *env,
axis2_char_t *seq_id,
sandesha2_msg_ctx_t *rm_msg_ctx,
@@ -417,20 +463,118 @@
{
sandesha2_create_seq_bean_t *find_bean = NULL;
axutil_array_list_t *list = NULL;
+ int size = 0;
AXIS2_PARAM_CHECK(env->error, seq_id, AXIS2_FALSE);
AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FALSE);
AXIS2_PARAM_CHECK(env->error, create_seq_mgr, AXIS2_FALSE);
- find_bean = sandesha2_create_seq_bean_create_with_data(env, NULL, NULL,
- seq_id);
+ find_bean = sandesha2_create_seq_bean_create_with_data(env, NULL, NULL,
seq_id);
list = sandesha2_create_seq_mgr_find(create_seq_mgr, env, find_bean);
+
+ if(list)
+ {
+ size = axutil_array_list_size(list, env);
+ }
+ if(list && 0 < size)
+ {
+ int i = 0;
+ sandesha2_create_seq_bean_t *create_seq_bean = NULL;
+
+ for(i = 0; i < size; i++)
+ {
+ create_seq_bean = (sandesha2_create_seq_bean_t *)
axutil_array_list_get(list, env, i);
+ if(create_seq_bean)
+ {
+ sandesha2_create_seq_bean_free(create_seq_bean, env);
+ }
+ }
+ }
+
+ if(list)
+ {
+ axutil_array_list_free(list, env);
+ }
+
+ find_bean = sandesha2_seq_property_bean_create_with_data(env, NULL, NULL,
seq_id);
+ list = sandesha2_seq_property_mgr_find(create_seq_mgr, env, find_bean);
+
+ if(list)
+ {
+ size = axutil_array_list_size(list, env);
+ }
+ if(list && 0 < size)
+ {
+ int i = 0;
+ sandesha2_seq_property_bean_t *seq_prop_bean = NULL;
+
+ for(i = 0; i < size; i++)
+ {
+ seq_prop_bean = (sandesha2_seq_property_bean_t *)
axutil_array_list_get(list, env, i);
+ if(seq_prop_bean)
+ {
+ axis2_char_t *internal_seq_id = NULL;
+ axutil_array_list_t *temp_list = NULL;
+ int temp_size = 0;
+ sandesha2_seq_property_bean_t *temp_find_bean = NULL;
+
+ internal_seq_id =
sandesha2_seq_property_bean_get_value(seq_prop_bean, env);
+
+ sandesha2_seq_property_bean_free(seq_prop_bean, env);
+
+ temp_find_bean =
sandesha2_seq_property_bean_create_with_data(env, NULL, NULL, internal_seq_id);
+ temp_list = sandesha2_seq_property_mgr_find(create_seq_mgr,
env, temp_find_bean);
+
+ if(temp_list)
+ {
+ temp_size = axutil_array_list_size(list, env);
+ }
+ if(temp_list && 0 < temp_size)
+ {
+ int j = 0;
+ sandesha2_seq_property_bean_t *temp_seq_prop_bean = NULL;
+
+ for(j = 0; j < temp_size; j++)
+ {
+ temp_seq_prop_bean = (sandesha2_seq_property_bean_t *)
axutil_array_list_get(temp_list, env, i);
+ if(temp_seq_prop_bean)
+ {
+
sandesha2_seq_property_bean_free(temp_seq_prop_bean, env);
+ }
+ }
+ }
+
+ if(temp_list)
+ {
+ axutil_array_list_free(temp_list, env);
+ }
+ }
+ }
+ }
+
+ if(list)
+ {
+ axutil_array_list_free(list, env);
+ }
+}
+
+
+static axis2_bool_t AXIS2_CALL
+sandesha2_create_seq_msg_processor_offer_accepted(
+ const axutil_env_t *env,
+ axis2_char_t *seq_id,
+ sandesha2_msg_ctx_t *rm_msg_ctx,
+ sandesha2_create_seq_mgr_t *create_seq_mgr)
+{
+ AXIS2_PARAM_CHECK(env->error, seq_id, AXIS2_FALSE);
+ AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FALSE);
+ AXIS2_PARAM_CHECK(env->error, create_seq_mgr, AXIS2_FALSE);
+
/* Single char offerings are not accepted */
if(1 >= axutil_strlen(seq_id))
+ {
return AXIS2_FALSE;
-
- if(NULL != list && 0 < axutil_array_list_size(list, env))
- return AXIS2_FALSE;
+ }
return AXIS2_TRUE;
}
Modified:
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c
URL:
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c?rev=659816&r1=659815&r2=659816&view=diff
==============================================================================
---
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c
(original)
+++
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/create_seq_res_msg_processor.c
Sat May 24 06:17:02 2008
@@ -178,7 +178,7 @@
axis2_char_t *dbname = NULL;
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
-
"[sandesha2]Entry:sandesha2_create_seq_res_msg_processor_process_in_msg");
+ "[sandesha2]
Entry:sandesha2_create_seq_res_msg_processor_process_in_msg");
AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
@@ -188,19 +188,10 @@
dbname = sandesha2_util_get_dbname(env, conf_ctx);
storage_mgr = sandesha2_utils_get_storage_mgr(env, dbname);
-/* seq_ack = sandesha2_msg_ctx_get_seq_ack(rm_msg_ctx, env);
- if(seq_ack)
- {
- sandesha2_msg_processor_t *ack_processor = NULL;
- ack_processor = sandesha2_ack_msg_processor_create(env);
- sandesha2_msg_processor_process_in_msg(ack_processor, env, rm_msg_ctx);
- }
-*/
-
csr_part = sandesha2_msg_ctx_get_create_seq_res(rm_msg_ctx, env);
if(!csr_part)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Create Sequence
Response part is null");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Create Sequence
Response part is null");
AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_REQD_MSG_PART_MISSING,
AXIS2_FAILURE);
if(storage_mgr)
{
@@ -213,7 +204,7 @@
csr_part, env), env);
if(!new_out_seq_id)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]New sequence id is
null");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] New sequence id
is null");
AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CANNOT_FIND_SEQ_ID,
AXIS2_FAILURE);
if(storage_mgr)
{
@@ -242,33 +233,51 @@
create_seq_bean = sandesha2_create_seq_mgr_retrieve(create_seq_mgr, env,
create_seq_msg_id);
if(!create_seq_bean)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2]Create Sequence
entry not found");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Create Sequence
entry not found");
+
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;
}
internal_seq_id =
sandesha2_create_seq_bean_get_internal_seq_id(create_seq_bean, env);
if(!internal_seq_id)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "[sandesha2]Internal sequence id is not set");
- AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CANNOT_FIND_SEQ_ID,
- AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] Internal sequence
id is not set");
+ AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_CANNOT_FIND_SEQ_ID,
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(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
+ }
+
return AXIS2_FAILURE;
}
@@ -308,12 +317,16 @@
sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, out_seq_bean);
sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, int_seq_bean);
accept = sandesha2_create_seq_res_get_accept(csr_part, env);
+
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
"came1*********************************");
+
if(accept)
{
sandesha2_seq_property_bean_t *special_int_seq_bean = NULL;
sandesha2_seq_property_bean_t *offerd_seq_bean = NULL;
axis2_char_t *offered_seq_id = NULL;
axis2_endpoint_ref_t *acks_to_epr = NULL;
+ axis2_endpoint_ref_t *to_epr = NULL;
sandesha2_seq_property_bean_t *acks_to_bean = NULL;
sandesha2_next_msg_bean_t *next_bean = NULL;
sandesha2_next_msg_mgr_t *next_msg_mgr = NULL;
@@ -324,49 +337,68 @@
axis2_char_t *rm_spec_ver = NULL;
axis2_char_t *addr_ns_val = NULL;
axis2_char_t *new_msg_store_key = NULL;
+ sandesha2_seq_property_bean_t *to_seq_bean = NULL;
+ sandesha2_msg_ctx_t *create_seq_rm_msg = NULL;
+ axis2_msg_ctx_t *create_seq_msg = NULL;
+ axis2_char_t *acks_to = NULL;
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
"came2*********************************");
+
next_msg_mgr = sandesha2_permanent_next_msg_mgr_create(env, dbname);
offerd_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr,
env,
internal_seq_id, SANDESHA2_SEQ_PROP_OFFERED_SEQ);
if(!offerd_seq_bean)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "[sandesha2]No offered sequence entry. But an accept was
received");
+ "[sandesha2] No offered sequence entry. But an accept was
received");
+
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(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
+ }
+
return AXIS2_FAILURE;
}
- offered_seq_id = sandesha2_seq_property_bean_get_value(offerd_seq_bean,
- env);
- special_int_seq_bean =
sandesha2_seq_property_bean_create_with_data(env,
- offered_seq_id, SANDESHA2_SEQ_PROP_SPECIAL_INTERNAL_SEQ_ID,
internal_seq_id);
+
+ offered_seq_id =
sandesha2_seq_property_bean_get_value(offerd_seq_bean, env);
+ special_int_seq_bean =
sandesha2_seq_property_bean_create_with_data(env, offered_seq_id,
+ SANDESHA2_SEQ_PROP_SPECIAL_INTERNAL_SEQ_ID, internal_seq_id);
+
if(special_int_seq_bean)
{
- sandesha2_seq_property_mgr_insert(seq_prop_mgr, env,
- special_int_seq_bean);
+ sandesha2_seq_property_mgr_insert(seq_prop_mgr, env,
special_int_seq_bean);
sandesha2_seq_property_bean_free(special_int_seq_bean, env);
}
+
acks_to_epr = sandesha2_address_get_epr(sandesha2_acks_to_get_address(
- sandesha2_accept_get_acks_to(accept, env), env), env);
+ sandesha2_accept_get_acks_to(accept, env), env), env);
+
acks_to_bean = sandesha2_seq_property_bean_create(env);
- sandesha2_seq_property_bean_set_name(acks_to_bean, env,
- SANDESHA2_SEQ_PROP_ACKS_TO_EPR);
- sandesha2_seq_property_bean_set_seq_id(acks_to_bean, env,
- offered_seq_id);
+ sandesha2_seq_property_bean_set_name(acks_to_bean, env,
SANDESHA2_SEQ_PROP_ACKS_TO_EPR);
+ sandesha2_seq_property_bean_set_seq_id(acks_to_bean, env,
offered_seq_id);
+
if (acks_to_epr)
{
sandesha2_seq_property_bean_set_value(acks_to_bean, env,
- (axis2_char_t*)axis2_endpoint_ref_get_address(
- acks_to_epr, env));
+ (axis2_char_t*)axis2_endpoint_ref_get_address(acks_to_epr,
env));
}
+
sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, acks_to_bean);
next_bean = sandesha2_next_msg_bean_create(env);
@@ -375,135 +407,177 @@
sandesha2_next_msg_bean_set_next_msg_no_to_process(next_bean, env, 1);
rm_spec_ver = sandesha2_msg_ctx_get_rm_spec_ver(rm_msg_ctx, env);
- if(0 == axutil_strcmp(SANDESHA2_SPEC_VERSION_1_1, rm_spec_ver))
+
+ if(!axutil_strcmp(SANDESHA2_SPEC_VERSION_1_1, rm_spec_ver))
{
- axis2_char_t *reply_to_addr =
sandesha2_utils_get_seq_property(env,
- internal_seq_id, SANDESHA2_SEQ_PROP_REPLY_TO_EPR,
seq_prop_mgr);
+ axis2_char_t *reply_to_addr =
sandesha2_utils_get_seq_property(env, internal_seq_id,
+ SANDESHA2_SEQ_PROP_REPLY_TO_EPR, seq_prop_mgr);
if(reply_to_addr)
{
polling_mode = sandesha2_utils_is_anon_uri(env, reply_to_addr);
if(reply_to_addr)
+ {
AXIS2_FREE(env->allocator, reply_to_addr);
+ }
}
}
+
+ acks_to = (axis2_char_t *) axis2_endpoint_ref_get_address(acks_to_epr,
env);
+ create_seq_rm_msg = sandesha2_msg_creator_create_create_seq_msg(env,
rm_msg_ctx,
+ internal_seq_id, acks_to, seq_prop_mgr);
+
+ if(!create_seq_rm_msg)
{
- sandesha2_msg_ctx_t *create_seq_rm_msg = NULL;
- axis2_msg_ctx_t *create_seq_msg = NULL;
- axis2_char_t *acks_to = NULL;
- axis2_endpoint_ref_t *to = NULL;
- sandesha2_seq_property_bean_t *to_seq_bean = NULL;
- acks_to = (axis2_char_t *)
axis2_endpoint_ref_get_address(acks_to_epr, env);
- create_seq_rm_msg =
sandesha2_msg_creator_create_create_seq_msg(env,
- rm_msg_ctx, internal_seq_id, acks_to, seq_prop_mgr);
- if(!create_seq_rm_msg)
- {
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "[sandesha2]create_seq_rm_msg is NULL");
- 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(storage_mgr)
- sandesha2_storage_mgr_free(storage_mgr, env);
- if(create_seq_rm_msg)
- sandesha2_msg_ctx_free(create_seq_rm_msg, env);
- return AXIS2_FAILURE;
-
- }
- sandesha2_msg_ctx_set_flow(create_seq_rm_msg, env,
- SANDESHA2_MSG_CTX_OUT_FLOW);
- create_seq_msg = sandesha2_msg_ctx_get_msg_ctx(create_seq_rm_msg,
env);
- to_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr,
env,
- internal_seq_id, SANDESHA2_SEQ_PROP_TO_EPR);
- if(to_seq_bean)
- {
- axis2_char_t *to_addr = sandesha2_seq_property_bean_get_value(
- to_seq_bean, env);
- to = axis2_endpoint_ref_create(env, to_addr);
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]to:%s",
- to_addr);
- }
- else
- {
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "[sandesha2]to_seq_bean is NULL");
- 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(storage_mgr)
- sandesha2_storage_mgr_free(storage_mgr, env);
- if(create_seq_rm_msg)
- sandesha2_msg_ctx_free(create_seq_rm_msg, env);
- return AXIS2_FAILURE;
- }
- axis2_msg_ctx_set_to(create_seq_msg, env, to);
- axis2_msg_ctx_set_relates_to(create_seq_msg, env, NULL);
- new_msg_store_key = axutil_uuid_gen(env);
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "[sandesha2]Storing msg_ctx with msg_id:%s",
- axis2_msg_ctx_get_msg_id(create_seq_msg, env));
- sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env,
new_msg_store_key,
- create_seq_msg);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"[sandesha2]create_seq_rm_msg is NULL");
+
+ 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(storage_mgr)
+ {
+ sandesha2_storage_mgr_free(storage_mgr, env);
+ }
+ if(create_seq_rm_msg)
+ {
+ sandesha2_msg_ctx_free(create_seq_rm_msg, env);
+ }
+
+ return AXIS2_FAILURE;
+ }
+
+ sandesha2_msg_ctx_set_flow(create_seq_rm_msg, env,
SANDESHA2_MSG_CTX_OUT_FLOW);
+ create_seq_msg = sandesha2_msg_ctx_get_msg_ctx(create_seq_rm_msg, env);
+ to_seq_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
internal_seq_id,
+ SANDESHA2_SEQ_PROP_TO_EPR);
+
+ if(to_seq_bean)
+ {
+ axis2_char_t *to_addr =
sandesha2_seq_property_bean_get_value(to_seq_bean, env);
+ to_epr = axis2_endpoint_ref_create(env, to_addr);
+
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]to:%s",
to_addr);
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[sandesha2] to_seq_bean
is NULL");
+
+ 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(storage_mgr)
+ {
+ sandesha2_storage_mgr_free(storage_mgr, env);
+ }
if(create_seq_rm_msg)
+ {
sandesha2_msg_ctx_free(create_seq_rm_msg, env);
+ }
+
+ return AXIS2_FAILURE;
}
- sandesha2_next_msg_bean_set_ref_msg_key(next_bean, env,
- new_msg_store_key);
+
+ axis2_msg_ctx_set_to(create_seq_msg, env, to_epr);
+ axis2_msg_ctx_set_relates_to(create_seq_msg, env, NULL);
+ new_msg_store_key = axutil_uuid_gen(env);
+
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2]Storing msg_ctx
with msg_id:%s",
+ axis2_msg_ctx_get_msg_id(create_seq_msg, env));
+
+ sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env,
new_msg_store_key, create_seq_msg);
+
+ if(create_seq_rm_msg)
+ {
+ sandesha2_msg_ctx_free(create_seq_rm_msg, env);
+ }
+
+ sandesha2_next_msg_bean_set_ref_msg_key(next_bean, env,
new_msg_store_key);
sandesha2_next_msg_bean_set_polling_mode(next_bean, env, polling_mode);
+
/* If polling_mode is true, starting the polling manager */
if(polling_mode)
{
sandesha2_utils_start_polling_mgr(env, conf_ctx, internal_seq_id);
}
+
sandesha2_next_msg_mgr_insert(next_msg_mgr, env, next_bean);
- spec_ver_bean = sandesha2_seq_property_bean_create_with_data(env,
- offered_seq_id, SANDESHA2_SEQ_PROP_RM_SPEC_VERSION, rm_spec_ver);
+ spec_ver_bean = sandesha2_seq_property_bean_create_with_data(env,
offered_seq_id,
+ SANDESHA2_SEQ_PROP_RM_SPEC_VERSION, rm_spec_ver);
+
sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, spec_ver_bean);
- rcvd_msg_bean = sandesha2_seq_property_bean_create_with_data(env,
- offered_seq_id,
- SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES, "");
+ rcvd_msg_bean = sandesha2_seq_property_bean_create_with_data(env,
offered_seq_id,
+ SANDESHA2_SEQ_PROP_SERVER_COMPLETED_MESSAGES, "");
+
sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, rcvd_msg_bean);
- msgs_bean = sandesha2_seq_property_bean_create_with_data(env,
- offered_seq_id,
- SANDESHA2_SEQ_PROP_CLIENT_COMPLETED_MESSAGES, "");
+ msgs_bean = sandesha2_seq_property_bean_create_with_data(env,
offered_seq_id,
+ SANDESHA2_SEQ_PROP_CLIENT_COMPLETED_MESSAGES, "");
+
sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, msgs_bean);
addr_ns_val = sandesha2_msg_ctx_get_addr_ns_val(rm_msg_ctx, env);
- addr_ver_bean = sandesha2_seq_property_bean_create_with_data(env,
- offered_seq_id,
- SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE,
- addr_ns_val);
+ addr_ver_bean = sandesha2_seq_property_bean_create_with_data(env,
offered_seq_id,
+ SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE, addr_ns_val);
sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, addr_ver_bean);
+
if(next_msg_mgr)
+ {
sandesha2_next_msg_mgr_free(next_msg_mgr, env);
+ }
}
+
sandesha2_seq_mgr_update_last_activated_time(env, internal_seq_id,
seq_prop_mgr);
op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
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(storage_mgr)
+ {
sandesha2_storage_mgr_free(storage_mgr, env);
+ }
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
"[sandesha2]Exit:sandesha2_create_seq_res_msg_processor_process_in_msg");
+
return AXIS2_SUCCESS;
}
Modified:
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c
URL:
http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c?rev=659816&r1=659815&r2=659816&view=diff
==============================================================================
---
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c
(original)
+++
webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c
Sat May 24 06:17:02 2008
@@ -317,10 +317,12 @@
/**
* 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(
@@ -353,30 +355,29 @@
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, "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, "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);
@@ -386,41 +387,57 @@
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)
+ {
+ 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);
+ }
+ 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);*/
+
+ /*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)
@@ -434,21 +451,26 @@
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);
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);
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;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]