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 da...@apache.org on 2009/03/07 03:39:10 UTC

svn commit: r751176 - in /webservices/axis2/trunk/c: include/axis2_svc_client.h src/core/clientapi/svc_client.c

Author: damitha
Date: Sat Mar  7 02:39:09 2009
New Revision: 751176

URL: http://svn.apache.org/viewvc?rev=751176&view=rev
Log:

See AXIS2C-1353 and AXIS2C-1354

Modified:
    webservices/axis2/trunk/c/include/axis2_svc_client.h
    webservices/axis2/trunk/c/src/core/clientapi/svc_client.c

Modified: webservices/axis2/trunk/c/include/axis2_svc_client.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_svc_client.h?rev=751176&r1=751175&r2=751176&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_svc_client.h (original)
+++ webservices/axis2/trunk/c/include/axis2_svc_client.h Sat Mar  7 02:39:09 2009
@@ -77,6 +77,19 @@
         const axutil_env_t * env);
 
     /**
+     * Returns the axis2_conf_ctx_t. This is useful when creating service clients using
+     * the same configuration context as the original service client.
+     * @param svc_client pointer to service client struct
+     * @param env pointer to environment struct
+     * @return a pointer to axis configuration context struct, or NULL. 
+     * Returns a reference, not a cloned copy. 
+     */
+    AXIS2_EXTERN axis2_conf_ctx_t *AXIS2_CALL
+    axis2_svc_client_get_conf_ctx(
+        const axis2_svc_client_t * svc_client,
+        const axutil_env_t * env);
+
+    /**
      * Sets the options to be used by service client.
      * @param svc_client pointer to service client struct
      * @param env pointer to environment struct

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=751176&r1=751175&r2=751176&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/svc_client.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/svc_client.c Sat Mar  7 02:39:09 2009
@@ -78,6 +78,8 @@
     axutil_array_list_t *http_headers;
 
     int http_status_code;
+    
+    axis2_bool_t keep_externally_passed_ctx_and_svc;
 
 };
 
@@ -159,6 +161,7 @@
     svc_client->required_auth_is_http = AXIS2_FALSE;
     svc_client->auth_type = NULL;
 	svc_client->http_headers = NULL;
+    svc_client->keep_externally_passed_ctx_and_svc = AXIS2_FALSE;
 
     if (!axis2_svc_client_init_data(env, svc_client))
     {
@@ -178,6 +181,7 @@
 
     if (svc)
     {
+        svc_client->keep_externally_passed_ctx_and_svc = AXIS2_TRUE;
         svc_client->svc = svc;
     }
     else
@@ -242,6 +246,15 @@
     return svc_client->svc;
 }
 
+AXIS2_EXTERN axis2_conf_ctx_t *AXIS2_CALL
+axis2_svc_client_get_conf_ctx(
+    const axis2_svc_client_t * svc_client,
+    const axutil_env_t * env)
+{
+    AXIS2_PARAM_CHECK (env->error, svc_client, NULL);
+    return svc_client->conf_ctx;
+}
+
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axis2_svc_client_set_options(
     axis2_svc_client_t * svc_client,
@@ -1043,6 +1056,10 @@
             return AXIS2_FALSE;
         }
     }
+    else
+    {
+        svc_client->keep_externally_passed_ctx_and_svc = AXIS2_TRUE;
+    }
 
     if (!svc_client->listener_manager)
     {
@@ -1198,7 +1215,7 @@
         svc_client->headers = NULL;        
     }
 
-    if (svc_client->svc)
+    if (svc_client->svc && !svc_client->keep_externally_passed_ctx_and_svc)
     {
         axis2_svc_free(svc_client->svc, env);
     }
@@ -1223,7 +1240,7 @@
         axis2_listener_manager_free(svc_client->listener_manager, env);
     }
 
-    if (svc_client->conf_ctx)
+    if (svc_client->conf_ctx && !svc_client->keep_externally_passed_ctx_and_svc)
     {
         axis2_conf_ctx_free(svc_client->conf_ctx, env);
     }