Author: samisa
Date: Wed May 3 08:53:52 2006
New Revision: 399340
URL: http://svn.apache.org/viewcvs?rev=399340&view=rev
Log:
Fixes to get the service client bloking API working
Modified:
webservices/axis2/trunk/c/include/axis2_op_client.h
webservices/axis2/trunk/c/include/axis2_svc_client.h
webservices/axis2/trunk/c/modules/core/clientapi/op_client.c
webservices/axis2/trunk/c/modules/core/clientapi/options.c
webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c
webservices/axis2/trunk/c/modules/core/description/svc.c
webservices/axis2/trunk/c/modules/xml/om/om_node.c
webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking.c
Modified: webservices/axis2/trunk/c/include/axis2_op_client.h
URL:
http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_op_client.h?rev=399340&r1=399339&r2=399340&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_op_client.h (original)
+++ webservices/axis2/trunk/c/include/axis2_op_client.h Wed May 3 08:53:52 2006
@@ -191,34 +191,34 @@
/************************** Start of function macros
**************************/
-#define AXIS2_OPERATION_CLIENT_SET_OPTIONS(op_client, env, options) \
+#define AXIS2_OP_CLIENT_SET_OPTIONS(op_client, env, options) \
((op_client)->ops->set_options(op_client, env, options))
-#define AXIS2_OPERATION_CLIENT_GET_OPTIONS(op_client, env) \
+#define AXIS2_OP_CLIENT_GET_OPTIONS(op_client, env) \
((op_client)->ops->get_options(op_client, env))
-#define AXIS2_OPERATION_CLIENT_ADD_MSG_CTX(op_client, env, mc) \
+#define AXIS2_OP_CLIENT_ADD_MSG_CTX(op_client, env, mc) \
((op_client)->ops->add_msg_ctx(op_client, env, mc))
-#define AXIS2_OPERATION_CLIENT_GET_MSG_CTX(op_client, env, message_label) \
+#define AXIS2_OP_CLIENT_GET_MSG_CTX(op_client, env, message_label) \
((op_client)->ops->get_msg_ctx(op_client, env, message_label))
-#define AXIS2_OPERATION_CLIENT_SET_CALLBACK(op_client, env, callback) \
+#define AXIS2_OP_CLIENT_SET_CALLBACK(op_client, env, callback) \
((op_client)->ops->set_callback(op_client, env, callback))
-#define AXIS2_OPERATION_CLIENT_EXECUTE(op_client, env, block) \
+#define AXIS2_OP_CLIENT_EXECUTE(op_client, env, block) \
((op_client)->ops->execute(op_client, env, block))
-#define AXIS2_OPERATION_CLIENT_RESET(op_client, env) \
+#define AXIS2_OP_CLIENT_RESET(op_client, env) \
((op_client)->ops->reset(op_client, env))
-#define AXIS2_OPERATION_CLIENT_COMPLETE(op_client, env, mc) \
+#define AXIS2_OP_CLIENT_COMPLETE(op_client, env, mc) \
((op_client)->ops->compelete(op_client, env, mc))
-#define AXIS2_OPERATION_CLIENT_GET_OPERATION_CONTEXT(op_client, env) \
+#define AXIS2_OP_CLIENT_GET_OPERATION_CONTEXT(op_client, env) \
((op_client)->ops->get_operation_context(op_client, env))
-#define AXIS2_OPERATION_CLIENT_FREE(op_client, env) \
+#define AXIS2_OP_CLIENT_FREE(op_client, env) \
((op_client)->ops->free(op_client, env))
/************************** End of function macros
****************************/
Modified: webservices/axis2/trunk/c/include/axis2_svc_client.h
URL:
http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_svc_client.h?rev=399340&r1=399339&r2=399340&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_svc_client.h (original)
+++ webservices/axis2/trunk/c/include/axis2_svc_client.h Wed May 3 08:53:52
2006
@@ -301,80 +301,80 @@
/************************** Start of function macros
**************************/
-#define AXIS2_SERVICE_CLIENT_GET_AXIS_SERVICE(svc_client) \
+#define AXIS2_SVC_CLIENT_GET_AXIS_SERVICE(svc_client) \
((svc_client)->ops->get_axis_service(svc_client))
-#define AXIS2_SERVICE_CLIENT_SET_OPTIONS(svc_client, env, options) \
+#define AXIS2_SVC_CLIENT_SET_OPTIONS(svc_client, env, options) \
((svc_client)->ops->set_options(svc_client, env, options))
-#define AXIS2_SERVICE_CLIENT_GET_OPTIONS(svc_client) \
+#define AXIS2_SVC_CLIENT_GET_OPTIONS(svc_client) \
((svc_client)->ops->get_options(svc_client))
-#define AXIS2_SERVICE_CLIENT_SET_OVERRIDE_OPTIONS(svc_client, env,
override_options) \
+#define AXIS2_SVC_CLIENT_SET_OVERRIDE_OPTIONS(svc_client, env,
override_options) \
((svc_client)->ops->set_override_options(svc_client, env,
override_options))
-#define AXIS2_SERVICE_CLIENT_GET_OVERRIDE_OPTIONS(svc_client) \
+#define AXIS2_SVC_CLIENT_GET_OVERRIDE_OPTIONS(svc_client) \
((svc_client)->ops->get_override_options(svc_client))
-#define AXIS2_SERVICE_CLIENT_ENGAGE_MODULE(svc_client, env, module_name) \
+#define AXIS2_SVC_CLIENT_ENGAGE_MODULE(svc_client, env, module_name) \
((svc_client)->ops->engage_module(svc_client, env, module_name))
-#define AXIS2_SERVICE_CLIENT_DISENGAGE_MODULE(svc_client, env, module_name) \
+#define AXIS2_SVC_CLIENT_DISENGAGE_MODULE(svc_client, env, module_name) \
((svc_client)->ops->disengage_module(svc_client, env,
module_name))
-#define AXIS2_SERVICE_CLIENT_ADD_HEADER(svc_client, env, header) \
+#define AXIS2_SVC_CLIENT_ADD_HEADER(svc_client, env, header) \
((svc_client)->ops->add_header(svc_client, env, header))
-#define AXIS2_SERVICE_CLIENT_REMOVE_HEADERS(svc_client, env) \
+#define AXIS2_SVC_CLIENT_REMOVE_HEADERS(svc_client, env) \
((svc_client)->ops->remove_headers(svc_client, env))
-#define AXIS2_SERVICE_CLIENT_ADD_HEADER_WITH_TEXT(svc_client, env,
header_name, header_text) \
+#define AXIS2_SVC_CLIENT_ADD_HEADER_WITH_TEXT(svc_client, env, header_name,
header_text) \
((svc_client)->ops->add_header_with_text(svc_client, env,
header_name, header_text))
-#define AXIS2_SERVICE_CLIENT_SEND_ROBUST(svc_client, env, payload) \
+#define AXIS2_SVC_CLIENT_SEND_ROBUST(svc_client, env, payload) \
((svc_client)->ops->send_robust(svc_client, env, payload))
-#define AXIS2_SERVICE_CLIENT_SEND_ROBUST_WITH_OPERATION(svc_client, env,
operation, payload) \
+#define AXIS2_SVC_CLIENT_SEND_ROBUST_WITH_OPERATION(svc_client, env,
operation, payload) \
((svc_client)->ops->send_robust_with_operation(svc_client, env,
operation, payload))
-#define AXIS2_SERVICE_CLIENT_FIRE_AND_FORGET(svc_client, env, payload) \
+#define AXIS2_SVC_CLIENT_FIRE_AND_FORGET(svc_client, env, payload) \
((svc_client)->ops->fire_and_forget(svc_client, env, payload))
-#define AXIS2_SERVICE_CLIENT_FIRE_AND_FORGET_WITH_OPERATION(svc_client, env,
operation, payload) \
+#define AXIS2_SVC_CLIENT_FIRE_AND_FORGET_WITH_OPERATION(svc_client, env,
operation, payload) \
((svc_client)->ops->fire_and_forget_with_operation(svc_client,
env, operation, payload))
-#define AXIS2_SERVICE_CLIENT_SEND_RECEIVE(svc_client, env, payload) \
+#define AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload) \
((svc_client)->ops->send_receive(svc_client, env, payload))
-#define AXIS2_SERVICE_CLIENT_SEND_RECEIVE_WITH_OPERATION(svc_client, env,
operation, payload) \
+#define AXIS2_SVC_CLIENT_SEND_RECEIVE_WITH_OPERATION(svc_client, env,
operation, payload) \
((svc_client)->ops->send_receive_with_operation(svc_client,
env, operation, payload))
-#define AXIS2_SERVICE_CLIENT_SEND_RECEIVE_NON_BLOCKING(svc_client, env,
payload, callback) \
+#define AXIS2_SVC_CLIENT_SEND_RECEIVE_NON_BLOCKING(svc_client, env, payload,
callback) \
((svc_client)->ops->send_receive_non_blocking(svc_client, env,
payload, callback))
-#define
AXIS2_SERVICE_CLIENT_SEND_RECEIVE_NON_BLOCKING_WITH_OPERATION(svc_client, env,
operation, payload, callback) \
+#define AXIS2_SVC_CLIENT_SEND_RECEIVE_NON_BLOCKING_WITH_OPERATION(svc_client,
env, operation, payload, callback) \
((svc_client)->ops->send_receive_non_blocking_with_operation(svc_client, env,
operation, payload, callback))
-#define AXIS2_SERVICE_CLIENT_CREATE_CLIENT(svc_client, env, operation) \
+#define AXIS2_SVC_CLIENT_CREATE_CLIENT(svc_client, env, operation) \
((svc_client)->ops->create_client(svc_client, env, operation))
-#define AXIS2_SERVICE_CLIENT_FINALIZE_INVOKE(svc_client, env) \
+#define AXIS2_SVC_CLIENT_FINALIZE_INVOKE(svc_client, env) \
((svc_client)->ops->finalize_invoke(svc_client, env))
-#define AXIS2_SERVICE_CLIENT_GET_MY_EPR(svc_client, env, transport) \
+#define AXIS2_SVC_CLIENT_GET_MY_EPR(svc_client, env, transport) \
((svc_client)->ops->get_my_epr(svc_client, env, transport))
-#define AXIS2_SERVICE_CLIENT_GET_TARGET_EPR(svc_client, env) \
+#define AXIS2_SVC_CLIENT_GET_TARGET_EPR(svc_client, env) \
((svc_client)->ops->get_target_epr(svc_client, env))
-#define AXIS2_SERVICE_CLIENT_SET_TARGET_EPR(svc_client, env, target_epr) \
+#define AXIS2_SVC_CLIENT_SET_TARGET_EPR(svc_client, env, target_epr) \
((svc_client)->ops->set_target_epr(svc_client, env, target_epr))
-#define AXIS2_SERVICE_CLIENT_GET_SERVICE_CONTEXT(svc_client, env) \
+#define AXIS2_SVC_CLIENT_GET_SERVICE_CONTEXT(svc_client, env) \
((svc_client)->ops->get_svc_ctx(svc_client, env))
-#define AXIS2_SERVICE_FREE(svc_client, env) \
+#define AXIS2_SVC_CLIENT_FREE(svc_client, env) \
((svc_client)->ops->free(svc_client, env))
/************************** End of function macros
****************************/
Modified: webservices/axis2/trunk/c/modules/core/clientapi/op_client.c
URL:
http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/clientapi/op_client.c?rev=399340&r1=399339&r2=399340&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/op_client.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/op_client.c Wed May 3
08:53:52 2006
@@ -44,7 +44,6 @@
#define AXIS2_INTF_TO_IMPL(op_client) ((axis2_op_client_impl_t *)op_client)
/** private function prototypes */
-static void axis2_op_client_init_data(axis2_op_client_impl_t *op_client_impl);
static void axis2_op_client_init_ops(axis2_op_client_t *op_client);
static axis2_msg_ctx_t* axis2_op_client_invoke_blocking(axis2_op_client_impl_t
*op_client_impl,
axis2_env_t **env,
@@ -97,7 +96,7 @@
axis2_env_t **env);
axis2_op_client_t* AXIS2_CALL
-axis2_op_client_create(axis2_env_t **env, axis2_op_t *operation,
+axis2_op_client_create(axis2_env_t **env, axis2_op_t *op,
axis2_svc_ctx_t *svc_ctx,
axis2_options_t *options)
{
@@ -105,6 +104,9 @@
axis2_char_t *mep_uri = NULL;
AXIS2_ENV_CHECK(env, NULL);
+ AXIS2_PARAM_CHECK((*env)->error, op, NULL);
+ AXIS2_PARAM_CHECK((*env)->error, svc_ctx, NULL);
+ AXIS2_PARAM_CHECK((*env)->error, options, NULL);
op_client_impl = AXIS2_MALLOC( (*env)->allocator,
sizeof(axis2_op_client_impl_t) );
if (!op_client_impl)
@@ -114,11 +116,25 @@
}
/** initialize data */
- axis2_op_client_init_data(op_client_impl);
+ op_client_impl->base = NULL;
+ op_client_impl->svc_ctx = NULL;
+ op_client_impl->options = NULL;
+ op_client_impl->op_ctx = NULL;
+ op_client_impl->callback = NULL;
+ op_client_impl->completed = AXIS2_FALSE;
+
op_client_impl->options = options;
op_client_impl->svc_ctx = svc_ctx;
-
- mep_uri = AXIS2_OP_GET_MSG_EXCHANGE_PATTERN(operation, env);
+
+ op_client_impl->op_ctx = axis2_op_ctx_create(env, op,
+ op_client_impl->svc_ctx);
+ if (!(op_client_impl->op_ctx))
+ {
+ axis2_op_client_free(&(op_client_impl->op_client), env);
+ return NULL;
+ }
+
+ mep_uri = AXIS2_OP_GET_MSG_EXCHANGE_PATTERN(op, env);
if (!mep_uri)
{
@@ -360,15 +376,12 @@
return AXIS2_FAILURE;
msg_id = (axis2_char_t*)axis2_uuid_gen(env);
- if(NULL != msg_id)
+ AXIS2_MSG_CTX_SET_MESSAGE_ID(msg_ctx, env, msg_id);
+ if(NULL != msg_id)
{
AXIS2_FREE((*env)->allocator, msg_id);
msg_id = NULL;
- }
-
- AXIS2_MSG_CTX_SET_MESSAGE_ID(msg_ctx, env, msg_id);
-
-
+ }
if (AXIS2_OPTIONS_IS_USE_SEPERATE_LISTENER(op_client_impl->options,
env))
{
@@ -391,14 +404,16 @@
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);
+ AXIS2_TRANSPORT_URL, property, AXIS2_FALSE);
/*AXIS2_MSG_CTX_SET_TO(msg_ctx, env, call_impl->to);*/
AXIS2_MSG_CTX_SET_SVC_CTX(msg_ctx, env,
op_client_impl->svc_ctx);
- AXIS2_MSG_CTX_SET_CONF_CTX(msg_ctx, env,
AXIS2_SVC_CTX_GET_CONF_CTX(op_client_impl->svc_ctx, env));
+ AXIS2_MSG_CTX_SET_CONF_CTX(msg_ctx, env,
+ AXIS2_SVC_CTX_GET_CONF_CTX(op_client_impl->svc_ctx, env));
+ AXIS2_MSG_CTX_SET_OP_CTX(msg_ctx, env, op_client_impl->op_ctx);
/*TODO: check this if it is necessary*/
- op_ctx = axis2_op_ctx_create(env, op, op_client_impl->svc_ctx);
- AXIS2_OP_REGISTER_OP_CTX(op, env, msg_ctx, op_ctx);
+ /*op_ctx = axis2_op_ctx_create(env, op,
op_client_impl->svc_ctx);
+ AXIS2_OP_REGISTER_OP_CTX(op, env, msg_ctx, op_ctx);*/
/*Send the SOAP Message and receive a response */
response_mc = axis2_mep_client_two_way_send(env, msg_ctx);
@@ -490,15 +505,6 @@
return AXIS2_SUCCESS;
}
/** private functions - implementation */
-
-static void axis2_op_client_init_data(axis2_op_client_impl_t *op_client_impl)
-{
- op_client_impl->svc_ctx = NULL;
- op_client_impl->options = NULL;
- op_client_impl->op_ctx = NULL;
- op_client_impl->callback = NULL;
- op_client_impl->completed = AXIS2_FALSE;
-}
static void axis2_op_client_init_ops(axis2_op_client_t *op_client)
{
Modified: webservices/axis2/trunk/c/modules/core/clientapi/options.c
URL:
http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/clientapi/options.c?rev=399340&r1=399339&r2=399340&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/options.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/options.c Wed May 3
08:53:52 2006
@@ -1118,5 +1118,6 @@
options->ops->add_reference_parameter =
axis2_options_add_reference_parameter;
options->ops->set_manage_session = axis2_options_set_manage_session;
options->ops->is_manage_session = axis2_options_is_manage_session;
+ options->ops->get_msg_info_headers = axis2_options_get_msg_info_headers;
options->ops->free = axis2_options_free;
}
Modified: webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c
URL:
http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c?rev=399340&r1=399339&r2=399340&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c Wed May 3
08:53:52 2006
@@ -54,7 +54,7 @@
#define AXIS2_INTF_TO_IMPL(svc_client) ((axis2_svc_client_impl_t *)svc_client)
/** private functions */
-static axis2_bool_t axis2_svc_client_initialize_transport(axis2_env_t **env,
+static axis2_bool_t axis2_svc_client_init_transports_from_conf_ctx(axis2_env_t
**env,
axis2_svc_client_impl_t *svc_client_impl,
axis2_conf_ctx_t *conf_ctx,
axis2_char_t *client_home);
@@ -62,7 +62,7 @@
axis2_svc_client_impl_t *svc_client_impl);
static void axis2_svc_client_init_ops(axis2_svc_client_t *svc_client);
static axis2_svc_t* axis2_svc_client_create_annonymous_svc(axis2_env_t **env);
-static axis2_bool_t fill_soap_envelope(axis2_env_t **env,
axis2_svc_client_impl_t *svc_client_impl,
+static axis2_bool_t axis2_svc_client_fill_soap_envelope(axis2_env_t **env,
axis2_svc_client_impl_t *svc_client_impl,
axis2_msg_ctx_t *msg_ctx, axis2_om_node_t
*payload);
/** public funcitons */
@@ -141,7 +141,7 @@
axis2_om_node_t* AXIS2_CALL
-axis2_svc_client_send_receive_with_operation(struct axis2_svc_client
*svc_client,
+axis2_svc_client_send_receive_with_op_qname(struct axis2_svc_client
*svc_client,
axis2_env_t **env,
axis2_qname_t *operation,
axis2_om_node_t *payload);
@@ -161,7 +161,7 @@
axis2_callback_t *callback);
axis2_op_client_t* AXIS2_CALL
-axis2_svc_client_create_client(struct axis2_svc_client *svc_client,
+axis2_svc_client_create_op_client(struct axis2_svc_client *svc_client,
axis2_env_t **env,
axis2_qname_t *operation);
@@ -243,7 +243,8 @@
return NULL;
}
- if (!axis2_svc_client_initialize_transport(env, svc_client_impl,
conf_ctx, client_home))
+ /* the following method call will create the deafult conf_ctx if it is
NULL */
+ if (!axis2_svc_client_init_transports_from_conf_ctx(env,
svc_client_impl, conf_ctx, client_home))
{
axis2_svc_client_free(&(svc_client_impl->svc_client), env);
return NULL;
@@ -555,15 +556,15 @@
svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
op = axis2_qname_create(env, AXIS2_ANON_OUT_IN_OP, NULL, NULL);
- return axis2_svc_client_send_receive_with_operation(
+ return axis2_svc_client_send_receive_with_op_qname(
&(svc_client_impl->svc_client), env, op, payload);
}
axis2_om_node_t* AXIS2_CALL
-axis2_svc_client_send_receive_with_operation(struct axis2_svc_client
*svc_client,
+axis2_svc_client_send_receive_with_op_qname(struct axis2_svc_client
*svc_client,
axis2_env_t **env,
- axis2_qname_t *operation,
+ axis2_qname_t *op_qname,
axis2_om_node_t *payload)
{
axis2_svc_client_impl_t *svc_client_impl = NULL;
@@ -578,7 +579,7 @@
}
else
{
- axis2_op_client_t *mep_client = NULL;
+ axis2_op_client_t *op_client = NULL;
axis2_msg_ctx_t *res_msg_ctx = NULL;
axis2_msg_ctx_t *mc = NULL;
axis2_soap_envelope_t *soap_envelope = NULL;
@@ -587,14 +588,14 @@
mc = axis2_msg_ctx_create(env,
AXIS2_SVC_CTX_GET_CONF_CTX(svc_client_impl->svc_ctx, env), NULL, NULL);
- if (!fill_soap_envelope(env, svc_client_impl, mc, payload))
+ if (!axis2_svc_client_fill_soap_envelope(env, svc_client_impl,
mc, payload))
return NULL;
- mep_client =
axis2_svc_client_create_client(&(svc_client_impl->svc_client), env, operation);
+ op_client =
axis2_svc_client_create_op_client(&(svc_client_impl->svc_client), env,
op_qname);
- AXIS2_OPERATION_CLIENT_ADD_MSG_CTX(mep_client, env, mc);
- AXIS2_OPERATION_CLIENT_EXECUTE(mep_client, env, AXIS2_TRUE);
- res_msg_ctx = AXIS2_OP_CTX_GET_MSG_CTX(mep_client, env,
AXIS2_WSDL_MESSAGE_LABEL_IN_VALUE);
+ AXIS2_OP_CLIENT_ADD_MSG_CTX(op_client, env, mc);
+ AXIS2_OP_CLIENT_EXECUTE(op_client, env, AXIS2_TRUE);
+ res_msg_ctx = AXIS2_OP_CTX_GET_MSG_CTX(op_client, env,
AXIS2_WSDL_MESSAGE_LABEL_IN_VALUE);
if (!res_msg_ctx)
{
@@ -635,7 +636,7 @@
void AXIS2_CALL
axis2_svc_client_send_receive_non_blocking_with_operation(struct
axis2_svc_client *svc_client,
axis2_env_t **env,
- axis2_qname_t *operation,
+ axis2_qname_t *op_qname,
axis2_om_node_t *payload,
axis2_callback_t *callback)
{
@@ -643,9 +644,9 @@
}
axis2_op_client_t* AXIS2_CALL
-axis2_svc_client_create_client(struct axis2_svc_client *svc_client,
+axis2_svc_client_create_op_client(struct axis2_svc_client *svc_client,
axis2_env_t **env,
- axis2_qname_t *operation)
+ axis2_qname_t *op_qname)
{
axis2_op_t *op = NULL;
axis2_op_client_t *op_client = NULL;
@@ -655,7 +656,7 @@
svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
- op = AXIS2_SVC_GET_OP_WITH_QNAME(svc_client_impl->svc, env, operation);
+ op = AXIS2_SVC_GET_OP_WITH_QNAME(svc_client_impl->svc, env, op_qname);
if (!op)
{
/*TODO:error - svc does not have the operation*/
@@ -668,11 +669,11 @@
those options override the options of even the operation client. So,
what we do is switch the parents around to make that work.
*/
- if (!svc_client_impl->override_options)
+ if (svc_client_impl->override_options)
{
AXIS2_OPTIONS_SET_PARENT(svc_client_impl->override_options,
env,
- AXIS2_OPERATION_CLIENT_GET_OPTIONS(op_client, env));
- AXIS2_OPERATION_CLIENT_SET_OPTIONS(op_client, env,
svc_client_impl->override_options);
+ AXIS2_OP_CLIENT_GET_OPTIONS(op_client, env));
+ AXIS2_OP_CLIENT_SET_OPTIONS(op_client, env,
svc_client_impl->override_options);
}
return op_client;
@@ -766,7 +767,7 @@
/** private function implementation */
-static axis2_bool_t axis2_svc_client_initialize_transport(axis2_env_t **env,
+static axis2_bool_t axis2_svc_client_init_transports_from_conf_ctx(axis2_env_t
**env,
axis2_svc_client_impl_t *svc_client_impl,
axis2_conf_ctx_t *conf_ctx,
axis2_char_t *client_home)
@@ -862,10 +863,10 @@
svc_client->ops->fire_and_forget = axis2_svc_client_fire_and_forget;
svc_client->ops->fire_and_forget_with_operation =
axis2_svc_client_fire_and_forget_with_operation;
svc_client->ops->send_receive = axis2_svc_client_send_receive;
- svc_client->ops->send_receive_with_operation =
axis2_svc_client_send_receive_with_operation;
+ svc_client->ops->send_receive_with_operation =
axis2_svc_client_send_receive_with_op_qname;
svc_client->ops->send_receive_non_blocking =
axis2_svc_client_send_receive_non_blocking;
svc_client->ops->send_receive_non_blocking_with_operation =
axis2_svc_client_send_receive_non_blocking_with_operation;
- svc_client->ops->create_client = axis2_svc_client_create_client;
+ svc_client->ops->create_client = axis2_svc_client_create_op_client;
svc_client->ops->finalize_invoke = axis2_svc_client_finalize_invoke;
svc_client->ops->get_my_epr = axis2_svc_client_get_my_epr;
svc_client->ops->get_target_epr = axis2_svc_client_get_target_epr;
@@ -986,7 +987,7 @@
return AXIS2_SUCCESS;
}
-static axis2_bool_t fill_soap_envelope(axis2_env_t **env,
axis2_svc_client_impl_t *svc_client_impl,
+static axis2_bool_t axis2_svc_client_fill_soap_envelope(axis2_env_t **env,
axis2_svc_client_impl_t *svc_client_impl,
axis2_msg_ctx_t
*msg_ctx, axis2_om_node_t *payload)
{
axis2_char_t *soap_version_uri;
@@ -995,7 +996,7 @@
soap_version_uri =
AXIS2_OPTIONS_GET_SOAP_VERSION_URI(svc_client_impl->options, env);
- if (soap_version_uri)
+ if (!soap_version_uri)
{
return AXIS2_FALSE;
}
Modified: webservices/axis2/trunk/c/modules/core/description/svc.c
URL:
http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/svc.c?rev=399340&r1=399339&r2=399340&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/svc.c (original)
+++ webservices/axis2/trunk/c/modules/core/description/svc.c Wed May 3
08:53:52 2006
@@ -618,19 +618,34 @@
axis2_svc_impl_t *svc_impl = NULL;
axis2_op_t *op_l = NULL;
axis2_char_t *op_str = NULL;
+ axis2_char_t *op_qname_str = NULL;
/*axis2_hash_t *all_ops = NULL; */
AXIS2_ENV_CHECK(env, NULL);
AXIS2_PARAM_CHECK((*env)->error, op_name, NULL);
svc_impl = AXIS2_INTF_TO_IMPL(svc);
- op_str = AXIS2_QNAME_GET_LOCALPART(op_name, env);
+ op_qname_str = AXIS2_QNAME_TO_STRING(op_name, env);
+ if (op_qname_str)
+ {
+ axis2_wsdl_interface_t *wsdl_interface = NULL;
+
+ wsdl_interface = axis2_svc_get_svc_interface(svc, env);
+ op_l = (axis2_op_t *)AXIS2_WSDL_INTERFACE_GET_OP(wsdl_interface, env,
+ op_qname_str);
+ if (op_l)
+ {
+ return op_l;
+ }
+ }
+
/*TODO commented until AXIS2_WSDL_INTERFACE_GET_ALL_OPS is implemented
all_ops = AXIS2_WSDL_INTERFACE_GET_ALL_OPS(
axis2_svc_get_svc_interface(svc, env), env);
op_l = (axis2_op_t) (axis2_hash_get (all_ops,
op_str, AXIS2_HASH_KEY_STRING));
*/
+ op_str = AXIS2_QNAME_GET_LOCALPART(op_name, env);
if(NULL == op_l )
{
op_l = (axis2_op_t *) (axis2_hash_get (
Modified: webservices/axis2/trunk/c/modules/xml/om/om_node.c
URL:
http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/om_node.c?rev=399340&r1=399339&r2=399340&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/om_node.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/om_node.c Wed May 3 08:53:52 2006
@@ -541,7 +541,7 @@
}
- temp_node = node_impl->first_child;
+ temp_node = axis2_om_node_get_first_child(om_node, env);
/* serialize children of this node */
while(NULL != temp_node)
{
Modified: webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking.c
URL:
http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking.c?rev=399340&r1=399339&r2=399340&view=diff
==============================================================================
--- webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking.c
(original)
+++ webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking.c Wed
May 3 08:53:52 2006
@@ -21,7 +21,10 @@
#include <axis2_client.h>
axis2_om_node_t *
-build_om_programatically(axis2_env_t **env);
+build_om_payload(axis2_env_t **env);
+
+void
+print_om(axis2_env_t **env, axis2_om_node_t *node);
int main(int argc, char** argv)
{
@@ -31,23 +34,10 @@
axis2_options_t *options = NULL;
axis2_char_t *client_home = NULL;
axis2_svc_client_t* svc_client = NULL;
-
- axis2_om_node_t *node = NULL;
- axis2_status_t status = AXIS2_FAILURE;
-
- axis2_char_t *wsa_action = NULL;
+ axis2_om_node_t *payload = NULL;
axis2_om_node_t *ret_node = NULL;
- axis2_svc_t *svc = NULL;
- axis2_op_t *op = NULL;
- axis2_call_t *call = NULL;
- axis2_msg_ctx_t *msg_ctx = NULL;
- axis2_mep_client_t *mep_client = NULL;
- axis2_msg_info_headers_t *msg_info_headers = NULL;
-
- axis2_conf_t *conf = NULL;
- axis2_msg_ctx_t *response_ctx = NULL;
-
- /* set up the envioronment */
+
+ /* Set up the envioronment */
env = axis2_env_create_all("echo_blocking.log", AXIS2_LOG_LEVEL_TRACE);
/* Set end point reference of echo service */
@@ -62,7 +52,7 @@
}
printf ("Using endpoint : %s\n", address);
- /* create EPR with given address */
+ /* Create EPR with given address */
endpoint_ref = axis2_endpoint_ref_create(&env, address);
/* Setup options */
@@ -80,9 +70,8 @@
if (!client_home)
client_home = "../../deploy";
+ /* Create service client */
svc_client = axis2_svc_client_create(&env, client_home);
- AXIS2_SERVICE_CLIENT_SET_OPTIONS(svc_client, &env, options);
-
if (!svc_client)
{
printf("Error creating service client\n");
@@ -90,139 +79,46 @@
" %d :: %s",
env->error->error_number,
AXIS2_ERROR_GET_MESSAGE(env->error));
}
-
-
- /* build the SOAP request message content using OM API.*/
- node = build_om_programatically(&env);
-
- /* create call struct */
- call = axis2_call_create(&env, NULL, client_home);
- mep_client = AXIS2_CALL_GET_BASE(call, &env);
-
- /* Prepare the SOAP envelope, using the SOAP message content to be sent.
- * Get a reference to the message context */
- msg_ctx = AXIS2_MEP_CLIENT_PREPARE_SOAP_ENVELOPE(mep_client, &env, node);
- if (!msg_ctx)
- {
- printf("ERROR: Could not prepare message context. ");
- printf("May be you havent set the repository corretly.\n");
- return -1;
- }
-
- /* Get the reference to message info headers structure from the message
context.
- This can be used to manipulate SOAP header content when using
WS-Addressing. */
- msg_info_headers = AXIS2_MSG_CTX_GET_MSG_INFO_HEADERS(msg_ctx, &env);
+ /* Set service client options */
+ AXIS2_SVC_CLIENT_SET_OPTIONS(svc_client, &env, options);
- /* Set header parameters, required for WS-Addressing.
- * Required only if you need to make use of WS-Addressing.
- */
- /* AXIS2_MSG_INFO_HEADERS_SET_TO(msg_info_headers, &env, endpoint_ref); */
- AXIS2_MSG_INFO_HEADERS_SET_ACTION(msg_info_headers, &env, wsa_action);
+ /* Build the SOAP request message payload using OM API.*/
+ payload = build_om_payload(&env);
+
+ /* Send request */
+ ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, &env, payload);
- AXIS2_CALL_SET_TO(call, &env, endpoint_ref);
-
- /* Get the configuration context */
- conf = AXIS2_CONF_CTX_GET_CONF(
- AXIS2_SVC_CTX_GET_CONF_CTX(
- AXIS2_MEP_CLIENT_GET_SVC_CTX(mep_client,
&env),
- &env),
- &env);
-
- /* Get the echo service context if it is already loaded to service
context*/
- svc = AXIS2_CONF_GET_SVC(conf, &env, "echo");
- if (svc)
- {
- op = AXIS2_SVC_GET_OP_WITH_NAME(svc, &env, "echoString");
- if (op)
- {
- AXIS2_OP_SET_MSG_EXCHANGE_PATTERN(op, &env, AXIS2_MEP_URI_OUT_IN);
- }
- }
- else
- {
- /* echo service is not in the configuration context. We need to create
the
- * operation and add it to service context. Then add service context
into
- * configuration context.
- */
- axis2_qname_t *op_qname = NULL;
- axis2_qname_t *svc_qname = axis2_qname_create(&env, "echo", NULL,
NULL);
- svc = axis2_svc_create_with_qname(&env, svc_qname);
- op_qname = axis2_qname_create(&env, "echoString", NULL, NULL);
- op = axis2_op_create_with_qname(&env, op_qname);
- AXIS2_OP_SET_MSG_EXCHANGE_PATTERN(op, &env, AXIS2_MEP_URI_OUT_IN);
- AXIS2_SVC_ADD_OP(svc, &env, op);
- AXIS2_CONF_ADD_SVC(conf, &env, svc);
- }
-
- if (!op)
- {
- printf("ERROR: operation not present in service\n");
- return -1;
- }
-
- /* Invoke the operation. Client blocks until the response message comes.
- * Response message gets set in the response message context.
- */
- response_ctx = AXIS2_CALL_INVOKE_BLOCKING(call, &env, op, msg_ctx);
-
- if (response_ctx)
- {
- /* Get the response SOAP message from response message context */
- axis2_soap_envelope_t *soap_envelope =
AXIS2_MSG_CTX_GET_SOAP_ENVELOPE(response_ctx, &env);
- ret_node = AXIS2_SOAP_ENVELOPE_GET_BASE_NODE(soap_envelope, &env);
- }
-
if(ret_node)
{
- /* Get the response value from the SOAP message */
- axis2_xml_writer_t *writer = NULL;
- axis2_om_output_t *om_output = NULL;
- axis2_char_t *buffer = NULL;
-
- printf("\necho stub invoke SUCCESSFUL!\n");
- writer = axis2_xml_writer_create_for_memory(&env, NULL, AXIS2_TRUE, 0);
- om_output = axis2_om_output_create (&env, writer);
-
- AXIS2_OM_NODE_SERIALIZE (ret_node, &env, om_output);
- buffer = AXIS2_XML_WRITER_GET_XML(writer, &env);
- printf ("\nReceived OM node in XML : %s\n", buffer);
- AXIS2_FREE(env->allocator, buffer);
- AXIS2_OM_OUTPUT_FREE(om_output, &env);
+ printf("\nReceived OM : ");
+ print_om(&env, ret_node);
+ printf("\necho client invoke SUCCESSFUL!\n");
}
else
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED:
Error code:"
" %d :: %s",
env->error->error_number,
AXIS2_ERROR_GET_MESSAGE(env->error));
- printf("echo stub invoke FAILED!\n");
+ printf("echo client invoke FAILED!\n");
}
- if (msg_ctx)
- {
- AXIS2_MSG_CTX_FREE(msg_ctx, &env);
- msg_ctx = NULL;
- }
- if (response_ctx)
+ if (svc_client)
{
- AXIS2_MSG_CTX_FREE(response_ctx, &env);
- response_ctx = NULL;
- }
- if (call)
- {
- AXIS2_CALL_FREE(call, &env);
+ AXIS2_SVC_CLIENT_FREE(svc_client, &env);
+ svc_client = NULL;
}
if (endpoint_ref)
{
AXIS2_ENDPOINT_REF_FREE(endpoint_ref, &env);
endpoint_ref = NULL;
}
- return status;
+ return 0;
}
/* build SOAP request message content using OM */
axis2_om_node_t *
-build_om_programatically(axis2_env_t **env)
+build_om_payload(axis2_env_t **env)
{
axis2_om_node_t *echo_om_node = NULL;
axis2_om_element_t* echo_om_ele = NULL;
@@ -230,28 +126,30 @@
axis2_om_element_t * text_om_ele = NULL;
axis2_om_namespace_t *ns1 = NULL;
-
- axis2_xml_writer_t *xml_writer = NULL;
- axis2_om_output_t *om_output = NULL;
- axis2_char_t *buffer = NULL;
-
ns1 = axis2_om_namespace_create (env,
"http://ws.apache.org/axis2/c/samples", "ns1");
-
echo_om_ele = axis2_om_element_create(env, NULL, "echoString", ns1,
&echo_om_node);
-
text_om_ele = axis2_om_element_create(env, echo_om_node, "text", NULL,
&text_om_node);
-
AXIS2_OM_ELEMENT_SET_TEXT(text_om_ele, env, "echo5", text_om_node);
-
+ printf("\nSending OM : ");
+ print_om(env, echo_om_node);
+
+ return echo_om_node;
+}
+
+void print_om(axis2_env_t **env, axis2_om_node_t *node)
+{
+ axis2_xml_writer_t *xml_writer = NULL;
+ axis2_om_output_t *om_output = NULL;
+ axis2_char_t *buffer = NULL;
+
xml_writer = axis2_xml_writer_create_for_memory(env, NULL, AXIS2_FALSE,
AXIS2_FALSE);
om_output = axis2_om_output_create( env, xml_writer);
- AXIS2_OM_NODE_SERIALIZE(echo_om_node, env, om_output);
+ AXIS2_OM_NODE_SERIALIZE(node, env, om_output);
buffer = AXIS2_XML_WRITER_GET_XML(xml_writer, env);
- printf("\nSending OM node in XML : %s \n", buffer);
+ printf("%s\n", buffer);
AXIS2_FREE((*env)->allocator, buffer);
AXIS2_OM_OUTPUT_FREE(om_output, env);
-
- return echo_om_node;
+ return;
}