You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2006/04/21 11:06:58 UTC
svn commit: r395821 - in /webservices/axis2/trunk/c:
include/axis2_mep_client.h modules/core/clientapi/call.c
modules/core/clientapi/callback_recv.c modules/core/clientapi/mep_client.c
modules/core/engine/engine.c
Author: samisa
Date: Fri Apr 21 02:06:56 2006
New Revision: 395821
URL: http://svn.apache.org/viewcvs?rev=395821&view=rev
Log:
Fixes to get the two cannel seperate listner case working correctly for both
success and fault cases
Modified:
webservices/axis2/trunk/c/include/axis2_mep_client.h
webservices/axis2/trunk/c/modules/core/clientapi/call.c
webservices/axis2/trunk/c/modules/core/clientapi/callback_recv.c
webservices/axis2/trunk/c/modules/core/clientapi/mep_client.c
webservices/axis2/trunk/c/modules/core/engine/engine.c
Modified: webservices/axis2/trunk/c/include/axis2_mep_client.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_mep_client.h?rev=395821&r1=395820&r2=395821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_mep_client.h (original)
+++ webservices/axis2/trunk/c/include/axis2_mep_client.h Fri Apr 21 02:06:56 2006
@@ -154,8 +154,12 @@
axis2_char_t *mep);
axis2_msg_ctx_t* AXIS2_CALL
-axis2_two_way_send(axis2_env_t **env,
+axis2_mep_client_two_way_send(axis2_env_t **env,
axis2_msg_ctx_t *msg_ctx);
+
+axis2_msg_ctx_t* AXIS2_CALL
+axis2_mep_client_receive(axis2_env_t **env,
+ axis2_msg_ctx_t *msg_ctx);
/************************** Start of function macros **************************/
Modified: webservices/axis2/trunk/c/modules/core/clientapi/call.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/clientapi/call.c?rev=395821&r1=395820&r2=395821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/call.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/call.c Fri Apr 21 02:06:56 2006
@@ -424,6 +424,16 @@
axis2_callback_t *callback = NULL;
axis2_status_t status = AXIS2_FAILURE;
+ axis2_char_t *address = NULL;
+ axis2_char_t *epr_address = NULL;
+ property = axis2_property_create(env);
+ AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_REQUEST);
+ epr_address = AXIS2_ENDPOINT_REF_GET_ADDRESS(call_impl->to, env);
+ address = AXIS2_STRDUP(epr_address, env);
+ AXIS2_PROPERTY_SET_VALUE(property, env, address);
+ AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env,
+ AXIS2_TRANSPORT_URL, property, AXIS2_FALSE);
+
long index = 0;
/* This means doing a Request-Response invocation using two channels.
If the transport is a two way transport (e.g. http), only one channel is used
@@ -440,13 +450,23 @@
if (status != AXIS2_SUCCESS)
return NULL;
- index = call_impl->timeout_ms / 100;
+ index = call_impl->timeout_ms / 10;
while (!(AXIS2_CALLBACK_GET_COMPLETE(callback, env)))
{
+ axis2_bool_t same_channel_processed = AXIS2_FALSE;
/*wait till the reponse arrives*/
if (index-- >= 0)
{
- AXIS2_USLEEP(100);
+ AXIS2_USLEEP(10000);
+ if (!same_channel_processed)
+ {
+ axis2_msg_ctx_t *response_msg_ctx =
+ axis2_mep_client_receive(env, msg_ctx);
+ if (response_msg_ctx)
+ if (AXIS2_MSG_CTX_GET_SOAP_ENVELOPE(response_msg_ctx, env))
+ return response_msg_ctx;
+ same_channel_processed = AXIS2_TRUE;
+ }
}
else
{
@@ -454,6 +474,7 @@
return NULL;
}
}
+
/* process the result of the invocation */
if (AXIS2_CALLBACK_GET_ENVELOPE(callback, env))
{
@@ -478,13 +499,13 @@
axis2_op_ctx_t *op_ctx = NULL;
axis2_msg_ctx_t *response = NULL;
axis2_soap_envelope_t *response_envelope = NULL;
- axis2_char_t *address = NULL;
+ axis2_char_t *address = NULL;
axis2_char_t *epr_address = NULL;
/* Usual Request-Response Sync implemetation */
property = axis2_property_create(env);
AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_REQUEST);
- epr_address = AXIS2_ENDPOINT_REF_GET_ADDRESS(call_impl->to, env);
+ epr_address = AXIS2_ENDPOINT_REF_GET_ADDRESS(call_impl->to, env);
address = AXIS2_STRDUP(epr_address, env);
AXIS2_PROPERTY_SET_VALUE(property, env, address);
AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env,
@@ -501,7 +522,7 @@
AXIS2_OP_REGISTER_OP_CTX(op, env, msg_ctx, op_ctx);
/*Send the SOAP Message and receive a response */
- response = axis2_two_way_send(env, msg_ctx);
+ response = axis2_mep_client_two_way_send(env, msg_ctx);
if (!response)
return NULL;
@@ -893,7 +914,7 @@
AXIS2_MSG_CTX_SET_SVC_CTX(args_list->msg_ctx, thread_env, args_list->call_impl->svc_ctx);
/* send the request and wait for reponse */
- response = axis2_two_way_send(thread_env, args_list->msg_ctx);
+ response = axis2_mep_client_two_way_send(thread_env, args_list->msg_ctx);
args_list->call_impl->async_result = axis2_async_result_create(thread_env, response);
AXIS2_CALLBACK_INVOKE_ON_COMPLETE(args_list->callback, thread_env, args_list->call_impl->async_result);
AXIS2_CALLBACK_SET_COMPLETE(args_list->callback, thread_env, AXIS2_TRUE);
Modified: webservices/axis2/trunk/c/modules/core/clientapi/callback_recv.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/clientapi/callback_recv.c?rev=395821&r1=395820&r2=395821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/callback_recv.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/callback_recv.c Fri Apr 21 02:06:56 2006
@@ -144,8 +144,8 @@
if (callback_recv_impl->base)
{
- AXIS2_MSG_RECV_FREE(callback_recv_impl->base, env);
- callback_recv_impl->base = NULL;
+ /*AXIS2_MSG_RECV_FREE(callback_recv_impl->base, env);
+ callback_recv_impl->base = NULL;*/
}
if (callback_recv_impl->callback_map)
@@ -204,6 +204,7 @@
axis2_msg_info_headers_t *msg_info_headers = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ printf("axis2_callback_recv_receive\n");
callback_recv_impl = AXIS2_INTF_TO_IMPL(msg_recv->derived);
Modified: webservices/axis2/trunk/c/modules/core/clientapi/mep_client.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/clientapi/mep_client.c?rev=395821&r1=395820&r2=395821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/mep_client.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/mep_client.c Fri Apr 21 02:06:56 2006
@@ -515,7 +515,7 @@
return AXIS2_SUCCESS;
}
-axis2_msg_ctx_t* AXIS2_CALL axis2_two_way_send(axis2_env_t **env, axis2_msg_ctx_t *msg_ctx)
+axis2_msg_ctx_t* AXIS2_CALL axis2_mep_client_two_way_send(axis2_env_t **env, axis2_msg_ctx_t *msg_ctx)
{
axis2_engine_t *engine = NULL;
axis2_status_t status = AXIS2_SUCCESS;
@@ -537,6 +537,93 @@
if (status != AXIS2_SUCCESS)
return NULL;
+ /* create the response */
+ response = axis2_msg_ctx_create(env, conf_ctx,
+ AXIS2_MSG_CTX_GET_TRANSPORT_IN_DESC(msg_ctx, env),
+ AXIS2_MSG_CTX_GET_TRANSPORT_OUT_DESC(msg_ctx, env));
+ if (!response)
+ return NULL;
+
+ property = AXIS2_MSG_CTX_GET_PROPERTY(msg_ctx, env, AXIS2_TRANSPORT_IN, AXIS2_FALSE);
+ if(property)
+ {
+ AXIS2_MSG_CTX_SET_PROPERTY(response, env, AXIS2_TRANSPORT_IN, property,
+ AXIS2_FALSE);
+ property = NULL;
+ }
+
+ op = AXIS2_MSG_CTX_GET_OP(msg_ctx, env);
+ if (op)
+ {
+ AXIS2_OP_REGISTER_OP_CTX(op, env, response, AXIS2_MSG_CTX_GET_OP_CTX(msg_ctx, env));
+ }
+ AXIS2_MSG_CTX_SET_SERVER_SIDE(response, env, AXIS2_FALSE);
+ AXIS2_MSG_CTX_SET_CONF_CTX(response, env, AXIS2_MSG_CTX_GET_CONF_CTX(msg_ctx, env));
+ AXIS2_MSG_CTX_SET_SVC_GRP_CTX(response, env, AXIS2_MSG_CTX_GET_SVC_GRP_CTX(msg_ctx, env));
+
+ /* If request is REST we assume the response is REST, so set the variable*/
+ AXIS2_MSG_CTX_SET_DOING_REST(response, env, AXIS2_MSG_CTX_GET_DOING_REST(msg_ctx, env));
+
+ soap_ns_uri = AXIS2_MSG_CTX_GET_IS_SOAP_11(msg_ctx, env) ?
+ AXIS2_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI:AXIS2_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
+
+ response_envelope = axis2_http_transport_utils_create_soap_msg(env,
+ msg_ctx, soap_ns_uri);
+ if (response_envelope)
+ {
+ AXIS2_MSG_CTX_SET_SOAP_ENVELOPE(response, env, response_envelope);
+ if (engine)
+ {
+ AXIS2_ENGINE_FREE(engine, env);
+ engine = NULL;
+ }
+
+ engine = axis2_engine_create(env, conf_ctx);
+ if (engine)
+ {
+ status = AXIS2_ENGINE_RECEIVE(engine, env, response);
+ if (status != AXIS2_SUCCESS)
+ return NULL;
+ }
+
+ }
+ else
+ {
+ /* if it is a two way message, then the status should be in error,
+ else it is a one way message */
+ if (AXIS2_ERROR_GET_STATUS_CODE((*env)->error) != AXIS2_SUCCESS)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_BLOCKING_INVOCATION_EXPECTS_RESPONSE, AXIS2_FAILURE);
+ return NULL;
+ }
+ }
+
+ /* property is NULL, and we set null for AXIS2_TRANSPORT_IN in msg_ctx to
+ avoid double free of this property */
+ AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env, AXIS2_TRANSPORT_IN, property,
+ AXIS2_FALSE);
+
+ if(NULL != engine)
+ {
+ AXIS2_ENGINE_FREE(engine, env);
+ engine = NULL;
+ }
+ return response;
+}
+
+axis2_msg_ctx_t* AXIS2_CALL axis2_mep_client_receive(axis2_env_t **env, axis2_msg_ctx_t *msg_ctx)
+{
+ axis2_engine_t *engine = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+ axis2_msg_ctx_t *response = NULL;
+ axis2_conf_ctx_t *conf_ctx = NULL;
+ axis2_op_t *op = NULL;
+ axis2_soap_envelope_t *response_envelope = NULL;
+ axis2_char_t *soap_ns_uri = NULL;
+ axis2_property_t *property = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
/* create the response */
response = axis2_msg_ctx_create(env, conf_ctx,
AXIS2_MSG_CTX_GET_TRANSPORT_IN_DESC(msg_ctx, env),
Modified: webservices/axis2/trunk/c/modules/core/engine/engine.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/engine.c?rev=395821&r1=395820&r2=395821&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/engine.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/engine.c Fri Apr 21 02:06:56 2006
@@ -1004,7 +1004,7 @@
if (header_block)
{
if (AXIS2_SOAP_HEADER_BLOCK_IS_PROCESSED(header_block , env) ||
- AXIS2_SOAP_HEADER_BLOCK_GET_MUST_UNDERSTAND(header_block, env))
+ !AXIS2_SOAP_HEADER_BLOCK_GET_MUST_UNDERSTAND(header_block, env))
{
continue;
}