You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2006/05/03 08:40:34 UTC

svn commit: r399170 - in /webservices/axis2/trunk/c: modules/core/clientapi/svc_client.c modules/core/description/svc.c samples/user_guide/clients/echo_blocking.c

Author: samisa
Date: Tue May  2 23:40:32 2006
New Revision: 399170

URL: http://svn.apache.org/viewcvs?rev=399170&view=rev
Log:
Fixed few bugs in service client

Modified:
    webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c
    webservices/axis2/trunk/c/modules/core/description/svc.c
    webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking.c

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=399170&r1=399169&r2=399170&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c Tue May  2 23:40:32 2006
@@ -54,14 +54,14 @@
 #define AXIS2_INTF_TO_IMPL(svc_client) ((axis2_svc_client_impl_t *)svc_client)
 
 /** private functions */
-static axis2_bool_t initialize_transport(axis2_env_t **env, 
+static axis2_bool_t axis2_svc_client_initialize_transport(axis2_env_t **env, 
 									axis2_svc_client_impl_t *svc_client_impl,
 									axis2_conf_ctx_t *conf_ctx,
 									axis2_char_t *client_home);
 static axis2_bool_t axis2_svc_client_init_data(axis2_env_t **env,
 									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_create_annonymous_svc(axis2_env_t **env);
+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,
                                 axis2_msg_ctx_t *msg_ctx, axis2_om_node_t *payload);
 
@@ -215,6 +215,7 @@
     axis2_svc_client_impl_t *svc_client_impl = NULL;
 	axis2_svc_grp_t *svc_grp = NULL;
 	axis2_svc_grp_ctx_t *svc_grp_ctx = NULL;
+    axis2_char_t *svc_grp_name = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
 
@@ -231,8 +232,13 @@
 		axis2_svc_client_free(&(svc_client_impl->svc_client), env);
 		return NULL;
 	}
+
+    if (!conf_ctx)
+    {
+        
+    }
 	
-	if (!initialize_transport(env, svc_client_impl, conf_ctx, client_home))
+	if (!axis2_svc_client_initialize_transport(env, svc_client_impl, conf_ctx, client_home))
 	{
 		axis2_svc_client_free(&(svc_client_impl->svc_client), env);
 		return NULL;
@@ -246,7 +252,7 @@
 	}
 	else
 	{
-		if (NULL == (svc_client_impl->svc = axis2_create_annonymous_svc(env)))
+		if (NULL == (svc_client_impl->svc = axis2_svc_client_create_annonymous_svc(env)))
 		{
 			axis2_svc_client_free(&(svc_client_impl->svc_client), env);
 			return NULL;
@@ -273,8 +279,12 @@
     if (!svc_grp_ctx)
         return NULL;
     
+    svc_grp_name = AXIS2_SVC_GRP_GET_NAME(svc_grp, env);
+    if (!svc_grp_name)
+        return NULL; /* cannot proceed without svc group name */
+        
 	AXIS2_CONF_CTX_REGISTER_SVC_GRP_CTX(svc_client_impl->conf_ctx, env, 
-		AXIS2_SVC_GET_AXIS2_SVC_NAME(svc_client_impl->svc, env), svc_grp_ctx);
+		svc_grp_name, svc_grp_ctx);
     
 	svc_client_impl->svc_ctx = AXIS2_SVC_GRP_CTX_GET_SVC_CTX(svc_grp_ctx, env,
 		        AXIS2_SVC_GET_AXIS2_SVC_NAME(svc_client_impl->svc, env));
@@ -751,7 +761,7 @@
 
 /** private function implementation */
 
-static axis2_bool_t initialize_transport(axis2_env_t **env,
+static axis2_bool_t axis2_svc_client_initialize_transport(axis2_env_t **env,
                                     axis2_svc_client_impl_t *svc_client_impl,
                                     axis2_conf_ctx_t *conf_ctx,
 									axis2_char_t *client_home)
@@ -867,7 +877,7 @@
   * @return the minted anonymous service
   */
 
-static axis2_svc_t* axis2_create_annonymous_svc(axis2_env_t **env)
+static axis2_svc_t* axis2_svc_client_create_annonymous_svc(axis2_env_t **env)
 {
 	/**
 	now add anonymous operations to the axis2 service for use with the

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=399170&r1=399169&r2=399170&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/svc.c (original)
+++ webservices/axis2/trunk/c/modules/core/description/svc.c Tue May  2 23:40:32 2006
@@ -1450,7 +1450,23 @@
 axis2_svc_get_axis2_svc_name(axis2_svc_t *svc,
                             axis2_env_t **env) 
 {
-    return AXIS2_INTF_TO_IMPL(svc)->axis_svc_name;
+    axis2_svc_impl_t *svc_impl = NULL;
+    axis2_qname_t *qname = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    svc_impl = AXIS2_INTF_TO_IMPL(svc);
+    
+    if (svc_impl->axis_svc_name)
+        return svc_impl->axis_svc_name;
+
+    qname = AXIS2_WSDL_SVC_GET_QNAME(svc->wsdl_svc, env);
+    if (qname)
+    {
+        return AXIS2_QNAME_GET_LOCALPART(qname, env);
+    }
+        
+    return NULL;
 }
 
 axis2_status_t AXIS2_CALL

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=399170&r1=399169&r2=399170&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 Tue May  2 23:40:32 2006
@@ -25,15 +25,14 @@
 
 int main(int argc, char** argv)
 {
+    axis2_env_t *env = 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_env_t *env = NULL;
-    /*axis2_error_t *error = NULL;
-    axis2_log_t *log = NULL;
-    axis2_allocator_t *allocator = NULL;*/
     axis2_char_t *address = NULL;
     axis2_char_t *wsa_action = NULL;
-    axis2_char_t *client_home = NULL;
     axis2_om_node_t *ret_node = NULL;
     axis2_svc_t *svc = NULL;
     axis2_op_t *op = NULL;
@@ -45,24 +44,29 @@
     axis2_conf_t *conf = NULL;
     axis2_msg_ctx_t *response_ctx = NULL;
     
-    /* set up the envioronment with allocator and log*/
-    /*allocator = axis2_allocator_init (NULL);
-    error = axis2_error_create(allocator);
-    log = axis2_log_create(allocator, NULL, "addr_echo.log");*/
+    /* set up the envioronment */
     env = axis2_env_create_all("echo_blocking.log", AXIS2_LOG_LEVEL_TRACE);
-    /*env->log->level = AXIS2_LOG_LEVEL_TRACE;
-    axis2_error_init();*/
 
     /* Set up deploy folder. It is from the deploy folder, the configuration is picked up 
      * using the axis2.xml file.
      * In this sample client_home points to the Axis2/C default deploy folder. The client_home can 
      * be different from this folder on your system. For example, you may have a different folder 
-     *(say, my_client_folder) with its own axis2.xml file. my_client_folder/modules will have the 
+     * (say, my_client_folder) with its own axis2.xml file. my_client_folder/modules will have the 
      * modules that the client uses
      */
     client_home = AXIS2_GETENV("AXIS2C_HOME");
     if (!client_home)
         client_home = "../../deploy";
+
+    svc_client = axis2_svc_client_create(&env, client_home);
+
+    if (!svc_client)
+    {
+        printf("Error creating service client\n");
+        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));
+    }
     
     /* Set end point reference of echo service */
     address = "http://localhost:9090/axis2/services/echo";