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 da...@apache.org on 2008/06/09 19:00:27 UTC
svn commit: r665772 - in /webservices/axis2/trunk/c: include/
samples/user_guide/clients/ src/core/clientapi/ src/core/phaseresolver/
src/modules/mod_addr/
Author: damitha
Date: Mon Jun 9 10:00:27 2008
New Revision: 665772
URL: http://svn.apache.org/viewvc?rev=665772&view=rev
Log:
Please refer AXIS2C-1190 and AXIS2C-1189
Modified:
webservices/axis2/trunk/c/include/axis2_callback_recv.h
webservices/axis2/trunk/c/include/axis2_phase_resolver.h
webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking.c
webservices/axis2/trunk/c/src/core/clientapi/callback_recv.c
webservices/axis2/trunk/c/src/core/clientapi/listener_manager.c
webservices/axis2/trunk/c/src/core/clientapi/op_client.c
webservices/axis2/trunk/c/src/core/clientapi/svc_client.c
webservices/axis2/trunk/c/src/core/phaseresolver/phase_resolver.c
webservices/axis2/trunk/c/src/modules/mod_addr/addr_out_handler.c
Modified: webservices/axis2/trunk/c/include/axis2_callback_recv.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_callback_recv.h?rev=665772&r1=665771&r2=665772&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_callback_recv.h (original)
+++ webservices/axis2/trunk/c/include/axis2_callback_recv.h Mon Jun 9 10:00:27 2008
@@ -20,7 +20,11 @@
#define AXIS2_CALLBACK_RECV_H
/**
- * @defgroup axis2_callback_recv callback message receiver
+ * @defgroup axis2_callback_recv callback message receiver. This can be considered as a
+ * message receiver implementation for application client side which is similar to
+ * server side message receivers like raw_xml_in_out_msg_recv. Messages received by
+ * listener manager will finally end up here.
+ *
* @ingroup axis2_client_api
* callback message receiver, that is used as the message receiver in the
* operation in case of asynchronous invocation for receiving the result.
Modified: webservices/axis2/trunk/c/include/axis2_phase_resolver.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_phase_resolver.h?rev=665772&r1=665771&r2=665772&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_phase_resolver.h (original)
+++ webservices/axis2/trunk/c/include/axis2_phase_resolver.h Mon Jun 9 10:00:27 2008
@@ -143,27 +143,6 @@
struct axis2_module_desc *module);
/**
- * Engages the given global module to the given service. This means
- * the given module would be engaged to all operations of the given
- * service. This function should not be used to engage a module to
- * a service. Use axis2_phase_resolver_engage_module_to_svc() instead.
- * In future this function will be moved as a local function into
- * phase resolver.
- * @param phase_resolver pointer to phase resolver
- * @param env pointer to environment struct
- * @param svc pointer to service
- * @param module_desc pointer to module description
- * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
- */
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
-
- axis2_phase_resolver_engage_module_to_svc_from_global(
- axis2_phase_resolver_t * phase_resolver,
- const axutil_env_t * env,
- struct axis2_svc *svc,
- struct axis2_module_desc *module_desc);
-
- /**
* Engages the given module to the given service. This means
* the given module would be engaged to all operations of the given
* service.
Modified: webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking.c?rev=665772&r1=665771&r2=665772&view=diff
==============================================================================
--- webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking.c (original)
+++ webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking.c Mon Jun 9 10:00:27 2008
@@ -22,7 +22,7 @@
#include <axis2_client.h>
/* my on_complete callback function */
-axis2_status_t AXIS2_CALL echo_callback_on_complete(
+axis2_status_t AXIS2_CALL echo_process_response_envelope(
struct axis2_callback * callback,
const axutil_env_t * env);
@@ -33,7 +33,6 @@
int exception);
/* to check whether the callback is completed */
-int isComplete = 0;
int
main(
@@ -107,7 +106,7 @@
callback = axis2_callback_create(env);
/* Set our on_complete fucntion pointer to the callback object */
- axis2_callback_set_on_complete(callback, echo_callback_on_complete);
+ /*axis2_callback_set_on_complete(callback, echo_callback_on_complete);*/
/* Set our on_error function pointer to the callback object */
axis2_callback_set_on_error(callback, echo_callback_on_error);
@@ -118,27 +117,21 @@
/** Wait till callback is complete. Simply keep the parent thread running
until our on_complete or on_error is invoked */
- while (count < 30)
+
+ while(!axis2_callback_get_complete(callback, env))
{
- if (isComplete)
+ AXIS2_SLEEP(1);
+ if(count < 30)
{
- /* We are done with the callback */
- break;
+ count++;
}
- AXIS2_SLEEP(1);
- count++;
- }
-
- if (!(count < 30))
- {
- printf("\necho client invoke FAILED. Counter timed out.\n");
- }
-
- if (svc_client)
- {
- axis2_svc_client_free(svc_client, env);
- svc_client = NULL;
+ else
+ {
+ printf("\necho client invoke FAILED. Counter timed out.\n");
+ }
+
}
+ echo_process_response_envelope(callback, env);
if (env)
{
@@ -150,7 +143,7 @@
}
axis2_status_t AXIS2_CALL
-echo_callback_on_complete(
+echo_process_response_envelope(
struct axis2_callback * callback,
const axutil_env_t * env)
{
@@ -198,7 +191,7 @@
printf("\necho client invoke SUCCESSFUL!\n");
}
}
- isComplete = 1;
+
return status;
}
@@ -212,6 +205,6 @@
/** take necessary action on error */
printf("\necho client invike FAILED. Error code:%d ::%s", exception,
AXIS2_ERROR_GET_MESSAGE(env->error));
- isComplete = 1;
+
return AXIS2_SUCCESS;
}
Modified: webservices/axis2/trunk/c/src/core/clientapi/callback_recv.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/clientapi/callback_recv.c?rev=665772&r1=665771&r2=665772&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/callback_recv.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/callback_recv.c Mon Jun 9 10:00:27 2008
@@ -144,6 +144,12 @@
return AXIS2_SUCCESS;
}
+/* In the dual channel invocations client set a callback function to be invoked when a resonse
+ * is received from the server. When the response is received by the listening port of the
+ * listener manager, in the engine receive call the message is finally hit by callback receiver
+ * which is an implementation of the axis2 message receiver. This is the function that is called
+ * at that stage. The client set callback function is called from within here.
+ */
static axis2_status_t AXIS2_CALL
axis2_callback_recv_receive(
axis2_msg_recv_t * msg_recv,
@@ -190,3 +196,4 @@
return AXIS2_FAILURE;
}
+
Modified: webservices/axis2/trunk/c/src/core/clientapi/listener_manager.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/clientapi/listener_manager.c?rev=665772&r1=665771&r2=665772&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/listener_manager.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/listener_manager.c Mon Jun 9 10:00:27 2008
@@ -283,6 +283,9 @@
return NULL;
th_env = axutil_init_thread_env(args_list->env);
+ /* Start the protocol server. For examlle if protocol is http axis2_http_server_start function
+ * of the axis2_http_receiver is called.
+ */
if (args_list->listener)
{
axis2_transport_receiver_start(args_list->listener, th_env);
Modified: webservices/axis2/trunk/c/src/core/clientapi/op_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/clientapi/op_client.c?rev=665772&r1=665771&r2=665772&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/op_client.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/op_client.c Mon Jun 9 10:00:27 2008
@@ -335,6 +335,9 @@
return op_client->callback;
}
+/* This function is called from service client irrespective of the message exchange pattern
+ * and whether one/two way channel used.
+ */
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_op_client_execute(
axis2_op_client_t * op_client,
@@ -460,6 +463,7 @@
msg_id = NULL;
}
+ /* If dual channel. */
if (axis2_options_get_use_separate_listener(op_client->options, env))
{
axis2_engine_t *engine = NULL;
@@ -483,7 +487,7 @@
axis2_engine_send(engine, env, msg_ctx);
axis2_engine_free(engine, env);
}
- else
+ else /* Same channel will be used irrespective of message exchange pattern. */
{
if (block)
{
@@ -652,6 +656,8 @@
AXIS2_FREE(env->allocator, op_client);
}
+/* This function is the thread worker function for the single channel non blocking case. Here
+ * being non-blocking implies that message is two way. */
void *AXIS2_THREAD_FUNC
axis2_op_client_worker_func(
axutil_thread_t * thd,
@@ -684,6 +690,11 @@
/* send the request and wait for response */
response = axis2_op_client_two_way_send(th_env, args_list->msg_ctx);
+ /* We do not need to handle the NULL reponse here because this thread function is called only
+ * in the single channel non blocking case which, imply this is two way message by design.
+ */
+
+ /* Here after the code is a subset of what callback receiver do in dual channel case.*/
axis2_op_client_add_msg_ctx(args_list->op_client, th_env, response);
args_list->op_client->async_result = axis2_async_result_create(th_env,
response);
@@ -693,10 +704,11 @@
axis2_callback_invoke_on_complete(args_list->callback,
th_env,
args_list->op_client->async_result);
+
axis2_callback_set_complete(args_list->callback, th_env, AXIS2_TRUE);
}
- /* clean up memory */
+ /* Clean up memory */
axis2_async_result_free(args_list->op_client->async_result, th_env);
axis2_op_ctx_free(op_ctx, th_env);
@@ -1107,6 +1119,7 @@
return op_client->svc_ctx;
}
+/* This function is called only for single cannel invocations */
AXIS2_EXTERN axis2_msg_ctx_t *AXIS2_CALL
axis2_op_client_two_way_send(
const axutil_env_t * env,
@@ -1170,7 +1183,7 @@
return NULL;
}
- /* handle one way case */
+ /* handle one way non robust case */
if (!(axutil_strcmp(mep, AXIS2_MEP_URI_OUT_ONLY)))
{
return NULL;
@@ -1246,7 +1259,7 @@
if (response_envelope)
{
axis2_msg_ctx_set_soap_envelope(response, env, response_envelope);
- /* There could be a scenaria where the message has already passed
+ /* There could be a scenariao where the message has already passed
* through the incoming phases. eg. Reliable Messaging 1.0 two
* way single channel
*/
Modified: webservices/axis2/trunk/c/src/core/clientapi/svc_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/clientapi/svc_client.c?rev=665772&r1=665771&r2=665772&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/svc_client.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/svc_client.c Mon Jun 9 10:00:27 2008
@@ -721,6 +721,10 @@
qname_free_flag = AXIS2_TRUE;
}
+ /* If dual channel blocking. We come to this block if the client indicate to use
+ * a separate listener but don't provide a callback function to acted upon when
+ * response is recieved in the listener thread. What we do here is we create a callback
+ * and call axis2_svc_client_send_receive_non_blocking_with_op_qname with it. */
if (axis2_options_get_use_separate_listener(svc_client->options, env))
{
axis2_callback_t *callback = NULL;
@@ -738,7 +742,9 @@
return NULL;
}
- /* call two channel non blocking invoke to do the work and wait on the callback */
+ /* call two channel non blocking invoke to do the work and wait on the callback. Note
+ * that we don't set a callback function for the callback. Instead we plan to call
+ * engine_receive through op_client_receive() function periodically. */
axis2_svc_client_send_receive_non_blocking_with_op_qname(svc_client,
env, op_qname,
payload,
@@ -748,50 +754,11 @@
axis2_options_get_timeout_in_milli_seconds(svc_client->options,
env) / 10;
- while (!(axis2_callback_get_complete(callback, env)))
+ while(!axis2_callback_get_complete(callback, env))
{
- /*wait till the response arrives */
if (index-- >= 0)
{
AXIS2_USLEEP(10000);
- msg_ctx =
- (axis2_msg_ctx_t *) axis2_op_client_get_msg_ctx(svc_client->
- op_client,
- env,
- AXIS2_WSDL_MESSAGE_LABEL_OUT);
- if (msg_ctx)
- {
- axis2_msg_ctx_t *res_msg_ctx =
- axis2_op_client_receive(env, msg_ctx);
- if (res_msg_ctx)
- {
- soap_envelope =
- axis2_msg_ctx_get_soap_envelope(res_msg_ctx, env);
- svc_client->last_response_soap_envelope = soap_envelope;
- if (soap_envelope)
- {
- soap_body =
- axiom_soap_envelope_get_body(soap_envelope,
- env);
-
- if (soap_body)
- {
- svc_client->last_response_has_fault =
- axiom_soap_body_has_fault(soap_body, env);
- soap_node =
- axiom_soap_body_get_base_node(soap_body,
- env);
- if (soap_node)
- {
- return
- axiom_node_get_first_element(soap_node,
- env);
- }
- }
- }
- }
- }
-
}
else
{
@@ -1000,6 +967,7 @@
axis2_op_client_set_callback(svc_client->op_client, env, callback);
axis2_op_client_add_out_msg_ctx(svc_client->op_client, env, msg_ctx);
+ /* If dual channel */
if (axis2_options_get_use_separate_listener(svc_client->options, env))
{
axis2_op_t *op = NULL;
@@ -1014,6 +982,7 @@
AXIS2_USLEEP(1);
op = axis2_svc_get_op_with_qname(svc_client->svc, env, op_qname);
+ /* At the end of the incoming flow this message receiver will be hit */
axis2_op_set_msg_recv(op, env,
AXIS2_CALLBACK_RECV_GET_BASE(svc_client->
callback_recv, env));
Modified: webservices/axis2/trunk/c/src/core/phaseresolver/phase_resolver.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/phaseresolver/phase_resolver.c?rev=665772&r1=665771&r2=665772&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/phaseresolver/phase_resolver.c (original)
+++ webservices/axis2/trunk/c/src/core/phaseresolver/phase_resolver.c Mon Jun 9 10:00:27 2008
@@ -38,6 +38,23 @@
axis2_svc_t *svc;
};
+/*
+ * Engages the given global module to the given service. This means
+ * the given module would be engaged to all operations of the given
+ * service.
+ * @param phase_resolver pointer to phase resolver
+ * @param env pointer to environment struct
+ * @param svc pointer to service
+ * @param module_desc pointer to module description
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
+static axis2_status_t
+axis2_phase_resolver_engage_module_to_svc_from_global(
+ axis2_phase_resolver_t * phase_resolver,
+ const axutil_env_t * env,
+ struct axis2_svc *svc,
+ struct axis2_module_desc *module_desc);
+
static axis2_status_t axis2_phase_resolver_build_execution_chains(
axis2_phase_resolver_t * phase_resolver,
const axutil_env_t * env,
@@ -1059,7 +1076,7 @@
* axis2_phase_resolver_engage_module_globally() to add handlers from module
* into each services all operations.
*/
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
+static axis2_status_t
axis2_phase_resolver_engage_module_to_svc_from_global(
axis2_phase_resolver_t * phase_resolver,
const axutil_env_t * env,
@@ -1076,6 +1093,7 @@
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
"Entry:axis2_phase_resolver_engage_module_to_svc_from_global");
+
AXIS2_PARAM_CHECK(env->error, svc, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, module_desc, AXIS2_FAILURE);
svc_name = axis2_svc_get_name(svc, env);
@@ -1279,8 +1297,10 @@
return status;
}
}
+
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
"Exit:axis2_phase_resolver_engage_module_to_svc_from_global");
+
return AXIS2_SUCCESS;
}
Modified: webservices/axis2/trunk/c/src/modules/mod_addr/addr_out_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/modules/mod_addr/addr_out_handler.c?rev=665772&r1=665771&r2=665772&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/modules/mod_addr/addr_out_handler.c (original)
+++ webservices/axis2/trunk/c/src/modules/mod_addr/addr_out_handler.c Mon Jun 9 10:00:27 2008
@@ -478,9 +478,10 @@
AXIS2_WSA_MESSAGE_ID,
&soap_header, addr_ns);
}
-
+
relates_to =
axis2_msg_info_headers_get_relates_to(msg_info_headers, env);
+
if (relates_to)
{
const axis2_char_t *value = NULL;