axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r356124 [1/3] - in /webservices/axis2/trunk/c/modules: core/description/src/ core/phaseresolver/src/ wsdl/src/
Date Mon, 12 Dec 2005 03:14:32 GMT
Author: damitha
Date: Sun Dec 11 19:13:55 2005
New Revision: 356124

URL: http://svn.apache.org/viewcvs?rev=356124&view=rev
Log:
refactoring completed

Modified:
    webservices/axis2/trunk/c/modules/core/description/src/module_desc.c
    webservices/axis2/trunk/c/modules/core/description/src/operation.c
    webservices/axis2/trunk/c/modules/core/description/src/svc.c
    webservices/axis2/trunk/c/modules/core/description/src/svc_grp.c
    webservices/axis2/trunk/c/modules/core/phaseresolver/src/phase_resolver.c
    webservices/axis2/trunk/c/modules/wsdl/src/axis2_wsdl.h
    webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding.c
    webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding_fault.c
    webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding_msg_ref.c
    webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding_operation.c
    webservices/axis2/trunk/c/modules/wsdl/src/wsdl_component.c
    webservices/axis2/trunk/c/modules/wsdl/src/wsdl_endpoint.c
    webservices/axis2/trunk/c/modules/wsdl/src/wsdl_extensible_component.c
    webservices/axis2/trunk/c/modules/wsdl/src/wsdl_extensible_element.c
    webservices/axis2/trunk/c/modules/wsdl/src/wsdl_feature.c
    webservices/axis2/trunk/c/modules/wsdl/src/wsdl_interface.c
    webservices/axis2/trunk/c/modules/wsdl/src/wsdl_operation.c
    webservices/axis2/trunk/c/modules/wsdl/src/wsdl_property.c
    webservices/axis2/trunk/c/modules/wsdl/src/wsdl_soap_operation.c
    webservices/axis2/trunk/c/modules/wsdl/src/wsdl_svc.c

Modified: webservices/axis2/trunk/c/modules/core/description/src/module_desc.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/module_desc.c?rev=356124&r1=356123&r2=356124&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/module_desc.c (original)
+++ webservices/axis2/trunk/c/modules/core/description/src/module_desc.c Sun Dec 11 19:13:55 2005
@@ -115,7 +115,7 @@
 axis2_param_t * AXIS2_CALL
 axis2_module_desc_get_param(axis2_module_desc_t *module_desc,
                                     axis2_env_t **env,
-                                    const axis2_char_t *name);
+                                    axis2_char_t *name);
 
 axis2_array_list_t * AXIS2_CALL
 axis2_module_desc_get_params (axis2_module_desc_t *module_desc,
@@ -124,55 +124,63 @@
 axis2_bool_t AXIS2_CALL
 axis2_module_desc_is_param_locked (axis2_module_desc_t *module_desc,
                                     axis2_env_t **env,
-                                    const axis2_char_t *param_name);
+                                    axis2_char_t *param_name);
 
 /************************** End of function prototypes ************************/
 
 axis2_module_desc_t * AXIS2_CALL 
 axis2_module_desc_create (axis2_env_t **env)
 {
+    axis2_module_desc_impl_t *module_desc_impl = NULL;
+    
 	AXIS2_ENV_CHECK(env, NULL);
 	
-	axis2_module_desc_impl_t *module_desc_impl = 
-		(axis2_module_desc_impl_t *) AXIS2_MALLOC((*env)->allocator,
+	module_desc_impl = (axis2_module_desc_impl_t *) AXIS2_MALLOC((*env)->allocator,
 			sizeof(axis2_module_desc_impl_t));
 		
 	if(NULL == module_desc_impl)
+    {
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL); 
+        return NULL;
+    }
+    
+    module_desc_impl->qname = NULL;
+    module_desc_impl->parent = NULL;	
+    module_desc_impl->module_desc.params = NULL;
+    module_desc_impl->module_desc.flow_container = NULL;
+    module_desc_impl->operations = NULL;
     
     module_desc_impl->module_desc.params = axis2_param_container_create(env);
     if(NULL == module_desc_impl->module_desc.params)
     {
-        AXIS2_FREE((*env)->allocator, module_desc_impl);
+        axis2_module_desc_free(&(module_desc_impl->module_desc), env);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }
     
     module_desc_impl->module_desc.flow_container = axis2_flow_container_create(env);
     if(NULL == module_desc_impl->module_desc.flow_container)
     {
-        AXIS2_PARAM_CONTAINER_FREE(module_desc_impl->module_desc.params, env);
-        AXIS2_FREE((*env)->allocator, module_desc_impl);
+        axis2_module_desc_free(&(module_desc_impl->module_desc), env);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }
     
     module_desc_impl->operations = axis2_hash_make(env);
     if(NULL == module_desc_impl->operations)
     {
-        AXIS2_PARAM_CONTAINER_FREE(module_desc_impl->module_desc.params, env);
-        AXIS2_FLOW_CONTAINER_FREE(module_desc_impl->module_desc.flow_container, env); 
-        AXIS2_FREE((*env)->allocator, module_desc_impl);
-        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);        
+        axis2_module_desc_free(&(module_desc_impl->module_desc), env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL); 
+        return NULL;        
     }
    
 	module_desc_impl->module_desc.ops = 
 		AXIS2_MALLOC ((*env)->allocator, sizeof(axis2_module_desc_ops_t));
 	if(NULL == module_desc_impl->module_desc.ops)
     {
-        AXIS2_PARAM_CONTAINER_FREE(module_desc_impl->module_desc.params, env);
-        AXIS2_FLOW_CONTAINER_FREE(module_desc_impl->module_desc.flow_container, env);
-        axis2_hash_free(module_desc_impl->operations, env);
-        AXIS2_FREE((*env)->allocator, module_desc_impl);
+        axis2_module_desc_free(&(module_desc_impl->module_desc), env);
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }
     
 	module_desc_impl->module_desc.ops->free = axis2_module_desc_free;
@@ -182,25 +190,25 @@
     module_desc_impl->module_desc.ops->set_outflow = axis2_module_desc_set_outflow;
     
     module_desc_impl->module_desc.ops->get_fault_inflow = 
-        axis2_module_desc_get_fault_inflow;
+            axis2_module_desc_get_fault_inflow;
     
     module_desc_impl->module_desc.ops->set_fault_inflow = 
-        axis2_module_desc_set_fault_inflow;
+            axis2_module_desc_set_fault_inflow;
     
     module_desc_impl->module_desc.ops->get_fault_outflow = 
         axis2_module_desc_get_fault_outflow;
     
     module_desc_impl->module_desc.ops->set_fault_outflow = 
-        axis2_module_desc_set_fault_outflow;
+            axis2_module_desc_set_fault_outflow;
     
     module_desc_impl->module_desc.ops->get_name = axis2_module_desc_get_name;
     module_desc_impl->module_desc.ops->set_name = axis2_module_desc_set_name;
     
     module_desc_impl->module_desc.ops->add_operation = 
-        axis2_module_desc_add_operation;
+            axis2_module_desc_add_operation;
     
     module_desc_impl->module_desc.ops->get_operations = 
-        axis2_module_desc_get_operations;
+            axis2_module_desc_get_operations;
     
     module_desc_impl->module_desc.ops->get_parent = axis2_module_desc_get_parent;
     module_desc_impl->module_desc.ops->set_parent = axis2_module_desc_set_parent;
@@ -209,11 +217,7 @@
     module_desc_impl->module_desc.ops->get_params = axis2_module_desc_get_params;
     
     module_desc_impl->module_desc.ops->is_param_locked = 
-        axis2_module_desc_is_param_locked;
-	
-    module_desc_impl->qname = NULL;
-
-    module_desc_impl->parent = NULL;	
+            axis2_module_desc_is_param_locked;
     
 	return &(module_desc_impl->module_desc);
 }
@@ -241,27 +245,59 @@
 axis2_module_desc_free(axis2_module_desc_t *module_desc,
                             axis2_env_t **env)
 {
+    axis2_module_desc_impl_t * module_desc_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(module_desc, env, AXIS2_FAILURE);
     
+    module_desc_impl = AXIS2_INTF_TO_IMPL(module_desc);
+    
     if(NULL != module_desc->ops)
         AXIS2_FREE((*env)->allocator, module_desc->ops);
     
     if(NULL == module_desc->params)
+    {
         AXIS2_PARAM_CONTAINER_FREE(module_desc->params, env);
+        module_desc->params = NULL;
+    }
     
     if(NULL == module_desc->flow_container)
+    {
         AXIS2_FLOW_CONTAINER_FREE(module_desc->flow_container, env);
+        module_desc->flow_container = NULL;
+    }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(module_desc)->parent)
-        AXIS2_ENGINE_CONFIG_FREE(AXIS2_INTF_TO_IMPL(module_desc)->parent, env);
+    module_desc_impl->parent = NULL;
     
-    if(NULL != AXIS2_INTF_TO_IMPL(module_desc)->qname)
-        AXIS2_QNAME_FREE(AXIS2_INTF_TO_IMPL(module_desc)->qname, env);
+    if(NULL != module_desc_impl->qname)
+    {
+        AXIS2_QNAME_FREE(module_desc_impl->qname, env);
+        module_desc_impl->qname = NULL;
+    }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(module_desc)->operations)
-        axis2_hash_free(AXIS2_INTF_TO_IMPL(module_desc)->operations, env);
+    if(NULL != module_desc_impl->operations)
+    {
+        axis2_hash_index_t *hi = NULL;
+        void *val = NULL;
+        for (hi = axis2_hash_first (module_desc_impl->operations, env); hi;
+                 hi = axis2_hash_next ( env, hi))
+        {
+            struct axis2_operation *operation = NULL;
+            axis2_hash_this (hi, NULL, NULL, &val);
+            operation = (struct axis2_operation *) val;
+            if (operation)
+                AXIS2_OPERATION_FREE (operation, env);
+            
+            val = NULL;
+            operation = NULL;
+               
+        }
+        axis2_hash_free(module_desc_impl->operations, env);
+        module_desc_impl->operations = NULL;
+    }
     
-    AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(module_desc));
+    if(module_desc_impl)
+        AXIS2_FREE((*env)->allocator, module_desc_impl);
+    module_desc_impl = NULL;
     
     return AXIS2_SUCCESS;
 }
@@ -363,10 +399,20 @@
                                 axis2_env_t **env,
                                 axis2_qname_t *qname)
 {
+    axis2_module_desc_impl_t *module_desc_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(module_desc, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, qname, AXIS2_FAILURE);
     
-    AXIS2_INTF_TO_IMPL(module_desc)->qname = qname;
+    module_desc_impl = AXIS2_INTF_TO_IMPL(module_desc);
+    if(module_desc_impl->qname)
+    {
+        AXIS2_QNAME_FREE(module_desc_impl->qname, env);
+        module_desc_impl->qname = NULL;
+    }
+    
+    module_desc_impl->qname = qname;
+    
     return AXIS2_SUCCESS;
 }
 
@@ -375,17 +421,26 @@
                                     axis2_env_t **env,
                                     axis2_operation_t *operation)
 {
+    axis2_module_desc_impl_t *module_desc_impl = NULL;
+    axis2_qname_t *optr_name = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(module_desc, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, operation, AXIS2_FAILURE);
     
-    if (NULL == (AXIS2_INTF_TO_IMPL(module_desc)->operations))
+    module_desc_impl = AXIS2_INTF_TO_IMPL(module_desc);
+    if (NULL == (module_desc_impl->operations))
 	{                    
-		AXIS2_INTF_TO_IMPL(module_desc)->operations = axis2_hash_make (env);
+		module_desc_impl->operations = axis2_hash_make (env);
 	}	
     
-    axis2_hash_set(AXIS2_INTF_TO_IMPL(module_desc)->operations, 
-        AXIS2_OPERATION_GET_NAME(operation, env), sizeof(axis2_qname_t),
-            operation);
+    optr_name = AXIS2_OPERATION_GET_NAME(operation, env);
+    if(NULL == optr_name)
+    {
+        return AXIS2_FAILURE;
+    }
+    
+    axis2_hash_set(module_desc_impl->operations, optr_name, sizeof(axis2_qname_t), 
+        operation);
     
     return AXIS2_SUCCESS;
 }
@@ -413,6 +468,7 @@
 {
     AXIS2_FUNC_PARAM_CHECK(module_desc, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, parent, AXIS2_FAILURE);
+    
     AXIS2_INTF_TO_IMPL(module_desc)->parent = parent;
     return AXIS2_SUCCESS;
 }
@@ -424,16 +480,21 @@
 {
     axis2_char_t *param_name_l = NULL;
     axis2_status_t ret_status = AXIS2_FAILURE;
+    
     AXIS2_FUNC_PARAM_CHECK(module_desc, env, AXIS2_FAILURE);
     
     param_name_l = AXIS2_PARAM_GET_NAME(param, env);
     if(NULL == param_name_l)
+    {
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_INVALID_STATE_PARAM, 
             AXIS2_FAILURE);
+        return AXIS2_FAILURE;
+    }
     if(AXIS2_TRUE == axis2_module_desc_is_param_locked(module_desc, env, param_name_l))
     {
         AXIS2_ERROR_SET((*env)->error, 
             AXIS2_ERROR_PARAMETER_LOCKED_CANNOT_OVERRIDE, AXIS2_FAILURE);
+        return AXIS2_FAILURE;
     }
     else
     {        
@@ -445,7 +506,7 @@
 axis2_param_t * AXIS2_CALL
 axis2_module_desc_get_param(axis2_module_desc_t *module_desc,
                                     axis2_env_t **env,
-                                    const axis2_char_t *name)
+                                    axis2_char_t *name)
 {
     AXIS2_FUNC_PARAM_CHECK(module_desc, env, NULL);
     AXIS2_PARAM_CHECK((*env)->error, name, NULL);
@@ -465,20 +526,24 @@
 axis2_bool_t AXIS2_CALL
 axis2_module_desc_is_param_locked (axis2_module_desc_t *module_desc,
                                     axis2_env_t **env,
-                                    const axis2_char_t *param_name)
+                                    axis2_char_t *param_name)
 {
+    axis2_module_desc_impl_t *module_desc_impl = NULL;
     axis2_bool_t locked = AXIS2_FALSE;
     axis2_bool_t ret_state = AXIS2_FALSE;
     axis2_param_t *param_l = NULL;
-    AXIS2_FUNC_PARAM_CHECK(module_desc, env, AXIS2_FALSE);
-    
     
+    AXIS2_FUNC_PARAM_CHECK(module_desc, env, AXIS2_FALSE);
     AXIS2_PARAM_CHECK((*env)->error, param_name, AXIS2_FALSE);
     
+    module_desc_impl = AXIS2_INTF_TO_IMPL(module_desc);
     /* checking the locked value of parent*/
-    if(NULL != AXIS2_INTF_TO_IMPL(module_desc)->parent)
-        locked = AXIS2_ENGINE_CONFIG_IS_PARAM_LOCKED(AXIS2_INTF_TO_IMPL(
-                    module_desc)->parent, env, param_name);
+    if(NULL == module_desc_impl->parent)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_INVALID_STATE_MODULE_DESC, AXIS2_FALSE);
+        return AXIS2_FALSE;
+    }
+    locked = AXIS2_ENGINE_CONFIG_IS_PARAM_LOCKED(module_desc_impl->parent, env, param_name);
     
     if(AXIS2_TRUE == locked)
     {

Modified: webservices/axis2/trunk/c/modules/core/description/src/operation.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/operation.c?rev=356124&r1=356123&r2=356124&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/operation.c (original)
+++ webservices/axis2/trunk/c/modules/core/description/src/operation.c Sun Dec 11 19:13:55 2005
@@ -53,7 +53,7 @@
 axis2_param_t * AXIS2_CALL
 axis2_operation_get_param (axis2_operation_t *operation, 
                             axis2_env_t **env,
-                            const axis2_char_t *name);
+                            axis2_char_t *name);
 
 axis2_array_list_t * AXIS2_CALL
 axis2_operation_get_params (axis2_operation_t *operation, 
@@ -62,7 +62,7 @@
 axis2_bool_t AXIS2_CALL
 axis2_operation_is_param_locked(axis2_operation_t *operation, 
                                     axis2_env_t **env
-    ,                               const axis2_char_t *param_name);
+    ,                               axis2_char_t *param_name);
 
 axis2_status_t AXIS2_CALL
 axis2_operation_set_parent (axis2_operation_t *operation, 
@@ -277,51 +277,92 @@
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
 	}
     
+    operation_impl->parent = NULL;
+	operation_impl->msg_recv = NULL;
+    operation_impl->mep = MEP_CONSTANT_INVALID;
+    operation_impl->operation.param_container = NULL;
+    operation_impl->operation.wsdl_operation = NULL;
+    operation_impl->remaining_phases_inflow = NULL;
+    operation_impl->phases_outflow = NULL;
+    operation_impl->phases_in_fault_flow = NULL;
+    operation_impl->phases_out_fault_flow = NULL;
+    operation_impl->modulerefs = NULL;
+    operation_impl->operation.ops = NULL;
+    
     operation_impl->operation.param_container = (axis2_param_container_t *)
 		axis2_param_container_create(env);		
 	if(NULL == operation_impl->operation.param_container)
 	{
-        AXIS2_FREE((*env)->allocator, operation_impl);
-        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);		
+        axis2_operation_free(&(operation_impl->operation), env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);	
+        return NULL;        
 	}
 
 	operation_impl->operation.wsdl_operation = (axis2_wsdl_operation_t *)
 		axis2_wsdl_operation_create(env);		
 	if(NULL == operation_impl->operation.wsdl_operation)
 	{
-        AXIS2_PARAM_CONTAINER_FREE(operation_impl->operation.param_container, env);
-        AXIS2_FREE((*env)->allocator, operation_impl);
-        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);		
+        axis2_operation_free(&(operation_impl->operation), env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;		
 	}
 
     operation_impl->remaining_phases_inflow = axis2_array_list_create(env, 0);
     if(NULL == operation_impl->remaining_phases_inflow)
+    {
         axis2_operation_free(&(operation_impl->operation), env);
+        return NULL;
+    }
     
     operation_impl->phases_outflow = axis2_array_list_create(env, 0);
     if(NULL == operation_impl->phases_outflow)
+    {
         axis2_operation_free(&(operation_impl->operation), env);
+        return NULL;
+    }
     
     operation_impl->phases_in_fault_flow = axis2_array_list_create(env, 0);
     if(NULL == operation_impl->phases_in_fault_flow)
+    {
         axis2_operation_free(&(operation_impl->operation), env);
+        return NULL;
+    }
     
     operation_impl->modulerefs = axis2_array_list_create(env, 0);
     if(NULL == operation_impl->modulerefs)
+    {
         axis2_operation_free(&(operation_impl->operation), env);
+        return NULL;
+    }
     
     operation_impl->phases_out_fault_flow = axis2_array_list_create(env, 0);
     if(NULL == operation_impl->phases_out_fault_flow)
+    {
         axis2_operation_free(&(operation_impl->operation), env);
+        return NULL;
+    }
+    
+    axis2_operation_set_msg_exchange_pattern(&(operation_impl->operation), env, 
+        (axis2_char_t *) MEP_URI_IN_OUT);
+    
+    param_container_l = axis2_param_container_create(env);
+    if(NULL == param_container_l)
+        return NULL;
+    AXIS2_WSDL_COMPONENT_SET_COMPONENT_PROPERTY(operation_impl->operation.wsdl_operation->
+        extensible_component->wsdl_component, env, PARAMETER_KEY, param_container_l);
+    
+    array_list_l = axis2_array_list_create(env, 0);
+    if(NULL == array_list_l) return NULL;
+    AXIS2_WSDL_COMPONENT_SET_COMPONENT_PROPERTY(operation_impl->operation.wsdl_operation->
+        extensible_component->wsdl_component, env, MODULEREF_KEY, array_list_l);
     
     operation_impl->operation.ops = AXIS2_MALLOC((*env)->allocator, 
         sizeof(axis2_operation_ops_t));
 	if(NULL == operation_impl->operation.ops)
 	{
-        AXIS2_PARAM_CONTAINER_FREE(operation_impl->operation.param_container, env);
-        AXIS2_WSDL_OPERATION_FREE(operation_impl->operation.wsdl_operation, env);
-        AXIS2_FREE((*env)->allocator, operation_impl);
+        axis2_operation_free(&(operation_impl->operation), env);
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
 	}
 	
 	operation_impl->operation.ops->free = axis2_operation_free;
@@ -330,10 +371,8 @@
 	operation_impl->operation.ops->get_params = axis2_operation_get_params;
 	operation_impl->operation.ops->set_parent = axis2_operation_set_parent;
 	operation_impl->operation.ops->get_parent = axis2_operation_get_parent;
-  
 	operation_impl->operation.ops->set_msg_recv = axis2_operation_set_msg_recv;
 	operation_impl->operation.ops->get_msg_recv = axis2_operation_get_msg_recv;
-    
     operation_impl->operation.ops->set_name = axis2_operation_set_name;
 	operation_impl->operation.ops->get_name = axis2_operation_get_name;
     
@@ -379,27 +418,6 @@
     operation_impl->operation.ops->add_property = axis2_operation_add_property;
     operation_impl->operation.ops->get_Properties = axis2_operation_get_Properties;
     operation_impl->operation.ops->set_wsdl_opeartion = axis2_operation_set_wsdl_opeartion;
-
-
-	operation_impl->parent = NULL;
-	
-	operation_impl->msg_recv = NULL;
-    
-    operation_impl->mep = MEP_CONSTANT_INVALID;
-    
-    axis2_operation_set_msg_exchange_pattern(&(operation_impl->operation), env, 
-        (axis2_char_t *) AXIS2_STRDUP(MEP_URI_IN_OUT, env));
-    
-    param_container_l = axis2_param_container_create(env);
-    if(NULL == param_container_l)
-        return NULL;
-    AXIS2_WSDL_COMPONENT_SET_COMPONENT_PROPERTY(operation_impl->operation.wsdl_operation->
-        extensible_component->wsdl_component, env, PARAMETER_KEY, param_container_l);
-    
-    array_list_l = axis2_array_list_create(env, 0);
-    if(NULL == array_list_l) return NULL;
-    AXIS2_WSDL_COMPONENT_SET_COMPONENT_PROPERTY(operation_impl->operation.wsdl_operation->
-        extensible_component->wsdl_component, env, MODULEREF_KEY, array_list_l);
 						
 	return &(operation_impl->operation);
 }
@@ -407,17 +425,27 @@
 axis2_operation_t * AXIS2_CALL
 axis2_operation_create_with_name (axis2_env_t **env, axis2_qname_t *qname)
 {
-	axis2_operation_impl_t *operation_impl = 
-        AXIS2_INTF_TO_IMPL(axis2_operation_create(env));
+	axis2_operation_impl_t *operation_impl = NULL;
+    axis2_status_t status = AXIS2_FAILURE;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_PARAM_CHECK((*env)->error, qname, AXIS2_FAILURE);	
+    
+    operation_impl = AXIS2_INTF_TO_IMPL(axis2_operation_create(env));
     
 	if(NULL == operation_impl)
 	{
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
 	}
     
-    AXIS2_PARAM_CHECK((*env)->error, qname, AXIS2_FAILURE);	
-	axis2_operation_set_name(&(operation_impl->operation), env, qname);
-       
+    
+	status = axis2_operation_set_name(&(operation_impl->operation), env, qname);
+    if(AXIS2_FAILURE == status)
+    {
+        axis2_operation_free(&(operation_impl->operation), env);
+        return NULL;
+    }
 	return &(operation_impl->operation);	
 }
 
@@ -425,17 +453,22 @@
 axis2_operation_create_with_wsdl_operation (axis2_env_t **env, 
                                             axis2_wsdl_operation_t *wsdl_operation)
 {
-	axis2_operation_impl_t *operation_impl = 
-        AXIS2_INTF_TO_IMPL(axis2_operation_create(env));
+	axis2_operation_impl_t *operation_impl = NULL;
+    
+    AXIS2_PARAM_CHECK((*env)->error, wsdl_operation, NULL);
+    
+    operation_impl = AXIS2_INTF_TO_IMPL(axis2_operation_create(env));
     
 	if(NULL == operation_impl)
 	{
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
 	}
-    
-    AXIS2_PARAM_CHECK((*env)->error, wsdl_operation, NULL);	
+   
 	if(NULL != operation_impl->operation.wsdl_operation)
+    {
         AXIS2_WSDL_OPERATION_FREE(operation_impl->operation.wsdl_operation, env);
+    }
     operation_impl->operation.wsdl_operation = wsdl_operation;
        
 	return &(operation_impl->operation);	
@@ -446,45 +479,145 @@
 axis2_status_t AXIS2_CALL 
 axis2_operation_free (axis2_operation_t *operation, axis2_env_t **env)
 { 
+    axis2_operation_impl_t *operation_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(operation, env, AXIS2_FAILURE);
     
+    operation_impl = AXIS2_INTF_TO_IMPL(operation);
+    
 	if(NULL != operation->ops)
+    {
 		AXIS2_FREE((*env)->allocator, operation->ops);
+        operation->ops = NULL;
+    }
     
     if(NULL != operation->param_container)
-	    AXIS2_PARAM_CONTAINER_FREE(operation->param_container
-        , env);
+    {
+	    AXIS2_PARAM_CONTAINER_FREE(operation->param_container, env);
+        operation->param_container = NULL;
+    }
     
     if(NULL != operation->wsdl_operation)
-	    AXIS2_WSDL_OPERATION_FREE(operation->wsdl_operation
-        , env);
+    {
+	    AXIS2_WSDL_OPERATION_FREE(operation->wsdl_operation, env);
+        operation->wsdl_operation = NULL;
+    }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(operation)->parent)
-	    AXIS2_SVC_FREE(AXIS2_INTF_TO_IMPL(operation)->parent, env);
+    operation_impl->parent = NULL;
     
-    if(NULL != AXIS2_INTF_TO_IMPL(operation)->msg_recv)
-	    AXIS2_MSG_RECV_FREE(AXIS2_INTF_TO_IMPL(operation)->msg_recv, env);
+    operation_impl->msg_recv = NULL;
     
-    if(NULL != AXIS2_INTF_TO_IMPL(operation)->remaining_phases_inflow)
-        AXIS2_ARRAY_LIST_FREE(AXIS2_INTF_TO_IMPL(operation)->remaining_phases_inflow,
-            env);
+    if(NULL != operation_impl->remaining_phases_inflow)
+    {
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(operation_impl->remaining_phases_inflow, env); i++)
+        {
+            struct axis2_phase *phase = NULL;
+            phase = AXIS2_ARRAY_LIST_GET(operation_impl->remaining_phases_inflow, env, i);
+            
+            phase = (struct axis2_phase *) val;
+            if (phase)
+               AXIS2_PHASE_FREE (phase, env);
+            
+            val = NULL;
+            phase = NULL;
+               
+        }
+        AXIS2_ARRAY_LIST_FREE(operation_impl->remaining_phases_inflow, env);
+        operation_impl->remaining_phases_inflow = NULL;
+    }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(operation)->phases_outflow)
-        AXIS2_ARRAY_LIST_FREE(AXIS2_INTF_TO_IMPL(operation)->phases_outflow,
-            env);
+    if(NULL != operation_impl->phases_outflow)
+    {
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(operation_impl->phases_outflow, env); i++)
+        {
+            struct axis2_phase *phase = NULL;
+            phase = AXIS2_ARRAY_LIST_GET(operation_impl->phases_outflow, env, i);
+            
+            phase = (struct axis2_phase *) val;
+            if (phase)
+               AXIS2_PHASE_FREE (phase, env);
+            
+            val = NULL;
+            phase = NULL;
+               
+        }
+        AXIS2_ARRAY_LIST_FREE(operation_impl->phases_outflow, env);
+        operation_impl->phases_outflow = NULL;
+    }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(operation)->phases_in_fault_flow)
-        AXIS2_ARRAY_LIST_FREE(AXIS2_INTF_TO_IMPL(operation)->phases_in_fault_flow,
-            env);
+    if(NULL != operation_impl->phases_in_fault_flow)
+    {
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(operation_impl->phases_in_fault_flow, env); i++)
+        {
+            struct axis2_phase *phase = NULL;
+            phase = AXIS2_ARRAY_LIST_GET(operation_impl->phases_in_fault_flow, env, i);
+            
+            phase = (struct axis2_phase *) val;
+            if (phase)
+               AXIS2_PHASE_FREE (phase, env);
+            
+            val = NULL;
+            phase = NULL;
+               
+        }
+        AXIS2_ARRAY_LIST_FREE(operation_impl->phases_in_fault_flow, env);
+        operation_impl->phases_in_fault_flow = NULL;
+    }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(operation)->phases_out_fault_flow)
-        AXIS2_ARRAY_LIST_FREE(AXIS2_INTF_TO_IMPL(operation)->phases_out_fault_flow,
+    if(NULL != operation_impl->phases_out_fault_flow)
+    {
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(operation_impl->phases_out_fault_flow, env); i++)
+        {
+            struct axis2_phase *phase = NULL;
+            phase = AXIS2_ARRAY_LIST_GET(operation_impl->phases_out_fault_flow, env, i);
+            
+            phase = (struct axis2_phase *) val;
+            if (phase)
+               AXIS2_PHASE_FREE (phase, env);
+            
+            val = NULL;
+            phase = NULL;
+               
+        }
+        AXIS2_ARRAY_LIST_FREE(operation_impl->phases_out_fault_flow,
             env);
+        operation_impl->phases_out_fault_flow = NULL;
+    }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(operation)->modulerefs)
-        AXIS2_ARRAY_LIST_FREE(AXIS2_INTF_TO_IMPL(operation)->modulerefs, env);
-        
-    AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(operation));
+    if(NULL != operation_impl->modulerefs)
+    {
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(operation_impl->modulerefs, env); i++)
+        {
+            axis2_qname_t *module_ref = NULL;
+            module_ref = AXIS2_ARRAY_LIST_GET(operation_impl->modulerefs, env, i);
+            
+            module_ref = (axis2_qname_t *) val;
+            if (module_ref)
+               AXIS2_QNAME_FREE (module_ref, env);
+            
+            val = NULL;
+            module_ref = NULL;
+               
+        }
+        AXIS2_ARRAY_LIST_FREE(operation_impl->modulerefs, env);
+        operation_impl->modulerefs = NULL;
+    }
+    
+    if(operation_impl)    
+    {
+        AXIS2_FREE((*env)->allocator, operation_impl);
+        operation_impl = NULL;
+    }
     
     return AXIS2_SUCCESS;
 }	
@@ -503,6 +636,7 @@
     {
         AXIS2_ERROR_SET((*env)->error, 
             AXIS2_ERROR_PARAMETER_LOCKED_CANNOT_OVERRIDE, AXIS2_FAILURE);
+        return AXIS2_FAILURE;
     }
     else
     {
@@ -519,7 +653,7 @@
 axis2_param_t * AXIS2_CALL
 axis2_operation_get_param (axis2_operation_t *operation, 
                                 axis2_env_t **env,
-		                        const axis2_char_t *param_name)
+		                        axis2_char_t *param_name)
 {
     axis2_param_container_t *param_container_l = NULL;
 	AXIS2_FUNC_PARAM_CHECK(operation, env, AXIS2_FALSE);
@@ -550,18 +684,15 @@
 axis2_bool_t AXIS2_CALL 
 axis2_operation_is_param_locked(axis2_operation_t *operation, 
                                     axis2_env_t **env,
-		                            const axis2_char_t *param_name)
+		                            axis2_char_t *param_name)
 {
     axis2_svc_t *parent_l = NULL;
     axis2_param_t *param_l = NULL;
+    axis2_bool_t locked = AXIS2_FALSE;
+    
     AXIS2_FUNC_PARAM_CHECK(operation, env, AXIS2_FALSE);
-    if(operation->param_container)
-        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_INVALID_STATE_OPERATION, 
-            AXIS2_FALSE);
-	
     AXIS2_PARAM_CHECK((*env)->error, param_name, AXIS2_FALSE);
-	
-    axis2_bool_t locked = AXIS2_FALSE;
+    
     /* checking the locked value of parent*/
     parent_l = axis2_operation_get_parent(operation, env);
     if(NULL != parent_l)
@@ -584,11 +715,17 @@
                                 axis2_env_t **env,
 		                        axis2_svc_t *svc)
 {
+    axis2_operation_impl_t *operation_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(operation, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, svc, AXIS2_FAILURE);
-    axis2_operation_impl_t *operation_impl = AXIS2_INTF_TO_IMPL(operation);
+    
+    operation_impl = AXIS2_INTF_TO_IMPL(operation);
+    
     if(operation_impl->parent)
-        AXIS2_SVC_FREE(operation_impl->parent, env);
+    {
+        operation_impl->parent = NULL;
+    }
     operation_impl->parent = svc;
 	return AXIS2_SUCCESS;
 }
@@ -598,6 +735,7 @@
                                 axis2_env_t **env)
 {           
 	AXIS2_FUNC_PARAM_CHECK(operation, env, NULL);
+    
 	return AXIS2_INTF_TO_IMPL(operation)->parent;
 }
 
@@ -606,11 +744,17 @@
                                 axis2_env_t **env,
 		                        struct axis2_msg_recv *msg_recv)
 {
+    axis2_operation_impl_t *operation_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(operation, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, msg_recv, AXIS2_FAILURE);
-    axis2_operation_impl_t *operation_impl = AXIS2_INTF_TO_IMPL(operation);
+    
+    operation_impl = AXIS2_INTF_TO_IMPL(operation);
+    
     if(operation_impl->msg_recv)
-        AXIS2_MSG_RECV_FREE(operation_impl->msg_recv, env);
+    {
+        operation_impl->msg_recv = NULL;
+    }
     
 	operation_impl->msg_recv = msg_recv;
 	
@@ -694,8 +838,11 @@
 {
     int index = 0;
     int size = 0;
+    axis2_status_t status = AXIS2_FAILURE;
     axis2_array_list_t *collection_module = NULL;
     struct axis2_module_desc *module_desc = NULL;
+    struct axis2_phase_resolver *pr = NULL;
+        
     AXIS2_FUNC_PARAM_CHECK(operation, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, moduleref, AXIS2_FAILURE);
     
@@ -704,18 +851,45 @@
         extensible_component->wsdl_component, env, MODULEREF_KEY);
     
     size = AXIS2_ARRAY_LIST_SIZE(collection_module, env);
+    if(AXIS2_TRUE != size)
+    {
+        return AXIS2_FAILURE;
+    }
     for(index = 0; index < size; index++)
     {
         module_desc = (axis2_module_desc_t *) AXIS2_ARRAY_LIST_GET(
             collection_module, env, index);
-        
+        if(!module_desc)
+        {
+            return AXIS2_FAILURE;
+        }
         if(AXIS2_QNAME_EQUALS(AXIS2_MODULE_DESC_GET_NAME(module_desc, env), env,
                 AXIS2_MODULE_DESC_GET_NAME(moduleref, env)))
+        {
             AXIS2_ERROR_SET((*env)->error, 
                 AXIS2_ERROR_MODULE_ALREADY_ENGAGED_TO_OPERATION, AXIS2_FAILURE);
+            return AXIS2_FAILURE;
+        }
 
     }
-    /*    new PhaseResolver().engageModuleToOperation(this, moduleref);*/
+    pr = axis2_phase_resolver_create(env);
+    if(pr)
+    {
+        status = AXIS2_PHASE_RESOLVER_ENGAGE_MODULE_TO_OPERATION(pr, env, 
+            operation, moduleref);
+        if(AXIS2_FAILURE == status)
+        {
+            AXIS2_PHASE_RESOLVER_FREE(pr, env);
+            pr = NULL;
+            return AXIS2_FAILURE;
+        }
+    }
+    else
+    {
+        return AXIS2_FAILURE;
+    }
+    AXIS2_PHASE_RESOLVER_FREE(pr, env);
+    pr = NULL;
     return AXIS2_ARRAY_LIST_ADD(collection_module, env, moduleref);
 }
 
@@ -728,6 +902,7 @@
     axis2_module_desc_t *module_desc = NULL;
     int size = 0;
     int index = 0;
+    
     AXIS2_FUNC_PARAM_CHECK(operation, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, module_name, AXIS2_FAILURE);
     
@@ -736,6 +911,10 @@
             extensible_component->wsdl_component, env, MODULEREF_KEY);
     
     size = AXIS2_ARRAY_LIST_SIZE(collection_module, env);
+    if(AXIS2_TRUE != size)
+    {
+        return AXIS2_FAILURE;
+    }
     for(index = 0; index < size; index++)
     {
         module_desc = (axis2_module_desc_t *) AXIS2_ARRAY_LIST_GET(
@@ -743,8 +922,11 @@
         
         if(AXIS2_QNAME_EQUALS(AXIS2_MODULE_DESC_GET_NAME(module_desc, env), env,
                 AXIS2_MODULE_DESC_GET_NAME(module_name, env)))
+        {
             AXIS2_ERROR_SET((*env)->error, 
                 AXIS2_ERROR_MODULE_ALREADY_ENGAGED_TO_OPERATION, AXIS2_FAILURE);
+            return AXIS2_FAILURE;
+        }
 
     }
     return AXIS2_ARRAY_LIST_ADD(collection_module, env, module_name);
@@ -764,15 +946,19 @@
 axis2_operation_get_axis_specific_MEP_constant(axis2_operation_t *operation,
                                                 axis2_env_t **env) 
 {
+    axis2_operation_impl_t *operation_impl = NULL;
+    int temp = 0;
+    
     AXIS2_FUNC_PARAM_CHECK(operation, env, AXIS2_FAILURE);
-    axis2_operation_impl_t *operation_impl = AXIS2_INTF_TO_IMPL(operation);
+    
+    operation_impl = AXIS2_INTF_TO_IMPL(operation);
     
     if (operation_impl->mep != MEP_CONSTANT_INVALID) 
     {
         return operation_impl->mep;
     }
 
-    int temp = MEP_CONSTANT_INVALID;
+    temp = MEP_CONSTANT_INVALID;
 
     if (AXIS2_STRCMP(MEP_URI_IN_OUT, 
             axis2_operation_get_msg_exchange_pattern(operation, env))) 
@@ -819,6 +1005,7 @@
     {
         AXIS2_ERROR_SET((*env)->error, 
             AXIS2_ERROR_COULD_NOT_MAP_MEP_URI_TO_MEP_CONSTANT, AXIS2_FAILURE);
+        return AXIS2_FAILURE;
     }
     operation_impl->mep = temp;
     return operation_impl->mep;
@@ -865,11 +1052,33 @@
                                             axis2_env_t **env,
                                             axis2_array_list_t *list) 
 {
+    axis2_operation_impl_t *operation_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(operation, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, list, AXIS2_FAILURE);
-    axis2_operation_impl_t *operation_impl = AXIS2_INTF_TO_IMPL(operation);
+    
+    operation_impl = AXIS2_INTF_TO_IMPL(operation);
+    
     if(operation_impl->phases_in_fault_flow)
-       AXIS2_WSDL_OPERATION_FREE(operation_impl->phases_in_fault_flow, env);
+    {
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(operation_impl->phases_in_fault_flow, env); i++)
+        {
+            struct axis2_phase *phase = NULL;
+            phase = AXIS2_ARRAY_LIST_GET(operation_impl->phases_in_fault_flow, env, i);
+            
+            phase = (struct axis2_phase *) val;
+            if (phase)
+               AXIS2_PHASE_FREE (phase, env);
+            
+            val = NULL;
+            phase = NULL;
+               
+        }
+        AXIS2_WSDL_OPERATION_FREE(operation_impl->phases_in_fault_flow, env);
+        operation_impl->phases_in_fault_flow = NULL;
+    }
     
     operation_impl->phases_in_fault_flow = list;
     return AXIS2_SUCCESS;
@@ -884,7 +1093,25 @@
     AXIS2_PARAM_CHECK((*env)->error, list, AXIS2_FAILURE);
     axis2_operation_impl_t *operation_impl = AXIS2_INTF_TO_IMPL(operation);
     if(operation_impl->phases_out_fault_flow)
-       AXIS2_WSDL_OPERATION_FREE(operation_impl->phases_out_fault_flow, env);
+    {
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(operation_impl->phases_out_fault_flow, env); i++)
+        {
+            struct axis2_phase *phase = NULL;
+            phase = AXIS2_ARRAY_LIST_GET(operation_impl->phases_out_fault_flow, env, i);
+            
+            phase = (struct axis2_phase *) val;
+            if (phase)
+               AXIS2_PHASE_FREE (phase, env);
+            
+            val = NULL;
+            phase = NULL;
+               
+        }
+        AXIS2_WSDL_OPERATION_FREE(operation_impl->phases_out_fault_flow, env);
+        operation_impl->phases_out_fault_flow = NULL;
+    }
     
     operation_impl->phases_out_fault_flow = list;
     return AXIS2_SUCCESS;
@@ -899,7 +1126,25 @@
     AXIS2_PARAM_CHECK((*env)->error, list, AXIS2_FAILURE);
     axis2_operation_impl_t *operation_impl = AXIS2_INTF_TO_IMPL(operation);
     if(operation_impl->phases_outflow)
-       AXIS2_WSDL_OPERATION_FREE(operation_impl->phases_outflow, env);
+    {
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(operation_impl->phases_outflow, env); i++)
+        {
+            struct axis2_phase *phase = NULL;
+            phase = AXIS2_ARRAY_LIST_GET(operation_impl->phases_outflow, env, i);
+            
+            phase = (struct axis2_phase *) val;
+            if (phase)
+               AXIS2_PHASE_FREE (phase, env);
+            
+            val = NULL;
+            phase = NULL;
+               
+        }
+        AXIS2_WSDL_OPERATION_FREE(operation_impl->phases_outflow, env);
+        operation_impl->phases_outflow = NULL;
+    }
     
     operation_impl->phases_outflow = list;
     return AXIS2_SUCCESS;
@@ -912,9 +1157,28 @@
 {
     AXIS2_FUNC_PARAM_CHECK(operation, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, list, AXIS2_FAILURE);
+    
     axis2_operation_impl_t *operation_impl = AXIS2_INTF_TO_IMPL(operation);
     if(operation_impl->remaining_phases_inflow)
-       AXIS2_LINKED_LIST_FREE(operation_impl->remaining_phases_inflow, env);
+    {
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(operation_impl->remaining_phases_inflow, env); i++)
+        {
+            struct axis2_phase *phase = NULL;
+            phase = AXIS2_ARRAY_LIST_GET(operation_impl->remaining_phases_inflow, env, i);
+            
+            phase = (struct axis2_phase *) val;
+            if (phase)
+               AXIS2_PHASE_FREE (phase, env);
+            
+            val = NULL;
+            phase = NULL;
+               
+        }
+        AXIS2_ARRAY_LIST_FREE(operation_impl->remaining_phases_inflow, env);
+        operation_impl->remaining_phases_inflow = NULL;
+    }
     operation_impl->remaining_phases_inflow = list;
     return AXIS2_SUCCESS;
 }
@@ -924,9 +1188,13 @@
                                 axis2_env_t **env,
                                 axis2_qname_t *module_name) 
 {
+    axis2_operation_impl_t *operation_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(operation, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, module_name, AXIS2_FAILURE);
-    axis2_operation_impl_t *operation_impl = AXIS2_INTF_TO_IMPL(operation);
+    
+    operation_impl = AXIS2_INTF_TO_IMPL(operation);
+    
     return AXIS2_ARRAY_LIST_ADD(operation_impl->modulerefs, env, module_name);
 }
 
@@ -1113,7 +1381,10 @@
     AXIS2_PARAM_CHECK((*env)->error, wsdl_operation, AXIS2_FAILURE);
     
     if(operation->wsdl_operation)
-       AXIS2_WSDL_OPERATION_FREE(operation->wsdl_operation, env);
+    {
+        AXIS2_WSDL_OPERATION_FREE(operation->wsdl_operation, env);
+        operation->wsdl_operation = NULL;
+    }
     
     operation->wsdl_operation = wsdl_operation;
     return AXIS2_SUCCESS;

Modified: webservices/axis2/trunk/c/modules/core/description/src/svc.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/svc.c?rev=356124&r1=356123&r2=356124&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/svc.c (original)
+++ webservices/axis2/trunk/c/modules/core/description/src/svc.c Sun Dec 11 19:13:55 2005
@@ -14,7 +14,7 @@
     axis2_char_t *axis2_svc_name; 
     /** to keep the time that last update time of the service */
     long last_update;
-    axis2_char_t * filename;
+    axis2_char_t *filename;
     struct axis2_wsdl_svc *service_impl;
     /** to store module ref at deploy time parsing */
     axis2_array_list_t *module_list;    
@@ -76,7 +76,7 @@
 axis2_bool_t AXIS2_CALL
 axis2_svc_is_param_locked (axis2_svc_t *svc, 
                             axis2_env_t **env,
-		                    const axis2_char_t *param_name);
+		                    axis2_char_t *param_name);
 
 axis2_status_t AXIS2_CALL
 axis2_svc_set_svc_interface(axis2_svc_t *svc,
@@ -234,7 +234,16 @@
                             axis2_env_t **env,
                             axis2_char_t * mapping_key , 
                             struct axis2_operation * axis2_opt);
-                            
+ 
+axis2_status_t AXIS2_CALL
+axis2_svc_add_module_ref(axis2_svc_t *svc,
+                            axis2_env_t **env,
+                            axis2_qname_t *moduleref);
+
+axis2_array_list_t *AXIS2_CALL
+axis2_svc_get_modules(axis2_svc_t *svc,
+                        axis2_env_t **env);
+
 /************************* End of function headers ***************************/
 
 axis2_svc_t * AXIS2_CALL
@@ -244,6 +253,7 @@
     axis2_array_list_t *array_list_l = NULL;
     struct axis2_param_container *param_container_l = NULL;
     struct axis2_wsdl_interface *wsdl_interface_l = NULL;
+    axis2_status_t status = AXIS2_FAILURE;
     
     AXIS2_ENV_CHECK(env, NULL);
 	svc_impl = (axis2_svc_impl_t *)
@@ -267,7 +277,8 @@
 	if(NULL == svc_impl->svc.param_container)
 	{
         axis2_svc_free(&(svc_impl->svc), env);
-        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);		
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;		
 	}
     
     svc_impl->svc.flow_container = (struct axis2_flow_container *)
@@ -276,6 +287,7 @@
 	{
         axis2_svc_free(&(svc_impl->svc), env);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);		
+        return NULL;
 	}
     
     
@@ -284,6 +296,7 @@
 	{
         axis2_svc_free(&(svc_impl->svc), env);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);		
+        return NULL;
 	}
     
     svc_impl->wasaction_opeartionmap = axis2_hash_make (env);				
@@ -291,6 +304,7 @@
 	{
         axis2_svc_free(&(svc_impl->svc), env);
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);		
+        return NULL;
 	}
     
     /** Create modle list of default size */
@@ -299,6 +313,7 @@
     {
         axis2_svc_free(&(svc_impl->svc), env);
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }
     
     svc_impl->svc.ops = AXIS2_MALLOC((*env)->allocator, sizeof(axis2_svc_ops_t));
@@ -306,7 +321,52 @@
 	{
         axis2_svc_free(&(svc_impl->svc), env);
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
 	}
+
+
+    wsdl_interface_l = axis2_wsdl_interface_create(env);
+    if(NULL == wsdl_interface_l)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
+    }
+    status = axis2_svc_set_svc_interface(&(svc_impl->svc), env, wsdl_interface_l); 
+    if(AXIS2_FAILURE == status)
+    {
+        axis2_svc_free(&(svc_impl->svc), env);
+        return NULL;
+    }
+    
+    param_container_l = axis2_param_container_create(env);
+    if(NULL == param_container_l)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
+    }
+    
+    status = AXIS2_WSDL_COMPONENT_SET_COMPONENT_PROPERTY(svc_impl->svc.wsdl_svc->
+        wsdl_component, env, PARAMETER_KEY, param_container_l);
+    if(AXIS2_FAILURE == status)
+    {
+        axis2_svc_free(&(svc_impl->svc), env);
+        return NULL;
+    }
+    
+    array_list_l = axis2_array_list_create(env, 0);
+    if(NULL == array_list_l)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
+    }
+    
+    status = AXIS2_WSDL_COMPONENT_SET_COMPONENT_PROPERTY(svc_impl->svc.wsdl_svc->
+        wsdl_component, env, MODULEREF_KEY, array_list_l);
+    if(AXIS2_FAILURE == status)
+    {
+        axis2_svc_free(&(svc_impl->svc), env);
+        return NULL;
+    }
     
 	svc_impl->svc.ops->free = axis2_svc_free;
 	svc_impl->svc.ops->add_operation = axis2_svc_add_operation;
@@ -387,26 +447,11 @@
     svc_impl->svc.ops->get_namespace = axis2_svc_get_namespace;
     
     svc_impl->svc.ops->add_mapping = axis2_svc_add_mapping;
-
-       
-    wsdl_interface_l = axis2_wsdl_interface_create(env);
-    if(NULL == wsdl_interface_l)
-        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
-    axis2_svc_set_svc_interface(&(svc_impl->svc), env, wsdl_interface_l); 
     
-    param_container_l = axis2_param_container_create(env);
-    if(NULL == param_container_l)
-       AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
-    
-    AXIS2_WSDL_COMPONENT_SET_COMPONENT_PROPERTY(svc_impl->svc.wsdl_svc->
-        wsdl_component, env, PARAMETER_KEY, param_container_l);
+    svc_impl->svc.ops->add_module_ref = axis2_svc_add_module_ref;
     
-    array_list_l = axis2_array_list_create(env, 0);
-    if(NULL == array_list_l)
-        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
-    
-    AXIS2_WSDL_COMPONENT_SET_COMPONENT_PROPERTY(svc_impl->svc.wsdl_svc->
-        wsdl_component, env, MODULEREF_KEY, array_list_l);
+    svc_impl->svc.ops->get_modules = axis2_svc_get_modules;
+
 	return &(svc_impl->svc);	
 }
 
@@ -414,14 +459,24 @@
 axis2_svc_create_with_qname (axis2_env_t **env, 
                                 axis2_qname_t *qname)
 {
+    axis2_svc_impl_t *svc_impl = NULL;
+    axis2_status_t status = AXIS2_FAILURE;
+    
     AXIS2_PARAM_CHECK((*env)->error, qname, AXIS2_FAILURE);
-	axis2_svc_impl_t *svc_impl = AXIS2_INTF_TO_IMPL(axis2_svc_create(env));
+    
+	svc_impl = AXIS2_INTF_TO_IMPL(axis2_svc_create(env));
 	if(NULL == svc_impl)
 	{
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
 	}
     
-	axis2_svc_set_name(&(svc_impl->svc), env, qname);
+	status = axis2_svc_set_name(&(svc_impl->svc), env, qname);
+    if(AXIS2_FAILURE == status)
+    {
+        axis2_svc_free(&(svc_impl->svc), env);
+        return NULL;
+    }
 	
 	return &(svc_impl->svc);
 }
@@ -439,9 +494,13 @@
 	if(NULL == svc_impl)
 	{
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
 	}
-	if(NULL != svc_impl->svc.wsdl_svc)
+    if(NULL != svc_impl->svc.wsdl_svc)
+    {
         AXIS2_WSDL_SVC_FREE(svc_impl->svc.wsdl_svc, env);
+    }
+    
     svc_impl->svc.wsdl_svc = wsdl_svc;
        
 	return &(svc_impl->svc);	
@@ -453,7 +512,12 @@
 axis2_svc_free (axis2_svc_t *svc, 
                 axis2_env_t **env)
 {
+    axis2_svc_impl_t *svc_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(svc, env, AXIS2_FAILURE);
+    
+    svc_impl = AXIS2_INTF_TO_IMPL(svc);
+    
 	if(NULL != svc->ops)
 		AXIS2_FREE((*env)->allocator, svc->ops);
     
@@ -466,19 +530,54 @@
     if(NULL != svc->wsdl_svc)
 	    AXIS2_PARAM_CONTAINER_FREE(svc->wsdl_svc, env);
     
-    if(NULL != AXIS2_INTF_TO_IMPL(svc)->parent)
-	    AXIS2_SVC_GRP_FREE(AXIS2_INTF_TO_IMPL(svc)->parent, env);
+    svc_impl->parent = NULL;
     
-    if(NULL != AXIS2_INTF_TO_IMPL(svc)->wasaction_opeartionmap)
-		axis2_hash_free(AXIS2_INTF_TO_IMPL(svc)->wasaction_opeartionmap, env);
+    if(NULL != svc_impl->wasaction_opeartionmap)
+    {
+        axis2_hash_index_t *hi = NULL;
+        void *val = NULL;
+        for (hi = axis2_hash_first (svc_impl->wasaction_opeartionmap, env); hi;
+                 hi = axis2_hash_next ( env, hi))
+        {
+            struct axis2_operation *opt = NULL;
+            axis2_hash_this (hi, NULL, NULL, &val);
+            opt = (struct axis2_operation *) val;
+            if (opt)
+               AXIS2_OPERATION_FREE (opt, env);
+            
+            val = NULL;
+            opt = NULL;
+               
+        }
+		axis2_hash_free(svc_impl->wasaction_opeartionmap, env);
+        svc_impl->wasaction_opeartionmap = NULL;
+    }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(svc)->module_list)
-	    AXIS2_ARRAY_LIST_FREE(AXIS2_INTF_TO_IMPL(svc)->module_list, env);
+    if(NULL != svc_impl->module_list)
+    {
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(svc_impl->module_list, env); i++)
+        {
+            axis2_qname_t *qname = NULL;
+            qname = AXIS2_ARRAY_LIST_GET(svc_impl->module_list, env, i);
+            
+            qname = (axis2_qname_t *) val;
+            if (qname)
+               AXIS2_QNAME_FREE (qname, env);
+            
+            val = NULL;
+            qname = NULL;
+               
+        }
+	    AXIS2_ARRAY_LIST_FREE(svc_impl->module_list, env);
+        svc_impl->module_list = NULL;
+    }
 
-    if(NULL != AXIS2_INTF_TO_IMPL(svc)->axis2_svc_name)
-        AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(svc)->axis2_svc_name);        
+    if(NULL != svc_impl->axis2_svc_name)
+        AXIS2_FREE((*env)->allocator, svc_impl->axis2_svc_name);        
     
-	AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(svc));
+	AXIS2_FREE((*env)->allocator, svc_impl);
     
 	return AXIS2_SUCCESS;
 }
@@ -489,12 +588,18 @@
                             axis2_env_t **env,
 		                    struct axis2_operation *axis2_opt)
 {
+    axis2_status_t status = AXIS2_FAILURE;
+    
     AXIS2_FUNC_PARAM_CHECK(svc, env, AXIS2_FALSE);
     AXIS2_PARAM_CHECK((*env)->error, axis2_opt, AXIS2_FALSE);
     
-    AXIS2_OPERATION_SET_PARENT(axis2_opt, env, svc);
-    return AXIS2_WSDL_INTERFACE_SET_OPERATION(axis2_svc_get_svc_interface(svc, env),
-        env, axis2_opt);
+    status = AXIS2_OPERATION_SET_PARENT(axis2_opt, env, svc);
+    if(AXIS2_TRUE ==status)
+    {
+        status = AXIS2_WSDL_INTERFACE_SET_OPERATION(axis2_svc_get_svc_interface(svc, env),
+            env, axis2_opt, AXIS2_OPERATION);
+    }
+    return status;
 }
 
 struct axis2_operation * AXIS2_CALL
@@ -553,11 +658,13 @@
                         axis2_env_t **env,
 		                axis2_svc_grp_t *svc_grp)
 {
+    axis2_svc_impl_t *svc_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(svc, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, svc_grp, AXIS2_FAILURE);
-    axis2_svc_impl_t *svc_impl = AXIS2_INTF_TO_IMPL(svc);
-	if(svc_impl->parent)
-        AXIS2_SVC_GRP_FREE(svc_impl->parent, env);
+    
+    svc_impl = AXIS2_INTF_TO_IMPL(svc);
+    
 	svc_impl->parent = svc_grp;
     
 	return AXIS2_SUCCESS;
@@ -568,8 +675,6 @@
                         axis2_env_t **env)
 {
     AXIS2_FUNC_PARAM_CHECK(svc, env, NULL);
-    if(NULL == AXIS2_INTF_TO_IMPL(svc)->parent)
-        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_INVALID_STATE_PARENT_NULL, NULL);
 	
 	return AXIS2_INTF_TO_IMPL(svc)->parent;
 }
@@ -598,14 +703,17 @@
                         axis2_env_t **env,
 		                axis2_param_t *param)
 {
+    struct axis2_param_container *param_container_l = NULL;
+        
     AXIS2_FUNC_PARAM_CHECK(svc, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, param, AXIS2_FAILURE);
-    struct axis2_param_container *param_container_l = NULL;
+    
    
     if(axis2_svc_is_param_locked(svc, env, AXIS2_PARAM_GET_NAME(param, env)))
     {
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_PARAMETER_LOCKED_CANNOT_OVERRIDE,
             AXIS2_FAILURE);
+        return AXIS2_FAILURE;
     } else
     {
         param_container_l = (struct axis2_param_container *)
@@ -647,33 +755,46 @@
 axis2_bool_t AXIS2_CALL
 axis2_svc_is_param_locked (axis2_svc_t *svc, 
                             axis2_env_t **env,
-		                    const axis2_char_t *param_name)
+		                    axis2_char_t *param_name)
 {
     axis2_bool_t locked = AXIS2_FALSE;
     axis2_param_t *param_l = NULL;
     struct axis2_engine_config *engine_config_l = NULL;
+    struct axis2_svc_grp *parent = NULL;
+    axis2_bool_t ret = AXIS2_FALSE;
     
     AXIS2_FUNC_PARAM_CHECK(svc, env, AXIS2_FALSE);
     AXIS2_PARAM_CHECK((*env)->error, param_name, AXIS2_FALSE);
     
    /*checking the locked value of parent */
 
-    if (NULL != axis2_svc_get_parent(svc, env)) 
+    parent = axis2_svc_get_parent(svc, env);
+    if(NULL == parent)
     {
-        /*commented until AXIS2_SVC_GRP_GET_ENGINE_CONFIG is implemented
-        engine_config_l = AXIS2_SVC_GRP_GET_ENGINE_CONFIG(
-            AXIS2_SVC_GET_PARENT(svc, env), env);
-        locked =  AXIS2_ENGINE_CONFIG_IS_PARAM_LOCKED(engine_config_l, env, param_name);
-        */
+        return AXIS2_FALSE;
     }
+    
+    engine_config_l = AXIS2_SVC_GRP_GET_AXIS_DESC(parent, env);
+    if(NULL == engine_config_l)
+    {
+        return AXIS2_FALSE;
+    }
+    locked =  AXIS2_ENGINE_CONFIG_IS_PARAM_LOCKED(engine_config_l, env, param_name);
+    
     if(AXIS2_TRUE == locked)
     {
-        return AXIS2_TRUE;
+        ret = AXIS2_TRUE;
     } else 
     {
         param_l = axis2_svc_get_param(svc, env, param_name);
-        return (NULL != param_l && AXIS2_PARAM_IS_LOCKED(param_l, env));
+        if(NULL == param_l)
+        {
+            return AXIS2_FALSE;
+        }
+        ret = AXIS2_PARAM_IS_LOCKED(param_l, env);
     }
+    
+    return ret;
 }
 
 axis2_status_t AXIS2_CALL
@@ -683,6 +804,7 @@
 {
     AXIS2_FUNC_PARAM_CHECK(svc, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, svc_interface, AXIS2_FAILURE);
+    
     return AXIS2_WSDL_SVC_SET_SVC_INTERFACE(svc->wsdl_svc, env, svc_interface);
 }
 
@@ -705,6 +827,7 @@
     struct axis2_phase_resolver *phase_resolver = NULL;
     int i = 0;
     axis2_status_t status = AXIS2_FAILURE;
+    int size = 0;
         
     AXIS2_FUNC_PARAM_CHECK(svc, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, moduleref, AXIS2_FAILURE);
@@ -715,7 +838,12 @@
         AXIS2_WSDL_COMPONENT_GET_COMPONENT_PROPERTY(svc->wsdl_svc->wsdl_component,
             env, MODULEREF_KEY);
     
-    for(i = 0; i < AXIS2_ARRAY_LIST_SIZE(collection_module, env); i++)
+    size = AXIS2_ARRAY_LIST_SIZE(collection_module, env);
+    if(AXIS2_TRUE != size)
+    {
+        return AXIS2_FAILURE;
+    }
+    for(i = 0; i < size; i++)
     {
         modu = (struct axis2_module_desc *) AXIS2_ARRAY_LIST_GET(collection_module,
             env, i);
@@ -731,8 +859,15 @@
     }
    
     phase_resolver = axis2_phase_resolver_create_with_config(env, axis2_config);
+    if(!phase_resolver)
+    {
+        return AXIS2_FAILURE;
+    }
     status = AXIS2_PHASE_RESOLVER_ENGAGE_MODULE_TO_SVC(phase_resolver, env, svc, moduleref);
-    status = AXIS2_ARRAY_LIST_ADD(collection_module, env, moduleref);
+    if(status)
+    {
+        status = AXIS2_ARRAY_LIST_ADD(collection_module, env, moduleref);
+    }
     
     return status;
 }
@@ -745,12 +880,10 @@
 {
     axis2_hash_t * map = NULL;
     axis2_hash_index_t *index = NULL;
-    void *v = NULL;
     struct axis2_phase_resolver * pr = NULL;
     struct axis2_operation * axis2_opt = NULL;
     axis2_array_list_t *params = NULL;
     struct axis2_param *param = NULL;
-    int j = 0;
     axis2_status_t status = AXIS2_FAILURE;
     
     AXIS2_FUNC_PARAM_CHECK(svc, env, AXIS2_FAILURE);
@@ -759,16 +892,29 @@
     
     map = AXIS2_MODULE_DESC_GET_OPERATIONS(module_desc, env);
     pr = axis2_phase_resolver_create_with_config_and_svc(env, axis2_config, svc);
+    if(!pr)
+    {
+        return AXIS2_FAILURE;
+    }
     
     for (index = axis2_hash_first (map, env); index; index = 
         axis2_hash_next (env, index))
     {
-
+        int size = 0;
+        int j = 0;
+        void *v = NULL;
         axis2_hash_this (index, NULL, NULL, &v);
         axis2_opt = (struct axis2_operation *) v;
         params = AXIS2_OPERATION_GET_PARAMS(axis2_opt, env);
         /* Adding wsa-maping into service */
-        for(j = 0; j < AXIS2_ARRAY_LIST_SIZE(params, env); j++)
+        size = AXIS2_ARRAY_LIST_SIZE(params, env);
+        if(AXIS2_TRUE != size)
+        {
+            if(pr)
+                AXIS2_PHASE_RESOLVER_FREE(pr, env);
+            return AXIS2_FAILURE;
+        }
+        for(j = 0; j < size; j++)
         {
             param = (struct axis2_param *) AXIS2_ARRAY_LIST_GET(params, env, j);
             if(0 == AXIS2_STRCMP( AXIS2_PARAM_GET_NAME(param, env), WSA_ACTION))
@@ -808,6 +954,7 @@
     axis2_array_list_t *collection_module = NULL;
     struct axis2_module_desc * module_desc = NULL;
     int i = 0;
+    int size = 0;
      
     AXIS2_FUNC_PARAM_CHECK(svc, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, module_name, AXIS2_FAILURE);
@@ -815,7 +962,13 @@
     collection_module = (axis2_array_list_t *) 
         AXIS2_WSDL_COMPONENT_GET_COMPONENT_PROPERTY(svc->wsdl_svc->wsdl_component, 
             env, MODULEREF_KEY);
-    for(i = 0; i < AXIS2_ARRAY_LIST_SIZE(collection_module, env); i++)
+    
+    size = AXIS2_ARRAY_LIST_SIZE(collection_module, env);
+    if(AXIS2_TRUE != size)
+    {
+        return AXIS2_FAILURE;
+    }
+    for(i = 0; i < size; i++)
     {
         module_desc = (struct axis2_module_desc *) AXIS2_ARRAY_LIST_GET(
             collection_module, env, i);
@@ -851,8 +1004,13 @@
     
     op_str = AXIS2_QNAME_GET_LOCALPART(operation_name, env);
     svc_interface = axis2_svc_get_svc_interface(svc, env);
+    if(svc_interface)
+    {
+        return AXIS2_WSDL_INTERFACE_GET_OPERATION(svc_interface, env, op_str) ;
+    }
+    else
+        return NULL;
     
-    return AXIS2_WSDL_INTERFACE_GET_OPERATION(svc_interface, env, op_str) ;
 }
 
 axis2_status_t AXIS2_CALL
@@ -860,11 +1018,18 @@
                             axis2_env_t **env,
                             axis2_char_t *context_path) 
 {
+    axis2_char_t *context_path_l = NULL;
     AXIS2_FUNC_PARAM_CHECK(svc, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, context_path, AXIS2_FAILURE);
     
-    return AXIS2_WSDL_COMPONENT_SET_COMPONENT_PROPERTY(svc->wsdl_svc->wsdl_component,
-        env, CONTEXTPATH_KEY, context_path);
+    context_path_l = AXIS2_STRDUP(context_path, env);
+    if(context_path_l)
+    {
+        return AXIS2_WSDL_COMPONENT_SET_COMPONENT_PROPERTY(svc->wsdl_svc->wsdl_component,
+            env, CONTEXTPATH_KEY, context_path);
+    }
+    else
+        return AXIS2_FAILURE;
 }
 
 axis2_char_t * AXIS2_CALL
@@ -881,11 +1046,17 @@
                         axis2_env_t **env,
                         axis2_char_t * style) 
 {
+    axis2_char_t *style_l = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(svc, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, style, AXIS2_FAILURE);
     
-    return AXIS2_WSDL_COMPONENT_SET_COMPONENT_PROPERTY(svc->wsdl_svc->wsdl_component,
-        env, STYLE_KEY, style);
+    style_l = AXIS2_STRDUP(style, env);
+    if(style_l)
+        return AXIS2_WSDL_COMPONENT_SET_COMPONENT_PROPERTY(svc->wsdl_svc->wsdl_component,
+            env, STYLE_KEY, style);
+    else
+        return AXIS2_FAILURE;
 }
 
 axis2_char_t * AXIS2_CALL
@@ -1001,13 +1172,17 @@
     svc_impl = AXIS2_INTF_TO_IMPL(svc);
     
     endpoints = axis2_svc_get_endpoints(svc, env);
+    if(!endpoints)
+    {
+        return NULL;
+    }
     index = axis2_hash_first (endpoints, env);
     if(NULL != index)
     {
         axis2_hash_this(index, NULL, NULL, &value);
         endpoint = (struct axis2_wsdl_endpoint *) value;
-        return axis2_svc_get_operation_by_soap_action_and_endpoint(svc, env, soap_action,
-            AXIS2_WSDL_ENDPOINT_GET_NAME(endpoint, env));
+        return axis2_svc_get_operation_by_soap_action_and_endpoint(svc, env, 
+            soap_action, AXIS2_WSDL_ENDPOINT_GET_NAME(endpoint, env));
     }
 
     return NULL;
@@ -1022,7 +1197,6 @@
     axis2_svc_impl_t *svc_impl = NULL;
     axis2_hash_t *binding_operations = NULL;
     int count = 0;
-    int j = 0;
     axis2_hash_index_t *index_i = NULL;
     void *k = NULL;
     struct axis2_wsdl_binding_operation *binding_operation = NULL;
@@ -1038,15 +1212,26 @@
     binding_operations = AXIS2_WSDL_BINDING_GET_BINDING_OPERATIONS(
         AXIS2_WSDL_ENDPOINT_GET_BINDING(axis2_svc_get_endpoint(svc, env, endpoint),
             env), env);
-    
+    if(NULL == binding_operations)
+    {
+        return NULL;
+    }
     index_i = axis2_hash_first (binding_operations, env);
-    do
+    while(NULL != index_i)
     {
+        int j = 0;
+        int size = 0;
         axis2_hash_this (index_i, &k, NULL, NULL);
         binding_operation = (struct axis2_wsdl_binding_operation *) k;
         extensiblity_elements = AXIS2_WSDL_COMPONENT_GET_EXTENSIBILITY_ELEMENTS(
             binding_operation->extensible_component->wsdl_component, env);
-        do
+        
+        size = AXIS2_LINKED_LIST_SIZE(extensiblity_elements, env);
+        if(AXIS2_TRUE != size)
+        {
+            return NULL;
+        }
+        while(j < size)
         {
             element = (struct axis2_wsdl_soap_operation *) AXIS2_LINKED_LIST_GET(
                 extensiblity_elements, env, j); 
@@ -1065,9 +1250,9 @@
                     
             }
             j++;
-        }while(j < AXIS2_LINKED_LIST_SIZE(extensiblity_elements, env));
+        }
         index_i = axis2_hash_next (env, index_i);
-    } while(NULL != index_i);
+    } 
     if (1 == count) 
     {
         return op;
@@ -1090,8 +1275,14 @@
 {
     axis2_svc_impl_t *svc_impl = AXIS2_INTF_TO_IMPL(svc);
     if(svc_impl->axis2_svc_name)
+    {
         AXIS2_FREE((*env)->allocator, svc_impl->axis2_svc_name);
-    svc_impl->axis2_svc_name = axis2_svc_name;
+    }
+    svc_impl->axis2_svc_name = AXIS2_STRDUP(axis2_svc_name, env);
+    if(!svc_impl->axis2_svc_name)
+    {
+        return AXIS2_FAILURE;
+    }
     return AXIS2_SUCCESS;
 }
 
@@ -1123,10 +1314,21 @@
                             axis2_env_t **env,
                             axis2_char_t *filename) 
 {
-    axis2_svc_impl_t *svc_impl = AXIS2_INTF_TO_IMPL(svc);
+    axis2_svc_impl_t *svc_impl = NULL;
+    
+    AXIS2_FUNC_PARAM_CHECK(svc, env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK((*env)->error, filename, AXIS2_FAILURE);
+    
+    svc_impl = AXIS2_INTF_TO_IMPL(svc);
     if(svc_impl->filename)
+    {
         AXIS2_FREE((*env)->allocator, svc_impl->filename);
-    AXIS2_INTF_TO_IMPL(svc)->filename = filename;
+    }
+    svc_impl->filename = (axis2_char_t *) AXIS2_STRDUP(filename, env);
+    if(!svc_impl->filename)
+    {
+        return AXIS2_FAILURE;
+    }
     return AXIS2_SUCCESS;
 }
 
@@ -1179,4 +1381,24 @@
     axis2_hash_set(svc_impl->wasaction_opeartionmap, mapping_key, 
         AXIS2_HASH_KEY_STRING, axis2_opt);
     return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_svc_add_module_ref(axis2_svc_t *svc,
+                            axis2_env_t **env,
+                            axis2_qname_t *moduleref)
+{
+    AXIS2_FUNC_PARAM_CHECK(svc, env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK((*env)->error, moduleref, AXIS2_FAILURE);
+    
+    return AXIS2_ARRAY_LIST_ADD(AXIS2_INTF_TO_IMPL(svc)->module_list, env, moduleref);
+}
+
+axis2_array_list_t *AXIS2_CALL
+axis2_svc_get_modules(axis2_svc_t *svc,
+                        axis2_env_t **env)
+{
+    AXIS2_FUNC_PARAM_CHECK(svc, env, NULL);
+    
+    return AXIS2_INTF_TO_IMPL(svc)->module_list;
 }

Modified: webservices/axis2/trunk/c/modules/core/description/src/svc_grp.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/src/svc_grp.c?rev=356124&r1=356123&r2=356124&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/src/svc_grp.c (original)
+++ webservices/axis2/trunk/c/modules/core/description/src/svc_grp.c Sun Dec 11 19:13:55 2005
@@ -607,15 +607,20 @@
     axis2_hash_t *svc = NULL;
     struct axis2_phase_resolver *phase_resolver = NULL;
     struct axis2_module_desc *module = NULL;
-    axis2_hash_index_t *index = NULL;
-    void *v;
+    
     struct axis2_svc *axis_svc = NULL;
+    int size = 0;
     
     AXIS2_FUNC_PARAM_CHECK(svc_grp, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, module_name, AXIS2_FAILURE);
     
     svc_grp_impl = AXIS2_INTF_TO_IMPL(svc_grp);
-    for(i = 0; AXIS2_ARRAY_LIST_SIZE(svc_grp_impl->modules, env); i++)
+    size = AXIS2_ARRAY_LIST_SIZE(svc_grp_impl->modules, env);
+    if(AXIS2_TRUE != AXIS2_ERROR_GET_STATUS_CODE((*env)->error))
+    {
+        return AXIS2_FAILURE;
+    }
+    for(i = 0; size; i++)
     {
         modu = AXIS2_ARRAY_LIST_GET(svc_grp_impl->modules, env, i);
         modu_local = AXIS2_QNAME_GET_LOCALPART(modu, env);
@@ -639,8 +644,11 @@
     module = AXIS2_ENGINE_CONFIG_GET_MODULE(svc_grp_impl->parent, env, module_name);
     if(NULL != module)
     {
-        do
+        axis2_hash_index_t *index = NULL;
+        index = axis2_hash_first (svc, env);
+        while(NULL != index);  
         {
+            void *v = NULL;
             /* engage in per each service */
             axis2_hash_this (index, NULL, NULL, &v);
             axis_svc = (struct axis2_svc *) v;
@@ -648,12 +656,15 @@
                 env, axis_svc, module);
             if(AXIS2_FAILURE == status)
             {
-                AXIS2_PHASE_RESOLVER_FREE(phase_resolver, env);
+                if(phase_resolver)
+                    AXIS2_PHASE_RESOLVER_FREE(phase_resolver, env);
                 return status;
             }
             index = axis2_hash_next (env, index);
-        }while(NULL != index);            
+        }          
     }
+    if(phase_resolver)
+        AXIS2_PHASE_RESOLVER_FREE(phase_resolver, env);
     
     return axis2_svc_grp_add_module(svc_grp, env, module_name);
 }
@@ -706,6 +717,12 @@
     AXIS2_PARAM_CHECK((*env)->error, moduleref, AXIS2_FAILURE);
     
     svc_grp_impl = AXIS2_INTF_TO_IMPL(svc_grp);
+    if(!svc_grp_impl->module_list)
+    {
+        svc_grp_impl->module_list = axis2_array_list_create(env, 0);
+        if(!svc_grp_impl->module_list)
+            return AXIS2_FAILURE;
+    }
     return AXIS2_ARRAY_LIST_ADD(svc_grp_impl->module_list, env, moduleref);
 }
 



Mime
View raw message