You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sh...@apache.org on 2008/04/01 06:40:52 UTC

svn commit: r643278 - in /webservices/axis2/trunk/c/src/core/clientapi: async_result.c callback.c callback_recv.c listener_manager.c options.c stub.c svc_client.c

Author: shankar
Date: Mon Mar 31 21:40:51 2008
New Revision: 643278

URL: http://svn.apache.org/viewvc?rev=643278&view=rev
Log:
Hackathon of client api

Modified:
    webservices/axis2/trunk/c/src/core/clientapi/async_result.c
    webservices/axis2/trunk/c/src/core/clientapi/callback.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/options.c
    webservices/axis2/trunk/c/src/core/clientapi/stub.c
    webservices/axis2/trunk/c/src/core/clientapi/svc_client.c

Modified: webservices/axis2/trunk/c/src/core/clientapi/async_result.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/clientapi/async_result.c?rev=643278&r1=643277&r2=643278&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/async_result.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/async_result.c Mon Mar 31 21:40:51 2008
@@ -40,6 +40,7 @@
     if (!async_result)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create asynchronous result.");
         return NULL;
     }
 
@@ -58,8 +59,6 @@
     axis2_async_result_t * async_result,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, NULL);
-
     if (async_result->result)
     {
         return axis2_msg_ctx_get_soap_envelope(async_result->result, env);
@@ -81,9 +80,5 @@
     axis2_async_result_t * async_result,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, void);
-
     AXIS2_FREE(env->allocator, async_result);
-
-    return;
 }

Modified: webservices/axis2/trunk/c/src/core/clientapi/callback.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/clientapi/callback.c?rev=643278&r1=643277&r2=643278&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/callback.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/callback.c Mon Mar 31 21:40:51 2008
@@ -86,6 +86,7 @@
     if (!callback)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create callback.");
         return NULL;
     }
 
@@ -110,7 +111,6 @@
 {
     axis2_status_t status = AXIS2_FAILURE;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     axis2_callback_set_envelope(callback, env,
                                 axis2_async_result_get_envelope(result, env));
     status = callback->on_complete(callback, env);
@@ -151,7 +151,6 @@
     const axis2_callback_t * callback,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, NULL);
     return callback->envelope;
 }
 
@@ -188,16 +187,12 @@
     axis2_callback_t * callback,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, void);
-
     if (callback->mutex)
     {
         axutil_thread_mutex_destroy(callback->mutex);
     }
 
     AXIS2_FREE(env->allocator, callback);
-
-    return;
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL

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=643278&r1=643277&r2=643278&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/callback_recv.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/callback_recv.c Mon Mar 31 21:40:51 2008
@@ -22,7 +22,6 @@
 
 struct axis2_callback_recv
 {
-
     /** base context struct */
     axis2_msg_recv_t *base;
     axis2_bool_t base_deep_copy;
@@ -51,6 +50,7 @@
     if (!callback_recv)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create callback receive.");
         return NULL;
     }
 
@@ -60,7 +60,7 @@
     callback_recv->mutex = NULL;
 
     callback_recv->base = axis2_msg_recv_create(env);
-    if (!(callback_recv->base))
+    if (!callback_recv->base)
     {
         axis2_callback_recv_free(callback_recv, env);
         return NULL;
@@ -70,7 +70,7 @@
                                axis2_callback_recv_receive);
 
     callback_recv->callback_map = axutil_hash_make(env);
-    if (!(callback_recv->callback_map))
+    if (!callback_recv->callback_map)
     {
         axis2_callback_recv_free(callback_recv, env);
         return NULL;
@@ -95,8 +95,6 @@
     axis2_callback_recv_t * callback_recv,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, void);
-
     if (callback_recv->mutex)
     {
         axutil_thread_mutex_destroy(callback_recv->mutex);
@@ -128,8 +126,6 @@
     {
         AXIS2_FREE(env->allocator, callback_recv);
     }
-
-    return;
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
@@ -139,8 +135,6 @@
     const axis2_char_t * msg_id,
     axis2_callback_t * callback)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
     if (msg_id)
     {
         axis2_char_t *mid = axutil_strdup(env, msg_id);
@@ -160,8 +154,6 @@
     axis2_callback_recv_t *callback_recv = NULL;
     axis2_relates_to_t *relates_to = NULL;
     axis2_msg_info_headers_t *msg_info_headers = NULL;
-
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
     callback_recv = axis2_msg_recv_get_derived(msg_recv, env);
 

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=643278&r1=643277&r2=643278&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/listener_manager.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/listener_manager.c Mon Mar 31 21:40:51 2008
@@ -68,6 +68,7 @@
     if (!listener_manager)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create listener manager.");
         return NULL;
     }
 
@@ -90,7 +91,6 @@
 {
     axis2_transport_listener_state_t *tl_state = NULL;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, conf_ctx, AXIS2_FAILURE);
 
     if (listener_manager->conf_ctx)
@@ -100,6 +100,7 @@
             AXIS2_ERROR_SET(env->error,
                             AXIS2_ERROR_CLIENT_SIDE_SUPPORT_ONLY_ONE_CONF_CTX,
                             AXIS2_FAILURE);
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Only one configuration context is supported at client side.");
             return AXIS2_FAILURE;
         }
     }
@@ -133,6 +134,8 @@
                                             (axis2_listener_manager_worker_func_args_t));
                     if (!arg_list)
                     {
+                        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+                        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create listener manager worker function arguments.");
                         return AXIS2_FAILURE;
                     }
                     arg_list->env = env;
@@ -178,6 +181,7 @@
                     {
                         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY,
                                         AXIS2_FAILURE);
+                        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create transport listener state.");
                     }
                     else
                     {
@@ -208,8 +212,6 @@
     axis2_transport_listener_state_t *tl_state = NULL;
     axis2_status_t status = AXIS2_FAILURE;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
     tl_state = listener_manager->listener_map[transport];
 
     if (tl_state)
@@ -218,10 +220,8 @@
         if (tl_state->waiting_calls == 0)
         {
             status = axis2_transport_receiver_stop(tl_state->listener, env);
-            if (status != AXIS2_SUCCESS)
-                return status;
-
-            listener_manager->listener_map[transport] = NULL;
+            if (status == AXIS2_SUCCESS)
+                listener_manager->listener_map[transport] = NULL;
         }
     }
 
@@ -237,8 +237,6 @@
 {
     axis2_transport_listener_state_t *tl_state = NULL;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
     tl_state = listener_manager->listener_map[transport];
     if (tl_state)
     {
@@ -255,8 +253,6 @@
 {
     int i = 0;
 
-    AXIS2_ENV_CHECK(env, void);
-
     for (i = 0; i < AXIS2_TRANSPORT_ENUM_MAX; i++)
     {
         if (listener_manager->listener_map[i])
@@ -264,8 +260,6 @@
     }
 
     AXIS2_FREE(env->allocator, listener_manager);
-
-    return;
 }
 
 AXIS2_EXTERN axis2_conf_ctx_t *AXIS2_CALL
@@ -288,7 +282,6 @@
     if (!args_list)
         return NULL;
 
-    AXIS2_ENV_CHECK(args_list->env, AXIS2_FAILURE);
     th_env = axutil_init_thread_env(args_list->env);
     if (args_list->listener)
     {

Modified: webservices/axis2/trunk/c/src/core/clientapi/options.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/clientapi/options.c?rev=643278&r1=643277&r2=643278&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/options.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/options.c Mon Mar 31 21:40:51 2008
@@ -71,6 +71,7 @@
     if (!options)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create options.");
         return NULL;
     }
 
@@ -91,14 +92,14 @@
     options->xml_parser_reset = AXIS2_TRUE;
 
     options->msg_info_headers = axis2_msg_info_headers_create(env, NULL, NULL);
-    if (!(options->msg_info_headers))
+    if (!options->msg_info_headers)
     {
         axis2_options_free(options, env);
         return NULL;
     }
 
     options->properties = axutil_hash_make(env);
-    if (!(options->properties))
+    if (!options->properties)
     {
         axis2_options_free(options, env);
         return NULL;
@@ -130,11 +131,9 @@
     const axutil_env_t * env)
 {
     const axis2_char_t *action = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
-
     action = axis2_msg_info_headers_get_action(options->msg_info_headers, env);
 
-    if (action == NULL && options->parent)
+    if (!action && options->parent)
     {
         return axis2_options_get_action(options->parent, env);
     }
@@ -148,12 +147,11 @@
     const axutil_env_t * env)
 {
     axis2_endpoint_ref_t *fault_to = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
 
     fault_to =
         axis2_msg_info_headers_get_fault_to(options->msg_info_headers, env);
 
-    if (fault_to == NULL && options->parent)
+    if (!fault_to && options->parent)
     {
         return axis2_options_get_fault_to(options->parent, env);
     }
@@ -167,11 +165,10 @@
     const axutil_env_t * env)
 {
     axis2_endpoint_ref_t *from = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
 
     from = axis2_msg_info_headers_get_from(options->msg_info_headers, env);
 
-    if (from == NULL && options->parent)
+    if (!from && options->parent)
     {
         return axis2_options_get_from(options->parent, env);
     }
@@ -184,9 +181,7 @@
     const axis2_options_t * options,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, NULL);
-
-    if (options->receiver == NULL && options->parent)
+    if (!options->receiver && options->parent)
     {
         return axis2_options_get_transport_receiver(options->parent, env);
     }
@@ -199,9 +194,7 @@
     const axis2_options_t * options,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, NULL);
-
-    if (options->transport_in == NULL && options->parent)
+    if (!options->transport_in && options->parent)
     {
         return axis2_options_get_transport_in(options->parent, env);
     }
@@ -214,8 +207,6 @@
     const axis2_options_t * options,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, NULL);
-
     if (options->parent)
     {
         return axis2_options_get_transport_in_protocol(options->parent, env);
@@ -230,12 +221,11 @@
     const axutil_env_t * env)
 {
     const axis2_char_t *message_id = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
 
     message_id =
         axis2_msg_info_headers_get_message_id(options->msg_info_headers, env);
 
-    if (message_id == NULL && options->parent)
+    if (!message_id && options->parent)
     {
         return axis2_options_get_message_id(options->parent, env);
     }
@@ -248,9 +238,7 @@
     const axis2_options_t * options,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, NULL);
-
-    if (axutil_hash_count(options->properties) == 0 && options->parent)
+    if (!axutil_hash_count(options->properties) && options->parent)
     {
         return axis2_options_get_properties(options->parent, env);
     }
@@ -265,11 +253,10 @@
     const axis2_char_t * key)
 {
     void *property = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
 
     property = axutil_hash_get(options->properties, key, AXIS2_HASH_KEY_STRING);
 
-    if (property == NULL && options->parent)
+    if (!property && options->parent)
     {
         return axis2_options_get_property(options->parent, env, key);
     }
@@ -283,12 +270,11 @@
     const axutil_env_t * env)
 {
     axis2_relates_to_t *relates_to = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
 
     relates_to =
         axis2_msg_info_headers_get_relates_to(options->msg_info_headers, env);
 
-    if (relates_to == NULL && options->parent)
+    if (!relates_to && options->parent)
     {
         return axis2_options_get_relates_to(options->parent, env);
     }
@@ -302,12 +288,11 @@
     const axutil_env_t * env)
 {
     axis2_endpoint_ref_t *reply_to = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
 
     reply_to =
         axis2_msg_info_headers_get_reply_to(options->msg_info_headers, env);
 
-    if (reply_to == NULL && options->parent)
+    if (!reply_to && options->parent)
     {
         return axis2_options_get_reply_to(options->parent, env);
     }
@@ -320,9 +305,7 @@
     const axis2_options_t * options,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, NULL);
-
-    if (options->transport_out == NULL && options->parent)
+    if (!options->transport_out && options->parent)
     {
         return axis2_options_get_transport_out(options->parent, env);
     }
@@ -335,9 +318,6 @@
     const axis2_options_t * options,
     const axutil_env_t * env)
 {
-
-    AXIS2_ENV_CHECK(env, NULL);
-
     if (options->parent)
     {
         return axis2_options_get_sender_transport_protocol(options->parent,
@@ -352,9 +332,7 @@
     const axis2_options_t * options,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, NULL);
-
-    if (options->soap_version_uri == NULL && options->parent)
+    if (!options->soap_version_uri && options->parent)
     {
         return axis2_options_get_soap_version_uri(options->parent, env);
     }
@@ -372,14 +350,16 @@
     const axis2_options_t * options,
     const axutil_env_t * env)
 {
-    if (options->timeout_in_milli_seconds == -1 && options->parent)
-    {
-        return axis2_options_get_timeout_in_milli_seconds(options->parent, env);
-    }
-
     if (options->timeout_in_milli_seconds == -1)
     {
-        return AXIS2_DEFAULT_TIMEOUT_MILLISECONDS;
+        if (options->parent)
+        {
+            return axis2_options_get_timeout_in_milli_seconds(options->parent, env);
+        }
+        else
+        {
+            return AXIS2_DEFAULT_TIMEOUT_MILLISECONDS;
+        }
     }
 
     return options->timeout_in_milli_seconds;
@@ -391,11 +371,10 @@
     const axutil_env_t * env)
 {
     axis2_endpoint_ref_t *to = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
 
     to = axis2_msg_info_headers_get_to(options->msg_info_headers, env);
 
-    if (to == NULL && options->parent)
+    if (!to && options->parent)
     {
         return axis2_options_get_to(options->parent, env);
     }
@@ -408,14 +387,16 @@
     const axis2_options_t * options,
     const axutil_env_t * env)
 {
-    if (options->use_separate_listener == -1 && options->parent)
-    {
-        return axis2_options_get_use_separate_listener(options->parent, env);
-    }
-
     if (options->use_separate_listener == -1)
     {
-        return AXIS2_FALSE;
+        if (options->parent)
+        {
+            return axis2_options_get_use_separate_listener(options->parent, env);
+        }
+        else
+        {
+            return AXIS2_FALSE;
+        }
     }
 
     return options->use_separate_listener;
@@ -527,8 +508,6 @@
     const axutil_env_t * env,
     axutil_hash_t * properties)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
     if (options->properties)
     {
         axutil_hash_free(options->properties, env);
@@ -588,12 +567,10 @@
     const AXIS2_TRANSPORT_ENUMS sender_transport,
     axis2_conf_t * conf)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
     options->transport_out =
         axis2_conf_get_transport_out(conf, env, sender_transport);
 
-    if (!(options->transport_out))
+    if (!options->transport_out)
     {
         return AXIS2_FAILURE;
     }
@@ -655,9 +632,7 @@
     const AXIS2_TRANSPORT_ENUMS receiver_transport,
     const axis2_bool_t use_separate_listener)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
-    /**
+    /*
       here we check for the legal combination
       */
     if (!use_separate_listener)
@@ -714,16 +689,16 @@
     const axis2_options_t * options,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
-
-    if (options->manage_session == -1 && options->parent)
-    {
-        return axis2_options_get_manage_session(options->parent, env);
-    }
-
     if (options->manage_session == -1)
     {
-        return AXIS2_FALSE;
+        if (options->parent)
+        {
+            return axis2_options_get_manage_session(options->parent, env);
+        }
+        else
+        {
+            return AXIS2_FALSE;
+        }
     }
 
     return options->manage_session;
@@ -744,8 +719,6 @@
     const axis2_options_t * options,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, NULL);
-
     return options->msg_info_headers;
 }
 
@@ -754,8 +727,6 @@
     axis2_options_t * options,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, void);
-
     if (options->properties)
     {
         axutil_hash_index_t *hi = NULL;
@@ -793,8 +764,6 @@
     }
 
     AXIS2_FREE(env->allocator, options);
-
-    return;
 }
 
 AXIS2_EXTERN int AXIS2_CALL
@@ -812,8 +781,6 @@
     const axutil_env_t * env,
     const int soap_version)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
     if (soap_version == AXIOM_SOAP11)
     {
         options->soap_version = soap_version;
@@ -874,8 +841,6 @@
     const axutil_env_t * env,
     axutil_string_t * soap_action)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
     if (options->soap_action)
     {
         axutil_string_free(options->soap_action, env);
@@ -915,7 +880,6 @@
 {
     axutil_property_t *rest_property = NULL;
 
-    AXIS2_ENV_CHECK(env, NULL);
     if (enable_rest)
     {
         rest_property = axutil_property_create(env);
@@ -943,7 +907,6 @@
 {
     axutil_property_t *test_auth_property = NULL;
 
-    AXIS2_ENV_CHECK(env, NULL);
     if (test_http_auth)
     {
         test_auth_property = axutil_property_create(env);
@@ -971,7 +934,6 @@
 {
     axutil_property_t *test_auth_property = NULL;
 
-    AXIS2_ENV_CHECK(env, NULL);
     if (test_proxy_auth)
     {
         test_auth_property = axutil_property_create(env);
@@ -999,7 +961,6 @@
     const axis2_char_t * http_method)
 {
     axutil_property_t *method_property = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
 
     method_property = axutil_property_create(env);
     axutil_property_set_value(method_property, env,
@@ -1038,8 +999,6 @@
     axis2_bool_t force_proxy_auth = AXIS2_FALSE;
     axutil_property_t *prop_pw = NULL;
     axutil_property_t *prop_un = NULL;
-    
-    AXIS2_ENV_CHECK(env, NULL);
 
     prop_un = axutil_property_create(env);
     axutil_property_set_value(prop_un, env, axutil_strdup(env, username));
@@ -1095,9 +1054,7 @@
     axis2_bool_t force_http_auth = AXIS2_FALSE;
     axutil_property_t *prop_un = NULL;
     axutil_property_t *prop_pw = NULL;
-    
-    AXIS2_ENV_CHECK(env, NULL);
-    
+        
     prop_un = axutil_property_create(env); 
     axutil_property_set_value(prop_un, env, axutil_strdup(env, username));
     axis2_options_set_property(options, env, AXIS2_HTTP_AUTH_UNAME, prop_un);

Modified: webservices/axis2/trunk/c/src/core/clientapi/stub.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/clientapi/stub.c?rev=643278&r1=643277&r2=643278&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/stub.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/stub.c Mon Mar 31 21:40:51 2008
@@ -37,6 +37,7 @@
     if (!stub)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create stub.");
         return NULL;
     }
     stub->svc_client = NULL;
@@ -62,7 +63,7 @@
     {
         return NULL;
     }
-    /* create service_client */
+   
     stub->svc_client = axis2_svc_client_create(env, client_home);
 
     if (!stub->svc_client)
@@ -70,14 +71,14 @@
         axis2_stub_free(stub, env);
         return NULL;
     }
-    /* create options */
+
     stub->options = axis2_options_create(env);
     if (!stub->options)
     {
         axis2_stub_free(stub, env);
         return NULL;
     }
-    /* Set service client options */
+
     axis2_svc_client_set_options(stub->svc_client, env, stub->options);
 
     axis2_options_set_to(stub->options, env, endpoint_ref);
@@ -119,19 +120,15 @@
     axis2_stub_t * stub,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, void);
-
-    if (stub->svc_client)
-    {
-        axis2_svc_client_free(stub->svc_client, env);
-    }
-
     if (stub)
     {
+        if (stub->svc_client)
+        {
+            axis2_svc_client_free(stub->svc_client, env);
+        }
+        
         AXIS2_FREE(env->allocator, stub);
     }
-
-    return;
 }
 
 axis2_status_t AXIS2_CALL
@@ -154,7 +151,6 @@
 {
     axis2_endpoint_ref_t *endpoint_ref = NULL;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, endpoint_uri, AXIS2_FAILURE);
 
     endpoint_ref = axis2_endpoint_ref_create(env, endpoint_uri);
@@ -196,6 +192,7 @@
 {
     if (!stub->options)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot set soap version. Stub option is not valid.");
         return AXIS2_FAILURE;
     }
     return axis2_options_set_soap_version(stub->options, env, soap_version);

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=643278&r1=643277&r2=643278&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/svc_client.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/svc_client.c Mon Mar 31 21:40:51 2008
@@ -118,11 +118,6 @@
                                                                client_home,
                                                                NULL, NULL);
 
-    if (!svc_client)
-    {
-        return NULL;
-    }
-
     return svc_client;
 }
 
@@ -149,6 +144,7 @@
     if (!svc_client)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create service client.");
         return NULL;
     }
 
@@ -165,14 +161,13 @@
     svc_client->http_headers = NULL;
     svc_client->http_status_code = 0;
 
-    /** initialize private data to NULL, create options */
     if (!axis2_svc_client_init_data(env, svc_client))
     {
         axis2_svc_client_free(svc_client, env);
         return NULL;
     }
 
-    /* the following method call will create the default conf_ctx if it is NULL */
+    /*create the default conf_ctx if it is NULL */
     if (!axis2_svc_client_init_transports_from_conf_ctx(env, svc_client,
                                                         conf_ctx, client_home))
     {
@@ -183,7 +178,7 @@
     svc_client->conf = axis2_conf_ctx_get_conf(svc_client->conf_ctx, env);
     repos_path = axis2_conf_get_repo(svc_client->conf, env);
     wsdl_path =
-        axutil_strcat(env, repos_path, AXIS2_PATH_SEP_STR, "woden", NULL);
+        axutil_strcat(env, repos_path, AXIS2_PATH_SEP_STR, AXIS2_WSDL_LOCATION_IN_REPO, NULL);
 
     svc_client->options = axis2_options_create(env);
     if (svc_client->svc)
@@ -220,6 +215,7 @@
     svc_grp = axis2_svc_get_parent(svc_client->svc, env);
     if (!svc_grp)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot access service group of service client.");
         return NULL;
     }
 
@@ -227,12 +223,14 @@
                                                 svc_client->conf_ctx);
     if (!svc_grp_ctx)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot access service group context of service client.");
         return NULL;
     }
 
     svc_grp_name = axis2_svc_grp_get_name(svc_grp, env);
     if (!svc_grp_name)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot access service group name of service client.");
         return NULL;            /* service group name is mandatory */
     }
 
@@ -258,16 +256,14 @@
     axis2_svc_grp_ctx_t *svc_grp_ctx = NULL;
     const axis2_char_t *svc_grp_name = NULL;
 
-    AXIS2_ENV_CHECK(env, NULL);
-
     svc_client = AXIS2_MALLOC(env->allocator, sizeof(axis2_svc_client_t));
     if (!svc_client)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create service client.");
         return NULL;
     }
     
-    
     svc_client->svc = NULL;
     svc_client->conf = NULL;
     svc_client->conf_ctx = NULL;
@@ -286,14 +282,13 @@
     svc_client->auth_type = NULL;
 	svc_client->http_headers = NULL;
 
-    /** initialize private data to NULL, create options */
     if (!axis2_svc_client_init_data(env, svc_client))
     {
         axis2_svc_client_free(svc_client, env);
         return NULL;
     }
 
-    /* the following method call will create the default conf_ctx if it is NULL */
+    /*create the default conf_ctx if it is NULL */
     if (!axis2_svc_client_init_transports_from_conf_ctx(env, svc_client,
                                                         conf_ctx, client_home))
     {
@@ -313,6 +308,7 @@
         if (!svc_client->svc)
         {
             axis2_svc_client_free(svc_client, env);
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot create annonymous service.");
             return NULL;
         }
     }
@@ -330,6 +326,7 @@
     svc_grp = axis2_svc_get_parent(svc_client->svc, env);
     if (!svc_grp)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot access service group of service client.");
         return NULL;
     }
 
@@ -337,12 +334,14 @@
                                                 svc_client->conf_ctx);
     if (!svc_grp_ctx)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot access service group context of service client.");
         return NULL;
     }
 
     svc_grp_name = axis2_svc_grp_get_name(svc_grp, env);
     if (!svc_grp_name)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot access service group name of service client.");
         return NULL;            /* service group name is mandatory */
     }
 
@@ -429,18 +428,16 @@
 
     mod_qname = axutil_qname_create(env, module_name, NULL, NULL);
 
-    if (mod_qname)
-    {
-        module = axis2_conf_get_module(svc_client->conf, env, mod_qname);
-
-        axutil_qname_free(mod_qname, env);
-        mod_qname = NULL;
-    }
-    else
+    if (!mod_qname)
     {
         return AXIS2_FAILURE;
     }
 
+    module = axis2_conf_get_module(svc_client->conf, env, mod_qname);
+
+    axutil_qname_free(mod_qname, env);
+    mod_qname = NULL;
+
     if (module)
     {
         return axis2_svc_engage_module(svc_client->svc, env, module,
@@ -462,17 +459,15 @@
     AXIS2_PARAM_CHECK(env->error, module_name, AXIS2_FAILURE);
 
     mod_qname = axutil_qname_create(env, module_name, NULL, NULL);
-    if (mod_qname)
-    {
-        module = axis2_conf_get_module(svc_client->conf, env, mod_qname);
-        axutil_qname_free(mod_qname, env);
-        mod_qname = NULL;
-    }
-    else
+    if (!mod_qname)
     {
         return AXIS2_FAILURE;
     }
 
+    module = axis2_conf_get_module(svc_client->conf, env, mod_qname);
+    axutil_qname_free(mod_qname, env);
+    mod_qname = NULL;
+
     if (module)
     {
         return axis2_svc_disengage_module(svc_client->svc, env, module,
@@ -494,7 +489,6 @@
         svc_client->headers = axutil_array_list_create(env, 0);
         if (!svc_client->headers)
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
             return AXIS2_FAILURE;
         }
     }
@@ -522,14 +516,6 @@
 
     for (i = size-1; i >-1; i--)
     {
-        /*axiom_node_t *node = NULL;
-           node = axutil_array_list_get(svc_client->headers, env, i);
-
-           if (node)
-           {
-           axiom_node_free_tree(node, env);
-           node = NULL;
-           } */
         axutil_array_list_remove(svc_client->headers, env, i);
     }
     return AXIS2_SUCCESS;
@@ -552,6 +538,10 @@
     {
         op_qname =
             axutil_qname_create(env, AXIS2_ANON_ROBUST_OUT_ONLY_OP, NULL, NULL);
+        if(!op_qname)
+        {
+            return AXIS2_FAILURE;
+        }
         qname_free_flag = AXIS2_TRUE;
     }
 
@@ -564,8 +554,7 @@
     svc_client->auth_type = NULL;
 
     msg_ctx = axis2_msg_ctx_create(env,
-                                   axis2_svc_ctx_get_conf_ctx(svc_client->
-                                                              svc_ctx, env),
+                                   axis2_svc_ctx_get_conf_ctx(svc_client->svc_ctx, env),
                                    NULL, NULL);
     if (!axis2_svc_client_fill_soap_envelope(env, svc_client, msg_ctx, payload))
     {
@@ -603,7 +592,6 @@
     const axutil_env_t * env,
     const axiom_node_t * payload)
 {
-    AXIS2_PARAM_CHECK (env->error, svc_client, AXIS2_FAILURE);
     return axis2_svc_client_send_robust_with_op_qname(svc_client, env, NULL,
                                                       payload);
 }
@@ -618,19 +606,15 @@
     axis2_msg_ctx_t *msg_ctx = NULL;
     axis2_bool_t qname_free_flag = AXIS2_FALSE;
 
-    if (!svc_client)
-    {
-        return;
-    }
-
-    if (!env)
-    {
-        return;
-    }
+    AXIS2_PARAM_CHECK_VOID(env->error, svc_client);
 
     if (!op_qname)
     {
         op_qname = axutil_qname_create(env, AXIS2_ANON_OUT_ONLY_OP, NULL, NULL);
+        if(!op_qname)
+        {
+            return;
+        }
         qname_free_flag = AXIS2_TRUE;
     }
 
@@ -643,8 +627,7 @@
     svc_client->auth_type = NULL;
 
     msg_ctx = axis2_msg_ctx_create(env,
-                                   axis2_svc_ctx_get_conf_ctx(svc_client->
-                                                              svc_ctx, env),
+                                   axis2_svc_ctx_get_conf_ctx(svc_client->svc_ctx, env),
                                    NULL, NULL);
     if (!axis2_svc_client_fill_soap_envelope(env, svc_client, msg_ctx, payload))
     {
@@ -672,8 +655,6 @@
     {
         axutil_qname_free((axutil_qname_t *) op_qname, env);
     }
-
-    return;
 }
 
 AXIS2_EXTERN void AXIS2_CALL
@@ -682,10 +663,6 @@
     const axutil_env_t * env,
     const axiom_node_t * payload)
 {
-    if (!svc_client)
-    {
-        return;
-    }
     axis2_svc_client_fire_and_forget_with_op_qname(svc_client, env, NULL,
                                                    payload);
 }
@@ -737,8 +714,11 @@
 
     if (!op_qname)
     {
-        qname_free_flag = AXIS2_TRUE;
         op_qname = axutil_qname_create(env, AXIS2_ANON_OUT_IN_OP, NULL, NULL);
+        if(!op_qname)
+            return NULL;
+
+        qname_free_flag = AXIS2_TRUE;
     }
 
     if (axis2_options_get_use_separate_listener(svc_client->options, env))
@@ -817,6 +797,7 @@
             {
                 AXIS2_ERROR_SET(env->error, AXIS2_ERROR_RESPONSE_TIMED_OUT,
                                 AXIS2_FAILURE);
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Response time out.");
                 return NULL;
             }
         }
@@ -828,6 +809,9 @@
                                        axis2_svc_ctx_get_conf_ctx(svc_client->
                                                                   svc_ctx, env),
                                        NULL, NULL);
+        if(!msg_ctx)
+            return NULL;
+
         axis2_op_client_add_msg_ctx(svc_client->op_client, env, msg_ctx);
 
         axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);
@@ -848,11 +832,12 @@
     else
     {
         msg_ctx = axis2_msg_ctx_create(env,
-                                       axis2_svc_ctx_get_conf_ctx(svc_client->
-                                                                  svc_ctx, env),
+                                       axis2_svc_ctx_get_conf_ctx(svc_client->svc_ctx, env),
                                        NULL, NULL);
-        if (!axis2_svc_client_fill_soap_envelope
-            (env, svc_client, msg_ctx, payload))
+        if(!msg_ctx)
+            return NULL;
+
+        if (!axis2_svc_client_fill_soap_envelope(env, svc_client, msg_ctx, payload))
         {
             return NULL;
         }
@@ -961,7 +946,6 @@
     const axutil_env_t * env,
     const axiom_node_t * payload)
 {
-    AXIS2_PARAM_CHECK (env->error, svc_client, NULL);
     return axis2_svc_client_send_receive_with_op_qname(svc_client, env, NULL,
                                                        payload);
 }
@@ -978,14 +962,13 @@
     AXIS2_TRANSPORT_ENUMS transport_in_protocol;
     axis2_bool_t qname_free_flag = AXIS2_FALSE;
     
-    if (!svc_client)
-    {
-        return;
-    }
+    AXIS2_PARAM_CHECK_VOID(env->error, svc_client);
 
     if (!op_qname)
     {
         op_qname = axutil_qname_create(env, AXIS2_ANON_OUT_IN_OP, NULL, NULL);
+        if(!op_qname)
+            return;
         qname_free_flag = AXIS2_TRUE;
     }
 
@@ -1001,6 +984,9 @@
                                    axis2_svc_ctx_get_conf_ctx(svc_client->
                                                               svc_ctx, env),
                                    NULL, NULL);
+    if(!msg_ctx)
+        return;
+
     if (!axis2_svc_client_fill_soap_envelope(env, svc_client, msg_ctx, payload))
     {
         return;
@@ -1051,8 +1037,6 @@
         axutil_qname_free((axutil_qname_t *) op_qname, env);
         op_qname = NULL;
     }
-
-    return;
 }
 
 AXIS2_EXTERN void AXIS2_CALL
@@ -1062,11 +1046,6 @@
     const axiom_node_t * payload,
     axis2_callback_t * callback)
 {
-    if (!svc_client)
-    {
-        return;
-    }
-
     axis2_svc_client_send_receive_non_blocking_with_op_qname(svc_client, env,
                                                              NULL, payload,
                                                              callback);
@@ -1086,12 +1065,13 @@
 
     if (!op)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot find operation to create op client.");
         return NULL;
     }
 
     if (!(svc_client->op_client) || svc_client->reuse)
     {
-        if (svc_client->reuse)
+        if ((svc_client->reuse) && (svc_client->op_client))
             axis2_op_client_free(svc_client->op_client, env);
         svc_client->op_client =
             axis2_op_client_create(env, op, svc_client->svc_ctx,
@@ -1179,26 +1159,23 @@
     axis2_conf_ctx_t * conf_ctx,
     const axis2_char_t * client_home)
 {
-
-    AXIS2_PARAM_CHECK (env->error, svc_client, AXIS2_FAILURE);
     svc_client->conf_ctx = conf_ctx;
-    if (!(svc_client->conf_ctx))
+    if (!svc_client->conf_ctx)
     {
         svc_client->conf_ctx = axis2_build_client_conf_ctx(env, client_home);
-        if (!(svc_client->conf_ctx))
+        if (!svc_client->conf_ctx)
         {
             return AXIS2_FALSE;
         }
     }
 
-    if (!(svc_client->listener_manager))
+    if (!svc_client->listener_manager)
     {
         svc_client->listener_manager = axis2_listener_manager_create(env);
-    }
-
-    if (!(svc_client->listener_manager))
-    {
-        return AXIS2_FALSE;
+        if (!svc_client->listener_manager)
+        {
+            return AXIS2_FALSE;
+        }
     }
 
     return AXIS2_TRUE;
@@ -1209,24 +1186,17 @@
     const axutil_env_t * env,
     axis2_svc_client_t * svc_client)
 {
-
-    AXIS2_PARAM_CHECK (env->error, svc_client, AXIS2_FAILURE);
-
     svc_client->svc = NULL;
-
     svc_client->conf_ctx = NULL;
-
     svc_client->svc_ctx = NULL;
 
     svc_client->options = axis2_options_create(env);
     if (!svc_client->options)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return AXIS2_FALSE;
     }
 
     svc_client->override_options = NULL;
-
     svc_client->headers = NULL;
 
     if (svc_client->callback_recv)
@@ -1236,9 +1206,8 @@
     }
 
     svc_client->callback_recv = axis2_callback_recv_create(env);
-    if (!(svc_client->callback_recv))
+    if (!svc_client->callback_recv)
     {
-        axis2_svc_client_free(svc_client, env);
         return AXIS2_FALSE;
     }
 
@@ -1263,50 +1232,40 @@
     *op_out_only,
     *op_robust_out_only;
     axis2_phases_info_t *info = NULL;
-    AXIS2_PARAM_CHECK (env->error, svc_client, NULL);
-    tmp_qname = axutil_qname_create(env, AXIS2_ANON_SERVICE, NULL, NULL);
 
+    tmp_qname = axutil_qname_create(env, AXIS2_ANON_SERVICE, NULL, NULL);
     if (!tmp_qname)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
 
     svc = axis2_svc_create_with_qname(env, tmp_qname);
-
+    axutil_qname_free(tmp_qname, env);
     if (!svc)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
-    axutil_qname_free(tmp_qname, env);
+    
 
     tmp_qname = axutil_qname_create(env, AXIS2_ANON_OUT_IN_OP, NULL, NULL);
-
     if (!tmp_qname)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
     op_out_in = axis2_op_create_with_qname(env, tmp_qname);
     axutil_qname_free(tmp_qname, env);
 
     tmp_qname = axutil_qname_create(env, AXIS2_ANON_OUT_ONLY_OP, NULL, NULL);
-
     if (!tmp_qname)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
     op_out_only = axis2_op_create_with_qname(env, tmp_qname);
     axutil_qname_free(tmp_qname, env);
 
-    tmp_qname =
-        axutil_qname_create(env, AXIS2_ANON_ROBUST_OUT_ONLY_OP, NULL, NULL);
-
+    tmp_qname = axutil_qname_create(env, AXIS2_ANON_ROBUST_OUT_ONLY_OP, NULL, NULL);
     if (!tmp_qname)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
     op_robust_out_only = axis2_op_create_with_qname(env, tmp_qname);
@@ -1352,8 +1311,6 @@
     axis2_svc_client_t * svc_client,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, void);
-    
     if (!svc_client)
     {
         return;
@@ -1428,6 +1385,7 @@
 
     if (!soap_version_uri)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot find soap version uri.");
         return AXIS2_FALSE;
     }
 
@@ -1445,6 +1403,7 @@
         axiom_soap_envelope_create_default_soap_envelope(env, soap_version);
     if (!envelope)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot create default soap envelope.");
         return AXIS2_FALSE;
     }
 
@@ -1691,18 +1650,21 @@
 
     if (!svc)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot find service of service client. Cannot set policy.");
         return AXIS2_FAILURE;
     }
 
     desc = axis2_svc_get_base(svc, env);
     if (!desc)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot find service description of service client. Cannot set policy.");
         return AXIS2_FAILURE;
     }
 
     policy_include = axis2_desc_get_policy_include(desc, env);
     if (!policy_include)
     {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot find policy include. Cannot set policy.");
         return AXIS2_FAILURE;
     }
 
@@ -1727,8 +1689,7 @@
     return svc_client->http_status_code;
 }
 
-void
-axis2_svc_client_set_http_info(
+void axis2_svc_client_set_http_info(
     axis2_svc_client_t * svc_client,
     const axutil_env_t * env,
     axis2_msg_ctx_t * msg_ctx)



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org