axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shan...@apache.org
Subject svn commit: r805347 [17/31] - in /webservices/axis2/trunk/c/src: core/addr/ core/clientapi/ core/context/ core/deployment/ core/description/ core/engine/ core/phaseresolver/ core/receivers/ core/transport/amqp/receiver/ core/transport/amqp/receiver/qpi...
Date Tue, 18 Aug 2009 10:15:53 GMT
Modified: webservices/axis2/trunk/c/src/core/receivers/msg_recv.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/receivers/msg_recv.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/receivers/msg_recv.c (original)
+++ webservices/axis2/trunk/c/src/core/receivers/msg_recv.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -41,12 +40,14 @@
      * @param out_msg_ctx pointer to out message context
      * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
      */
-     axis2_status_t(
-    AXIS2_CALL * invoke_business_logic) (
-    axis2_msg_recv_t * msg_recv,
-    const axutil_env_t * env,
-    struct axis2_msg_ctx * in_msg_ctx,
-    struct axis2_msg_ctx * out_msg_ctx);
+    axis2_status_t
+    (
+        AXIS2_CALL * invoke_business_logic)
+    (
+        axis2_msg_recv_t * msg_recv,
+        const axutil_env_t * env,
+        struct axis2_msg_ctx * in_msg_ctx,
+        struct axis2_msg_ctx * out_msg_ctx);
 
     /**
      * This method is called from axis2_engine_receive method. This method's
@@ -61,22 +62,25 @@
      * @param in_msg_ctx pointer to in message context
      * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
      */
-     axis2_status_t(
-    AXIS2_CALL * receive) (
-    axis2_msg_recv_t * msg_recv,
-    const axutil_env_t * env,
-    struct axis2_msg_ctx * in_msg_ctx,
-    void *callback_recv_param);
-
-	axis2_status_t(
-	AXIS2_CALL *load_and_init_svc)(
-	axis2_msg_recv_t *msg_recv,
-	const axutil_env_t *env,
-	struct axis2_svc *svc);
+    axis2_status_t
+    (
+        AXIS2_CALL * receive)
+    (
+        axis2_msg_recv_t * msg_recv,
+        const axutil_env_t * env,
+        struct axis2_msg_ctx * in_msg_ctx,
+        void *callback_recv_param);
+
+    axis2_status_t
+    (
+        AXIS2_CALL *load_and_init_svc)
+( axis2_msg_recv_t *msg_recv,
+const axutil_env_t *env,
+struct axis2_svc *svc);
 
 };
 
-static axis2_status_t AXIS2_CALL 
+static axis2_status_t AXIS2_CALL
 axis2_msg_recv_receive_impl(
     axis2_msg_recv_t * msg_recv,
     const axutil_env_t * env,
@@ -85,61 +89,60 @@
 
 static axis2_status_t AXIS2_CALL
 axis2_msg_recv_load_and_init_svc_impl(
-	axis2_msg_recv_t *msg_recv,
-	const axutil_env_t *env,
-	struct axis2_svc *svc)
-{
-	axutil_param_t *impl_info_param = NULL;
-	void *impl_class = NULL;
-
-	AXIS2_ENV_CHECK(env, NULL);
-
-	if (!svc)
-	{
-		return AXIS2_FAILURE;
-	}
-
-	impl_class = axis2_svc_get_impl_class(svc, env);
-	if (impl_class)
-	{
-		return AXIS2_SUCCESS;
-	}
-	/* When we load the DLL we have to make sure that only one thread will load it */
-	axutil_thread_mutex_lock(axis2_svc_get_mutex(svc, env));
-	/* If more than one thread tries to acquires the lock, first thread loads the DLL. 
-	Others should not load the DLL */
-	impl_class = axis2_svc_get_impl_class(svc, env);
-	if (impl_class)
-	{
-		axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
-		return AXIS2_SUCCESS;
-	}
-	impl_info_param = axis2_svc_get_param(svc, env, AXIS2_SERVICE_CLASS);
-	if (!impl_info_param)
-	{
-		AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC,
-			AXIS2_FAILURE);
-		axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
-		return AXIS2_FAILURE;
-	}
-
-	axutil_allocator_switch_to_global_pool(env->allocator);
-
-	axutil_class_loader_init(env);
-
-	impl_class = axutil_class_loader_create_dll(env, impl_info_param);
-	AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "loading the services from msg_recv_load_and_init_svc");
-
-	if (impl_class)
-	{
-		AXIS2_SVC_SKELETON_INIT((axis2_svc_skeleton_t *) impl_class, env);
-	}
-
-	axis2_svc_set_impl_class(svc, env, impl_class);
-
-	axutil_allocator_switch_to_local_pool(env->allocator);
-	axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
-	return AXIS2_SUCCESS;
+    axis2_msg_recv_t *msg_recv,
+    const axutil_env_t *env,
+    struct axis2_svc *svc)
+{
+    axutil_param_t *impl_info_param = NULL;
+    void *impl_class = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    if(!svc)
+    {
+        return AXIS2_FAILURE;
+    }
+
+    impl_class = axis2_svc_get_impl_class(svc, env);
+    if(impl_class)
+    {
+        return AXIS2_SUCCESS;
+    }
+    /* When we load the DLL we have to make sure that only one thread will load it */
+    axutil_thread_mutex_lock(axis2_svc_get_mutex(svc, env));
+    /* If more than one thread tries to acquires the lock, first thread loads the DLL.
+     Others should not load the DLL */
+    impl_class = axis2_svc_get_impl_class(svc, env);
+    if(impl_class)
+    {
+        axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
+        return AXIS2_SUCCESS;
+    }
+    impl_info_param = axis2_svc_get_param(svc, env, AXIS2_SERVICE_CLASS);
+    if(!impl_info_param)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC, AXIS2_FAILURE);
+        axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
+        return AXIS2_FAILURE;
+    }
+
+    axutil_allocator_switch_to_global_pool(env->allocator);
+
+    axutil_class_loader_init(env);
+
+    impl_class = axutil_class_loader_create_dll(env, impl_info_param);
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "loading the services from msg_recv_load_and_init_svc");
+
+    if(impl_class)
+    {
+        AXIS2_SVC_SKELETON_INIT((axis2_svc_skeleton_t *)impl_class, env);
+    }
+
+    axis2_svc_set_impl_class(svc, env, impl_class);
+
+    axutil_allocator_switch_to_local_pool(env->allocator);
+    axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
+    return AXIS2_SUCCESS;
 }
 
 AXIS2_EXPORT axis2_msg_recv_t *AXIS2_CALL
@@ -150,10 +153,9 @@
 
     AXIS2_ENV_CHECK(env, NULL);
 
-    msg_recv = (axis2_msg_recv_t *) AXIS2_MALLOC(env->allocator,
-                                                 sizeof(axis2_msg_recv_t));
+    msg_recv = (axis2_msg_recv_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_msg_recv_t));
 
-    if (!msg_recv)
+    if(!msg_recv)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
@@ -161,7 +163,7 @@
 
     msg_recv->scope = axutil_strdup(env, "app*");
     msg_recv->derived = NULL;
-	msg_recv->load_and_init_svc = axis2_msg_recv_load_and_init_svc_impl;
+    msg_recv->load_and_init_svc = axis2_msg_recv_load_and_init_svc_impl;
     msg_recv->receive = axis2_msg_recv_receive_impl;
     return msg_recv;
 }
@@ -173,12 +175,12 @@
 {
     AXIS2_ENV_CHECK(env, void);
 
-    if (msg_recv->scope)
+    if(msg_recv->scope)
     {
         AXIS2_FREE(env->allocator, msg_recv->scope);
     }
 
-    if (msg_recv)
+    if(msg_recv)
     {
         AXIS2_FREE(env->allocator, msg_recv);
     }
@@ -204,55 +206,53 @@
     op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
     svc_ctx = axis2_op_ctx_get_parent(op_ctx, env);
     svc = axis2_svc_ctx_get_svc(svc_ctx, env);
-    if (!svc)
+    if(!svc)
     {
         return NULL;
     }
 
     impl_class = axis2_svc_get_impl_class(svc, env);
-    if (impl_class)
+    if(impl_class)
     {
         return impl_class;
     }
-	else
-	{
-		/* When we load the DLL we have to make sure that only one thread will load it */
-		axutil_thread_mutex_lock(axis2_svc_get_mutex(svc, env));
-		/* If more than one thread tries to acquires the lock, first thread loads the DLL. 
-		Others should not load the DLL */
-		impl_class = axis2_svc_get_impl_class(svc, env);
-		if (impl_class)
-		{
+    else
+    {
+        /* When we load the DLL we have to make sure that only one thread will load it */
+        axutil_thread_mutex_lock(axis2_svc_get_mutex(svc, env));
+        /* If more than one thread tries to acquires the lock, first thread loads the DLL.
+         Others should not load the DLL */
+        impl_class = axis2_svc_get_impl_class(svc, env);
+        if(impl_class)
+        {
             axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
-			return impl_class;
-		}
-		impl_info_param = axis2_svc_get_param(svc, env, AXIS2_SERVICE_CLASS);
-		if (!impl_info_param)
-		{
-			AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC,
-							AXIS2_FAILURE);
+            return impl_class;
+        }
+        impl_info_param = axis2_svc_get_param(svc, env, AXIS2_SERVICE_CLASS);
+        if(!impl_info_param)
+        {
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC, AXIS2_FAILURE);
             axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
-			return NULL;
-		}
+            return NULL;
+        }
 
-		axutil_allocator_switch_to_global_pool(env->allocator);
+        axutil_allocator_switch_to_global_pool(env->allocator);
 
-		axutil_class_loader_init(env);
+        axutil_class_loader_init(env);
 
-		impl_class = axutil_class_loader_create_dll(env, impl_info_param);
-		
+        impl_class = axutil_class_loader_create_dll(env, impl_info_param);
 
-		if (impl_class)
-		{
-			AXIS2_SVC_SKELETON_INIT((axis2_svc_skeleton_t *) impl_class, env);
-		}
+        if(impl_class)
+        {
+            AXIS2_SVC_SKELETON_INIT((axis2_svc_skeleton_t *)impl_class, env);
+        }
 
-		axis2_svc_set_impl_class(svc, env, impl_class);
+        axis2_svc_set_impl_class(svc, env, impl_class);
 
-		axutil_allocator_switch_to_local_pool(env->allocator);
-		axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
-		return impl_class;
-	}
+        axutil_allocator_switch_to_local_pool(env->allocator);
+        axutil_thread_mutex_unlock(axis2_svc_get_mutex(svc, env));
+        return impl_class;
+    }
 }
 
 AXIS2_EXPORT axis2_svc_skeleton_t *AXIS2_CALL
@@ -270,7 +270,7 @@
     op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
     svc_ctx = axis2_op_ctx_get_parent(op_ctx, env);
     svc = axis2_svc_ctx_get_svc(svc_ctx, env);
-    if (!svc)
+    if(!svc)
     {
         return NULL;
     }
@@ -287,12 +287,12 @@
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, scope, AXIS2_FAILURE);
 
-    if (msg_recv->scope)
+    if(msg_recv->scope)
     {
         AXIS2_FREE(env->allocator, msg_recv->scope);
     }
     msg_recv->scope = axutil_strdup(env, scope);
-    if (!msg_recv->scope)
+    if(!msg_recv->scope)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return AXIS2_FAILURE;
@@ -328,27 +328,25 @@
     op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
     svc_ctx = axis2_op_ctx_get_parent(op_ctx, env);
     svc = axis2_svc_ctx_get_svc(svc_ctx, env);
-    if (!svc)
+    if(!svc)
     {
         return AXIS2_FAILURE;
     }
 
     scope_param = axis2_svc_get_param(svc, env, AXIS2_SCOPE);
-    if (scope_param)
+    if(scope_param)
     {
         param_value = axutil_param_get_value(scope_param, env);
     }
-    if (param_value && (0 == axutil_strcmp(AXIS2_APPLICATION_SCOPE,
-                                           param_value)))
+    if(param_value && (0 == axutil_strcmp(AXIS2_APPLICATION_SCOPE, param_value)))
     {
         return AXIS2_SUCCESS;
     }
 
     impl_info_param = axis2_svc_get_param(svc, env, AXIS2_SERVICE_CLASS);
-    if (!impl_info_param)
+    if(!impl_info_param)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC,
-                        AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_SVC, AXIS2_FAILURE);
         return AXIS2_FAILURE;
     }
     dll_desc = axutil_param_get_value(impl_info_param, env);
@@ -371,15 +369,14 @@
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "[axis2]Entry:axis2_msg_recv_receive_impl");
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[axis2]Entry:axis2_msg_recv_receive_impl");
     out_msg_ctx = axis2_core_utils_create_out_msg_ctx(env, msg_ctx);
-    if (!out_msg_ctx)
+    if(!out_msg_ctx)
     {
         return AXIS2_FAILURE;
     }
     op_ctx = axis2_msg_ctx_get_op_ctx(out_msg_ctx, env);
-    if (!op_ctx)
+    if(!op_ctx)
     {
         axis2_core_utils_reset_out_msg_ctx(env, out_msg_ctx);
         axis2_msg_ctx_free(out_msg_ctx, env);
@@ -387,7 +384,7 @@
     }
 
     status = axis2_op_ctx_add_msg_ctx(op_ctx, env, out_msg_ctx);
-    if (!status)
+    if(!status)
     {
         axis2_core_utils_reset_out_msg_ctx(env, out_msg_ctx);
         axis2_msg_ctx_free(out_msg_ctx, env);
@@ -395,14 +392,13 @@
     }
     status = axis2_op_ctx_add_msg_ctx(op_ctx, env, msg_ctx);
 
-    if (!status)
+    if(!status)
     {
         return status;
     }
 
-    status = axis2_msg_recv_invoke_business_logic(msg_recv, env,
-                                                  msg_ctx, out_msg_ctx);
-    if (AXIS2_SUCCESS != status)
+    status = axis2_msg_recv_invoke_business_logic(msg_recv, env, msg_ctx, out_msg_ctx);
+    if(AXIS2_SUCCESS != status)
     {
         axis2_core_utils_reset_out_msg_ctx(env, out_msg_ctx);
         axis2_msg_ctx_free(out_msg_ctx, env);
@@ -411,35 +407,31 @@
     svc_ctx = axis2_op_ctx_get_parent(op_ctx, env);
     conf_ctx = axis2_svc_ctx_get_conf_ctx(svc_ctx, env);
     engine = axis2_engine_create(env, conf_ctx);
-    if (!engine)
+    if(!engine)
     {
         axis2_msg_ctx_free(out_msg_ctx, env);
         return AXIS2_FAILURE;
     }
-    if (axis2_msg_ctx_get_soap_envelope(out_msg_ctx, env))
+    if(axis2_msg_ctx_get_soap_envelope(out_msg_ctx, env))
     {
-        axiom_soap_envelope_t *soap_envelope =
-            axis2_msg_ctx_get_soap_envelope(out_msg_ctx, env);
-        if (soap_envelope)
+        axiom_soap_envelope_t *soap_envelope = axis2_msg_ctx_get_soap_envelope(out_msg_ctx, env);
+        if(soap_envelope)
         {
-            axiom_soap_body_t *body =
-                axiom_soap_envelope_get_body(soap_envelope,
-                                             env);
-            if (body)
+            axiom_soap_body_t *body = axiom_soap_envelope_get_body(soap_envelope, env);
+            if(body)
             {
                 /* in case of a SOAP fault, we got to return failure so that
-                   transport gets to know that it should send 500 */
-                if (axiom_soap_body_has_fault(body, env))
+                 transport gets to know that it should send 500 */
+                if(axiom_soap_body_has_fault(body, env))
                 {
                     status = AXIS2_FAILURE;
-                    axis2_msg_ctx_set_fault_soap_envelope(msg_ctx, env,
-                                                          soap_envelope);
+                    axis2_msg_ctx_set_fault_soap_envelope(msg_ctx, env, soap_envelope);
                     axis2_msg_ctx_set_soap_envelope(out_msg_ctx, env, NULL);
                 }
                 else
                 {
                     /* if it is two way and not a fault then send through engine.
-                       if it is one way we do not need to do an engine send */
+                     if it is one way we do not need to do an engine send */
                     status = axis2_engine_send(engine, env, out_msg_ctx);
                 }
             }
@@ -451,13 +443,11 @@
      * not done here both in and out message context will try to free the transport out stream 
      * which will result in memory corruption.
      */
-    if (!axis2_msg_ctx_is_paused(out_msg_ctx, env) &&
-        !axis2_msg_ctx_is_keep_alive(out_msg_ctx, env))
+    if(!axis2_msg_ctx_is_paused(out_msg_ctx, env) && !axis2_msg_ctx_is_keep_alive(out_msg_ctx, env))
     {
         axis2_core_utils_reset_out_msg_ctx(env, out_msg_ctx);
     }
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "[axis2]Exit:axis2_msg_recv_receive_impl");
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[axis2]Exit:axis2_msg_recv_receive_impl");
     return status;
 }
 
@@ -478,8 +468,7 @@
     struct axis2_msg_ctx * in_msg_ctx,
     struct axis2_msg_ctx * out_msg_ctx)
 {
-    return msg_recv->invoke_business_logic(msg_recv, env, in_msg_ctx,
-                                           out_msg_ctx);
+    return msg_recv->invoke_business_logic(msg_recv, env, in_msg_ctx, out_msg_ctx);
 }
 
 AXIS2_EXPORT axis2_status_t AXIS2_CALL
@@ -522,23 +511,23 @@
 
 AXIS2_EXPORT axis2_status_t AXIS2_CALL
 axis2_msg_recv_set_load_and_init_svc(
-	 axis2_msg_recv_t *msg_recv,
-	 const axutil_env_t *env,
-	 AXIS2_MSG_RECV_LOAD_AND_INIT_SVC func)
+    axis2_msg_recv_t *msg_recv,
+    const axutil_env_t *env,
+    AXIS2_MSG_RECV_LOAD_AND_INIT_SVC func)
 {
-	msg_recv->load_and_init_svc = func;
-	return AXIS2_SUCCESS;
+    msg_recv->load_and_init_svc = func;
+    return AXIS2_SUCCESS;
 }
 
 AXIS2_EXPORT axis2_status_t AXIS2_CALL
 axis2_msg_recv_load_and_init_svc(
-	 axis2_msg_recv_t *msg_recv,
-	 const axutil_env_t *env,
-	 struct axis2_svc *svc)
+    axis2_msg_recv_t *msg_recv,
+    const axutil_env_t *env,
+    struct axis2_svc *svc)
 {
     if(msg_recv->load_and_init_svc)
     {
-	    return msg_recv->load_and_init_svc(msg_recv, env, svc);
+        return msg_recv->load_and_init_svc(msg_recv, env, svc);
     }
     else
     {

Modified: webservices/axis2/trunk/c/src/core/receivers/raw_xml_in_out_msg_recv.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/receivers/raw_xml_in_out_msg_recv.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/receivers/raw_xml_in_out_msg_recv.c (original)
+++ webservices/axis2/trunk/c/src/core/receivers/raw_xml_in_out_msg_recv.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -40,13 +39,13 @@
     axis2_status_t status = AXIS2_FAILURE;
 
     msg_recv = axis2_msg_recv_create(env);
-    if (!msg_recv)
+    if(!msg_recv)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
     status = axis2_msg_recv_set_scope(msg_recv, env, AXIS2_APPLICATION_SCOPE);
-    if (!status)
+    if(!status)
     {
         axis2_msg_recv_free(msg_recv, env);
         return NULL;
@@ -87,23 +86,23 @@
     axiom_namespace_t *env_ns = NULL;
     axiom_node_t *fault_node = NULL;
     axiom_soap_fault_detail_t *fault_detail;
-	axis2_bool_t is_fault = AXIS2_FALSE;
+    axis2_bool_t is_fault = AXIS2_FALSE;
 
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, new_msg_ctx, AXIS2_FAILURE);
 
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
+    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
         "[axis2]Entry:axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync");
 
     /* get the implementation class for the Web Service */
     svc_obj = axis2_msg_recv_get_impl_obj(msg_recv, env, msg_ctx);
 
-    if (!svc_obj)
+    if(!svc_obj)
     {
         const axis2_char_t *svc_name = NULL;
         axis2_svc_t *svc = axis2_msg_ctx_get_svc(msg_ctx, env);
 
-        if (svc)
+        if(svc)
         {
             svc_name = axis2_svc_get_name(svc, env);
         }
@@ -112,8 +111,8 @@
             svc_name = "unknown";
         }
 
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "Impl object for service '%s' not set in message receiver. %d :: %s", svc_name, 
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+            "Impl object for service '%s' not set in message receiver. %d :: %s", svc_name,
             env->error->error_number, AXIS2_ERROR_GET_MESSAGE(env->error));
 
         status = AXIS2_FAILURE;
@@ -124,7 +123,7 @@
         op_desc = axis2_op_ctx_get_op(op_ctx, env);
 
         style = axis2_op_get_style(op_desc, env);
-        if (0 == axutil_strcmp(AXIS2_STYLE_DOC, style))
+        if(0 == axutil_strcmp(AXIS2_STYLE_DOC, style))
         {
             axiom_soap_envelope_t *envelope = NULL;
             axiom_soap_body_t *body = NULL;
@@ -135,7 +134,7 @@
             om_element = axiom_node_get_data_element(om_node, env);
             om_node = axiom_node_get_first_element(om_node, env);
         }
-        else if (0 == axutil_strcmp(AXIS2_STYLE_RPC, style))
+        else if(0 == axutil_strcmp(AXIS2_STYLE_RPC, style))
         {
             axiom_soap_envelope_t *envelope = NULL;
             axiom_soap_body_t *body = NULL;
@@ -146,10 +145,10 @@
             body = axiom_soap_envelope_get_body(envelope, env);
             op_node = axiom_soap_body_get_base_node(body, env);
             op_element = axiom_node_get_data_element(op_node, env);
-            if (op_element)
+            if(op_element)
             {
                 local_name = axiom_element_get_localname(op_element, env);
-                if (local_name)
+                if(local_name)
                 {
                     axutil_array_list_t *function_arr = NULL;
                     int i = 0;
@@ -157,24 +156,24 @@
                     axis2_bool_t matches = AXIS2_FALSE;
 
                     function_arr = svc_obj->func_array;
-                    if (function_arr)
+                    if(function_arr)
                     {
                         size = axutil_array_list_size(function_arr, env);
                     }
 
-                    for (i = 0; i < size; i++)
+                    for(i = 0; i < size; i++)
                     {
                         axis2_char_t *function_name = NULL;
 
-                        function_name = (axis2_char_t *) axutil_array_list_get(function_arr, env, i);
-                        if (!axutil_strcmp(function_name, local_name))
+                        function_name = (axis2_char_t *)axutil_array_list_get(function_arr, env, i);
+                        if(!axutil_strcmp(function_name, local_name))
                         {
                             matches = AXIS2_TRUE;
 
                         }
                     }
 
-                    if (matches)
+                    if(matches)
                     {
                         om_node = axiom_node_get_first_child(op_node, env);
                         om_element = axiom_node_get_data_element(om_node, env);
@@ -203,29 +202,29 @@
             status = AXIS2_FAILURE;
         }
 
-        if (status == AXIS2_SUCCESS)
+        if(status == AXIS2_SUCCESS)
         {
             skel_invoked = AXIS2_TRUE;
             result_node = AXIS2_SVC_SKELETON_INVOKE(svc_obj, env, om_node, new_msg_ctx);
         }
 
-        if (result_node)
+        if(result_node)
         {
-            if (0 == axutil_strcmp(style, AXIS2_STYLE_RPC))
+            if(0 == axutil_strcmp(style, AXIS2_STYLE_RPC))
             {
                 axiom_namespace_t *ns = NULL;
                 axis2_char_t *res_name = NULL;
 
                 res_name = axutil_stracat(env, local_name, "Response");
                 ns = axiom_namespace_create(env, "http://soapenc/", "res");
-                if (!ns)
+                if(!ns)
                 {
                     status = AXIS2_FAILURE;
                 }
                 else
                 {
-                    body_content_element =
-                        axiom_element_create(env, NULL, res_name, ns, &body_content_node);
+                    body_content_element = axiom_element_create(env, NULL, res_name, ns,
+                        &body_content_node);
                     axiom_node_add_child(body_content_node, env, result_node);
                 }
             }
@@ -236,177 +235,177 @@
         }
         else
         {
-			axis2_char_t *mep = (axis2_char_t *)axis2_op_get_msg_exchange_pattern(op_desc, env);
-			if (axutil_strcmp(mep, AXIS2_MEP_URI_IN_ONLY) && 
-				axutil_strcmp(mep, AXIS2_MEP_URI_ROBUST_IN_ONLY))
-			{
-				status = AXIS2_ERROR_GET_STATUS_CODE(env->error);
-				if (status == AXIS2_SUCCESS)
-				{
-					axis2_msg_ctx_set_no_content(new_msg_ctx, env, AXIS2_TRUE);
-				}
-				else
-				{
-					axis2_msg_ctx_set_status_code(msg_ctx, env,	
-						axis2_msg_ctx_get_status_code(new_msg_ctx, env));
-				}
-				/* The new_msg_ctx is passed to the service. The status code must
-				 * be taken from here and set to the old message context which is
-				 * used by the worker when the request processing fails.
-				 */
-				if (svc_obj->ops->on_fault)
-				{
-					fault_node = AXIS2_SVC_SKELETON_ON_FAULT(svc_obj, env, om_node);
-				}
-				is_fault = AXIS2_TRUE;
-			}
-			else
-			{	
-				/* If we have a in only message result node is NULL. We create fault only if 
-				 * an error is set 
-				 */
-				status = AXIS2_ERROR_GET_STATUS_CODE(env->error);
-				if (status == AXIS2_SUCCESS)
-				{
-					axis2_msg_ctx_set_no_content(new_msg_ctx, env, AXIS2_TRUE);
-				}
-				else
-				{
-					axis2_msg_ctx_set_status_code(msg_ctx, env,
-						axis2_msg_ctx_get_status_code(new_msg_ctx, env));
-					if (!axutil_strcmp(mep, AXIS2_MEP_URI_ROBUST_IN_ONLY))
-					{
-						/* The new_msg_ctx is passed to the service. The status code must
-						 * be taken from here and set to the old message context which is
-						 * used by the worker when the request processing fails.
-						 */
-						if (svc_obj->ops->on_fault)
-						{
-							fault_node = AXIS2_SVC_SKELETON_ON_FAULT(svc_obj, env, om_node);
-						}
-						is_fault = AXIS2_TRUE;
-					}
-				}
-			}
+            axis2_char_t *mep = (axis2_char_t *)axis2_op_get_msg_exchange_pattern(op_desc, env);
+            if(axutil_strcmp(mep, AXIS2_MEP_URI_IN_ONLY) && axutil_strcmp(mep,
+                AXIS2_MEP_URI_ROBUST_IN_ONLY))
+            {
+                status = AXIS2_ERROR_GET_STATUS_CODE(env->error);
+                if(status == AXIS2_SUCCESS)
+                {
+                    axis2_msg_ctx_set_no_content(new_msg_ctx, env, AXIS2_TRUE);
+                }
+                else
+                {
+                    axis2_msg_ctx_set_status_code(msg_ctx, env, axis2_msg_ctx_get_status_code(
+                        new_msg_ctx, env));
+                }
+                /* The new_msg_ctx is passed to the service. The status code must
+                 * be taken from here and set to the old message context which is
+                 * used by the worker when the request processing fails.
+                 */
+                if(svc_obj->ops->on_fault)
+                {
+                    fault_node = AXIS2_SVC_SKELETON_ON_FAULT(svc_obj, env, om_node);
+                }
+                is_fault = AXIS2_TRUE;
+            }
+            else
+            {
+                /* If we have a in only message result node is NULL. We create fault only if
+                 * an error is set
+                 */
+                status = AXIS2_ERROR_GET_STATUS_CODE(env->error);
+                if(status == AXIS2_SUCCESS)
+                {
+                    axis2_msg_ctx_set_no_content(new_msg_ctx, env, AXIS2_TRUE);
+                }
+                else
+                {
+                    axis2_msg_ctx_set_status_code(msg_ctx, env, axis2_msg_ctx_get_status_code(
+                        new_msg_ctx, env));
+                    if(!axutil_strcmp(mep, AXIS2_MEP_URI_ROBUST_IN_ONLY))
+                    {
+                        /* The new_msg_ctx is passed to the service. The status code must
+                         * be taken from here and set to the old message context which is
+                         * used by the worker when the request processing fails.
+                         */
+                        if(svc_obj->ops->on_fault)
+                        {
+                            fault_node = AXIS2_SVC_SKELETON_ON_FAULT(svc_obj, env, om_node);
+                        }
+                        is_fault = AXIS2_TRUE;
+                    }
+                }
+            }
         }
     }
 
-    if (msg_ctx && axis2_msg_ctx_get_is_soap_11(msg_ctx, env))
+    if(msg_ctx && axis2_msg_ctx_get_is_soap_11(msg_ctx, env))
     {
         soap_ns = AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI; /* default is 1.2 */
         soap_version = AXIOM_SOAP11;
     }
 
-    if (axis2_msg_ctx_get_soap_envelope(new_msg_ctx, env))
+    if(axis2_msg_ctx_get_soap_envelope(new_msg_ctx, env))
     {
         /* service implementation has set the envelope,
-           useful when setting a SOAP fault.
-           No need to further process */
+         useful when setting a SOAP fault.
+         No need to further process */
         return AXIS2_SUCCESS;
     }
 
     /* create the soap envelope here */
     env_ns = axiom_namespace_create(env, soap_ns, "soapenv");
-    if (!env_ns)
+    if(!env_ns)
     {
         return AXIS2_FAILURE;
     }
 
     default_envelope = axiom_soap_envelope_create(env, env_ns);
 
-    if (!default_envelope)
+    if(!default_envelope)
     {
         return AXIS2_FAILURE;
     }
 
     out_header = axiom_soap_header_create_with_parent(env, default_envelope);
-    if (!out_header)
+    if(!out_header)
     {
         return AXIS2_FAILURE;
     }
 
     out_body = axiom_soap_body_create_with_parent(env, default_envelope);
-    if (!out_body)
+    if(!out_body)
     {
         return AXIS2_FAILURE;
     }
 
     out_node = axiom_soap_body_get_base_node(out_body, env);
-    if (!out_node)
+    if(!out_node)
     {
         return AXIS2_FAILURE;
     }
 
-    if (status != AXIS2_SUCCESS || is_fault)
+    if(status != AXIS2_SUCCESS || is_fault)
     {
         /* something went wrong. set a SOAP Fault */
         const axis2_char_t *fault_value_str = "soapenv:Sender";
         const axis2_char_t *fault_reason_str = NULL;
         const axis2_char_t *err_msg = NULL;
 
-        if (!skel_invoked)
+        if(!skel_invoked)
         {
-			if (axis2_msg_ctx_get_is_soap_11(msg_ctx, env))
-            {
-                fault_value_str =
-                    AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":"
-                    AXIOM_SOAP11_FAULT_CODE_RECEIVER;
-            }
-            else
+            if(axis2_msg_ctx_get_is_soap_11(msg_ctx, env))
             {
-                fault_value_str =
-                    AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":"
-                    AXIOM_SOAP12_SOAP_FAULT_VALUE_RECEIVER;
-            }
-        }
-
-        err_msg = AXIS2_ERROR_GET_MESSAGE(env->error);
-        if (err_msg)
-        {
-            fault_reason_str = err_msg;
+fault_value_str            =
+            AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":"
+            AXIOM_SOAP11_FAULT_CODE_RECEIVER;
         }
         else
         {
-            fault_reason_str = "An error has occured, but could not determine exact details";
-        }
-
-        soap_fault = axiom_soap_fault_create_default_fault(env, out_body, fault_value_str, 
-            fault_reason_str, soap_version);
-
-        if (fault_node)
-        {
-            axiom_node_t *fault_detail_node = NULL;
-
-            fault_detail = axiom_soap_fault_detail_create_with_parent(env, soap_fault);
-            fault_detail_node = axiom_soap_fault_detail_get_base_node(fault_detail, env);
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "fault_detail:%s", axiom_node_to_string(
-                fault_detail_node, env));
-
-            axiom_soap_fault_detail_add_detail_entry(fault_detail, env, fault_node);
+            fault_value_str =
+            AXIOM_SOAP_DEFAULT_NAMESPACE_PREFIX ":"
+            AXIOM_SOAP12_SOAP_FAULT_VALUE_RECEIVER;
         }
     }
 
-    if (body_content_node)
+    err_msg = AXIS2_ERROR_GET_MESSAGE(env->error);
+    if (err_msg)
     {
-        axiom_node_add_child(out_node, env, body_content_node);
-        status = axis2_msg_ctx_set_soap_envelope(new_msg_ctx, env, default_envelope);
+        fault_reason_str = err_msg;
     }
-    else if (soap_fault)
+    else
     {
-        axis2_msg_ctx_set_soap_envelope(new_msg_ctx, env, default_envelope);
-        status = AXIS2_SUCCESS;
+        fault_reason_str = "An error has occured, but could not determine exact details";
     }
-    else
+
+    soap_fault = axiom_soap_fault_create_default_fault(env, out_body, fault_value_str,
+        fault_reason_str, soap_version);
+
+    if (fault_node)
     {
-        /* we should free the memory as the envelope is not used, one way case */
-        axiom_soap_envelope_free(default_envelope, env);
-        default_envelope = NULL;
+        axiom_node_t *fault_detail_node = NULL;
+
+        fault_detail = axiom_soap_fault_detail_create_with_parent(env, soap_fault);
+        fault_detail_node = axiom_soap_fault_detail_get_base_node(fault_detail, env);
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "fault_detail:%s", axiom_node_to_string(
+                fault_detail_node, env));
+
+        axiom_soap_fault_detail_add_detail_entry(fault_detail, env, fault_node);
     }
+}
+
+if (body_content_node)
+{
+    axiom_node_add_child(out_node, env, body_content_node);
+    status = axis2_msg_ctx_set_soap_envelope(new_msg_ctx, env, default_envelope);
+}
+else if (soap_fault)
+{
+    axis2_msg_ctx_set_soap_envelope(new_msg_ctx, env, default_envelope);
+    status = AXIS2_SUCCESS;
+}
+else
+{
+    /* we should free the memory as the envelope is not used, one way case */
+    axiom_soap_envelope_free(default_envelope, env);
+    default_envelope = NULL;
+}
 
-    AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, 
-        "[axis2]Exit:axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync");
+AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
+    "[axis2]Exit:axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync");
 
-    return status;
+return status;
 }
 
 AXIS2_EXPORT int
@@ -415,7 +414,7 @@
     const axutil_env_t * env)
 {
     *inst = axis2_raw_xml_in_out_msg_recv_create(env);
-    if (!(*inst))
+    if(!(*inst))
     {
         return AXIS2_FAILURE;
     }
@@ -428,7 +427,7 @@
     struct axis2_msg_recv *inst,
     const axutil_env_t * env)
 {
-    if (inst)
+    if(inst)
     {
         axis2_msg_recv_free(inst, env);
     }

Modified: webservices/axis2/trunk/c/src/core/receivers/svr_callback.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/receivers/svr_callback.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/receivers/svr_callback.c (original)
+++ webservices/axis2/trunk/c/src/core/receivers/svr_callback.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -32,10 +31,10 @@
 
     AXIS2_ENV_CHECK(env, NULL);
 
-    svr_callback = (axis2_svr_callback_t *)
-        AXIS2_MALLOC(env->allocator, sizeof(axis2_svr_callback_t));
+    svr_callback = (axis2_svr_callback_t *)AXIS2_MALLOC(env->allocator,
+        sizeof(axis2_svr_callback_t));
 
-    if (!svr_callback)
+    if(!svr_callback)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
@@ -51,7 +50,7 @@
 {
     AXIS2_ENV_CHECK(env, void);
 
-    if (svr_callback)
+    if(svr_callback)
     {
         AXIS2_FREE(env->allocator, svr_callback);
     }
@@ -77,7 +76,7 @@
     svc_ctx = axis2_op_ctx_get_parent(op_ctx, env);
     conf_ctx = axis2_svc_ctx_get_conf_ctx(svc_ctx, env);
     engine = axis2_engine_create(env, conf_ctx);
-    if (!engine)
+    if(!engine)
     {
         return AXIS2_FAILURE;
     }
@@ -103,12 +102,11 @@
     svc_ctx = axis2_op_ctx_get_parent(op_ctx, env);
     conf_ctx = axis2_svc_ctx_get_conf_ctx(svc_ctx, env);
     engine = axis2_engine_create(env, conf_ctx);
-    if (!engine)
+    if(!engine)
     {
         return AXIS2_FAILURE;
     }
 
-    fault_ctx =
-        axis2_engine_create_fault_msg_ctx(engine, env, msg_ctx, NULL, NULL);
+    fault_ctx = axis2_engine_create_fault_msg_ctx(engine, env, msg_ctx, NULL, NULL);
     return axis2_engine_send_fault(engine, env, fault_ctx);
 }

Modified: webservices/axis2/trunk/c/src/core/transport/amqp/receiver/axis2_amqp_receiver.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/receiver/axis2_amqp_receiver.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/receiver/axis2_amqp_receiver.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/receiver/axis2_amqp_receiver.c Tue Aug 18 10:15:49 2009
@@ -1,50 +1,50 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements.  See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License.  You may obtain a copy of the License at
-*
-*      http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include <axis2_amqp_util.h>
 #include <axis2_amqp_defines.h>
 #include <axis2_amqp_receiver.h>
 
-static const axis2_transport_receiver_ops_t amqp_receiver_ops = {
+static const axis2_transport_receiver_ops_t amqp_receiver_ops =
+{
     axis2_amqp_receiver_init,
     axis2_amqp_receiver_start,
     axis2_amqp_receiver_get_reply_to_epr,
     axis2_amqp_receiver_get_conf_ctx,
     axis2_amqp_receiver_is_running,
     axis2_amqp_receiver_stop,
-    axis2_amqp_receiver_free};
-
+    axis2_amqp_receiver_free
+};
 
 AXIS2_EXTERN axis2_transport_receiver_t* AXIS2_CALL
 axis2_amqp_receiver_create(
-	const axutil_env_t* env,
-	const axis2_char_t* repo,
-	const axis2_char_t* qpid_broker_ip,
-	int qpid_broker_port)
-{
-    AXIS2_ENV_CHECK (env, NULL);
-    
-	axis2_amqp_receiver_resource_pack_t* receiver_resource_pack = NULL;
-
-    receiver_resource_pack = (axis2_amqp_receiver_resource_pack_t*)
-							  AXIS2_MALLOC(env->allocator, 
-									  	   sizeof(axis2_amqp_receiver_resource_pack_t));
+    const axutil_env_t* env,
+    const axis2_char_t* repo,
+    const axis2_char_t* qpid_broker_ip,
+    int qpid_broker_port)
+{
+    AXIS2_ENV_CHECK(env, NULL);
+
+    axis2_amqp_receiver_resource_pack_t* receiver_resource_pack = NULL;
+
+    receiver_resource_pack = (axis2_amqp_receiver_resource_pack_t*)AXIS2_MALLOC(env->allocator,
+        sizeof(axis2_amqp_receiver_resource_pack_t));
 
-    if (!receiver_resource_pack)
+    if(!receiver_resource_pack)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
@@ -55,42 +55,44 @@
     receiver_resource_pack->conf_ctx = NULL;
     receiver_resource_pack->conf_ctx_private = NULL;
 
-	if (repo)
+    if(repo)
     {
         /**
          * 1. We first create a private conf ctx which is owned by this server
          * 	  we only free this private conf context. We should never free the
          *    receiver_impl->conf_ctx because it may be owned by any other object which
          *    may lead to double free.
-		 *
-		 * 2. The Qpid broker IP and port are set in conf_ctx at two different places.
-		 * 	  If the repo is specified, they are set here. Otherwise, they are set
-		 * 	  in axis2_amqp_receiver_init method.
+         *
+         * 2. The Qpid broker IP and port are set in conf_ctx at two different places.
+         * 	  If the repo is specified, they are set here. Otherwise, they are set
+         * 	  in axis2_amqp_receiver_init method.
          */
-		axutil_property_t* property = NULL;
-		const axis2_char_t* broker_ip = NULL;
-		int* broker_port = (int*)AXIS2_MALLOC(env->allocator, sizeof(int));
-		*broker_port = AXIS2_QPID_NULL_CONF_INT;
+        axutil_property_t* property = NULL;
+        const axis2_char_t* broker_ip = NULL;
+        int* broker_port = (int*)AXIS2_MALLOC(env->allocator, sizeof(int));
+        *broker_port = AXIS2_QPID_NULL_CONF_INT;
 
         receiver_resource_pack->conf_ctx_private = axis2_build_conf_ctx(env, repo);
-        if (!receiver_resource_pack->conf_ctx_private)
+        if(!receiver_resource_pack->conf_ctx_private)
         {
             axis2_amqp_receiver_free((axis2_transport_receiver_t *)receiver_resource_pack, env);
             return NULL;
         }
 
-		/* Set broker IP */
-		broker_ip = qpid_broker_ip ? qpid_broker_ip : AXIS2_QPID_DEFAULT_BROKER_IP;
-		property = axutil_property_create_with_args(env, AXIS2_SCOPE_APPLICATION, 0, 0, (void*)broker_ip);
-		axis2_conf_ctx_set_property(receiver_resource_pack->conf_ctx_private, env, 
-				AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_IP, property);
-
-		/* Set broker port */
-    	*broker_port = (qpid_broker_port != AXIS2_QPID_NULL_CONF_INT) ? 
-			qpid_broker_port : AXIS2_QPID_DEFAULT_BROKER_PORT;
-		property = axutil_property_create_with_args(env, AXIS2_SCOPE_APPLICATION, 0, 0, (void*)broker_port);
-		axis2_conf_ctx_set_property(receiver_resource_pack->conf_ctx_private, env,
-				AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_PORT, property);
+        /* Set broker IP */
+        broker_ip = qpid_broker_ip ? qpid_broker_ip : AXIS2_QPID_DEFAULT_BROKER_IP;
+        property = axutil_property_create_with_args(env, AXIS2_SCOPE_APPLICATION, 0, 0,
+            (void*)broker_ip);
+        axis2_conf_ctx_set_property(receiver_resource_pack->conf_ctx_private, env,
+            AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_IP, property);
+
+        /* Set broker port */
+        *broker_port = (qpid_broker_port != AXIS2_QPID_NULL_CONF_INT) ? qpid_broker_port
+            : AXIS2_QPID_DEFAULT_BROKER_PORT;
+        property = axutil_property_create_with_args(env, AXIS2_SCOPE_APPLICATION, 0, 0,
+            (void*)broker_port);
+        axis2_conf_ctx_set_property(receiver_resource_pack->conf_ctx_private, env,
+            AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_PORT, property);
 
         receiver_resource_pack->conf_ctx = receiver_resource_pack->conf_ctx_private;
     }
@@ -98,148 +100,140 @@
     return &(receiver_resource_pack->receiver);
 }
 
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL 
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axis2_amqp_receiver_init(
-	axis2_transport_receiver_t* receiver,
-	const axutil_env_t* env,
-	axis2_conf_ctx_t* conf_ctx,
-	axis2_transport_in_desc_t* in_desc)
-{
-	axis2_amqp_receiver_resource_pack_t* receiver_resource_pack = NULL;
-	axutil_property_t* property = NULL;
-	const axis2_char_t* broker_ip = NULL;
-	int* broker_port = (int*)AXIS2_MALLOC(env->allocator, sizeof(int));
-	*broker_port = AXIS2_QPID_NULL_CONF_INT;
-
-	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
-	receiver_resource_pack = AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK(receiver);
-	receiver_resource_pack->conf_ctx = conf_ctx;
-	
-	/* Set broker IP */
-	broker_ip = axis2_amqp_util_get_in_desc_conf_value_string(
-			in_desc, env, AXIS2_AMQP_CONF_QPID_BROKER_IP); 
-	if (!broker_ip)
-	{
-		broker_ip = AXIS2_QPID_DEFAULT_BROKER_IP;
-	}
-	property = axutil_property_create_with_args(
-			env, AXIS2_SCOPE_APPLICATION, 0, 0, (void*)broker_ip);
-	axis2_conf_ctx_set_property(receiver_resource_pack->conf_ctx, env, 
-			AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_IP, property);
-
-	/* Set broker port */
-	*broker_port = axis2_amqp_util_get_in_desc_conf_value_int(
-			in_desc, env, AXIS2_AMQP_CONF_QPID_BROKER_PORT);
-    if (*broker_port == AXIS2_QPID_NULL_CONF_INT)
-	{
-		*broker_port = AXIS2_QPID_DEFAULT_BROKER_PORT;
-	}
-	property = axutil_property_create_with_args(
-			env, AXIS2_SCOPE_APPLICATION, 0, 0, (void*)broker_port);
-	axis2_conf_ctx_set_property(receiver_resource_pack->conf_ctx, env,
-			AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_PORT, property);
-	
-	return AXIS2_SUCCESS;
-}
+    axis2_transport_receiver_t* receiver,
+    const axutil_env_t* env,
+    axis2_conf_ctx_t* conf_ctx,
+    axis2_transport_in_desc_t* in_desc)
+{
+    axis2_amqp_receiver_resource_pack_t* receiver_resource_pack = NULL;
+    axutil_property_t* property = NULL;
+    const axis2_char_t* broker_ip = NULL;
+    int* broker_port = (int*)AXIS2_MALLOC(env->allocator, sizeof(int));
+    *broker_port = AXIS2_QPID_NULL_CONF_INT;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
+    receiver_resource_pack = AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK(receiver);
+    receiver_resource_pack->conf_ctx = conf_ctx;
+
+    /* Set broker IP */
+    broker_ip = axis2_amqp_util_get_in_desc_conf_value_string(in_desc, env,
+        AXIS2_AMQP_CONF_QPID_BROKER_IP);
+    if(!broker_ip)
+    {
+        broker_ip = AXIS2_QPID_DEFAULT_BROKER_IP;
+    }
+    property = axutil_property_create_with_args(env, AXIS2_SCOPE_APPLICATION, 0, 0,
+        (void*)broker_ip);
+    axis2_conf_ctx_set_property(receiver_resource_pack->conf_ctx, env,
+        AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_IP, property);
+
+    /* Set broker port */
+    *broker_port = axis2_amqp_util_get_in_desc_conf_value_int(in_desc, env,
+        AXIS2_AMQP_CONF_QPID_BROKER_PORT);
+    if(*broker_port == AXIS2_QPID_NULL_CONF_INT)
+    {
+        *broker_port = AXIS2_QPID_DEFAULT_BROKER_PORT;
+    }
+    property = axutil_property_create_with_args(env, AXIS2_SCOPE_APPLICATION, 0, 0,
+        (void*)broker_port);
+    axis2_conf_ctx_set_property(receiver_resource_pack->conf_ctx, env,
+        AXIS2_AMQP_CONF_CTX_PROPERTY_BROKER_PORT, property);
+
+    return AXIS2_SUCCESS;
+}
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL 
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axis2_amqp_receiver_start(
-	axis2_transport_receiver_t* receiver,
-	const axutil_env_t* env)
+    axis2_transport_receiver_t* receiver,
+    const axutil_env_t* env)
 {
-	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-	axis2_status_t status = AXIS2_FAILURE;
+    axis2_status_t status = AXIS2_FAILURE;
 
-	axis2_amqp_receiver_resource_pack_t* amqp_receiver_resource_pack = NULL;
-	axis2_qpid_receiver_resource_pack_t* qpid_receiver_resource_pack = NULL;
-	
-	amqp_receiver_resource_pack = AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK(receiver);
+    axis2_amqp_receiver_resource_pack_t* amqp_receiver_resource_pack = NULL;
+    axis2_qpid_receiver_resource_pack_t* qpid_receiver_resource_pack = NULL;
 
-	/* Create Qpid Receiver */
-	qpid_receiver_resource_pack = axis2_qpid_receiver_create(env,
-															 amqp_receiver_resource_pack->conf_ctx);
+    amqp_receiver_resource_pack = AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK(receiver);
 
-	if (qpid_receiver_resource_pack)
-	{
-		amqp_receiver_resource_pack->qpid_receiver = qpid_receiver_resource_pack;
+    /* Create Qpid Receiver */
+    qpid_receiver_resource_pack = axis2_qpid_receiver_create(env,
+        amqp_receiver_resource_pack->conf_ctx);
 
-		status = axis2_qpid_receiver_start(qpid_receiver_resource_pack, env);
-	}
+    if(qpid_receiver_resource_pack)
+    {
+        amqp_receiver_resource_pack->qpid_receiver = qpid_receiver_resource_pack;
 
-	return status;
-}
+        status = axis2_qpid_receiver_start(qpid_receiver_resource_pack, env);
+    }
 
+    return status;
+}
 
-AXIS2_EXTERN axis2_endpoint_ref_t* AXIS2_CALL 
+AXIS2_EXTERN axis2_endpoint_ref_t* AXIS2_CALL
 axis2_amqp_receiver_get_reply_to_epr(
-	axis2_transport_receiver_t* receiver,
-	const axutil_env_t* env,
-	const axis2_char_t* svc_name)
+    axis2_transport_receiver_t* receiver,
+    const axutil_env_t* env,
+    const axis2_char_t* svc_name)
 {
-	return NULL;
+    return NULL;
 }
 
-
-AXIS2_EXTERN axis2_conf_ctx_t* AXIS2_CALL 
+AXIS2_EXTERN axis2_conf_ctx_t* AXIS2_CALL
 axis2_amqp_receiver_get_conf_ctx(
-	axis2_transport_receiver_t* receiver,
-	const axutil_env_t* env)
+    axis2_transport_receiver_t* receiver,
+    const axutil_env_t* env)
 {
-	AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_ENV_CHECK(env, NULL);
 
-	return AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK(receiver)->conf_ctx;
+    return AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK(receiver)->conf_ctx;
 }
 
-
-AXIS2_EXTERN axis2_bool_t AXIS2_CALL 
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
 axis2_amqp_receiver_is_running(
-	axis2_transport_receiver_t* receiver,
-	const axutil_env_t* env)
+    axis2_transport_receiver_t* receiver,
+    const axutil_env_t* env)
 {
-	return AXIS2_TRUE;
+    return AXIS2_TRUE;
 }
 
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL 
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axis2_amqp_receiver_stop(
-	axis2_transport_receiver_t* receiver,
-	const axutil_env_t* env)
+    axis2_transport_receiver_t* receiver,
+    const axutil_env_t* env)
 {
-	return AXIS2_SUCCESS;
+    return AXIS2_SUCCESS;
 }
 
-
-AXIS2_EXTERN void AXIS2_CALL 
+AXIS2_EXTERN void AXIS2_CALL
 axis2_amqp_receiver_free(
-	axis2_transport_receiver_t* receiver,
-	const axutil_env_t* env)
+    axis2_transport_receiver_t* receiver,
+    const axutil_env_t* env)
 {
-	AXIS2_ENV_CHECK(env, void);
+    AXIS2_ENV_CHECK(env, void);
 
-	axis2_amqp_receiver_resource_pack_t* receiver_resource_pack = NULL;
+    axis2_amqp_receiver_resource_pack_t* receiver_resource_pack = NULL;
     receiver_resource_pack = AXIS2_AMQP_RECEIVER_TO_RESOURCE_PACK(receiver);
-    
-	if (receiver_resource_pack->qpid_receiver)
+
+    if(receiver_resource_pack->qpid_receiver)
     {
         axis2_qpid_receiver_free(receiver_resource_pack->qpid_receiver, env);
         receiver_resource_pack->qpid_receiver = NULL;
     }
 
-    if (receiver_resource_pack->conf_ctx_private)
+    if(receiver_resource_pack->conf_ctx_private)
     {
         axis2_conf_ctx_free(receiver_resource_pack->conf_ctx_private, env);
         receiver_resource_pack->conf_ctx_private = NULL;
     }
 
     receiver_resource_pack->conf_ctx = NULL; /* Do not free this. It may be owned by some other object */
-  
-	AXIS2_FREE(env->allocator, receiver_resource_pack);
-}
 
+    AXIS2_FREE(env->allocator, receiver_resource_pack);
+}
 
 /* Library Exports */
 
@@ -247,36 +241,35 @@
 #ifndef AXIS2_STATIC_DEPLOY
 axis2_get_instance(
 #else
-axis2_amqp_receiver_get_instance(
+    axis2_amqp_receiver_get_instance(
 #endif
-	struct axis2_transport_receiver** inst,
-	const axutil_env_t* env)
+    struct axis2_transport_receiver** inst,
+    const axutil_env_t* env)
 {
-	int status = AXIS2_SUCCESS;
+    int status = AXIS2_SUCCESS;
 
-	*inst = axis2_amqp_receiver_create(env, NULL, NULL, AXIS2_QPID_NULL_CONF_INT);
-	if (!(*inst))
-	{
-		status = AXIS2_FAILURE;
-	}
+    *inst = axis2_amqp_receiver_create(env, NULL, NULL, AXIS2_QPID_NULL_CONF_INT);
+    if(!(*inst))
+    {
+        status = AXIS2_FAILURE;
+    }
 
-	return status;
+    return status;
 }
 
-
 AXIS2_EXPORT int
 #ifndef AXIS2_STATIC_DEPLOY
 axis2_remove_instance(
 #else
-axis2_amqp_receiver_remove_instance(
+    axis2_amqp_receiver_remove_instance(
 #endif
-	axis2_transport_receiver_t* inst,
-	const axutil_env_t* env)
+    axis2_transport_receiver_t* inst,
+    const axutil_env_t* env)
 {
-	if (inst)
-	{
-		axis2_transport_receiver_free(inst, env);
-	}
-	
-	return AXIS2_SUCCESS;
+    if(inst)
+    {
+        axis2_transport_receiver_free(inst, env);
+    }
+
+    return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver.cpp
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver.cpp?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver.cpp (original)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver.cpp Tue Aug 18 10:15:49 2009
@@ -25,142 +25,143 @@
 #include <axis2_qpid_receiver.h>
 #include <list>
 
-Axis2QpidReceiver::Axis2QpidReceiver(const axutil_env_t* env,
-									 axis2_conf_ctx_t* conf_ctx)
+Axis2QpidReceiver::Axis2QpidReceiver(
+    const axutil_env_t* env,
+    axis2_conf_ctx_t* conf_ctx)
 {
-	this->env = env;
-	this->conf_ctx = conf_ctx;
+    this->env = env;
+    this->conf_ctx = conf_ctx;
 }
 
+Axis2QpidReceiver::~Axis2QpidReceiver(
+    void)
+{
+}
+
+bool
+Axis2QpidReceiver::start(
+    void)
+{
+    if(!conf_ctx)
+        return false;
 
-Axis2QpidReceiver::~Axis2QpidReceiver(void)
-{}
+    Connection connection;
+    axis2_bool_t serverSide = AXIS2_TRUE;
 
+    serverSide = axis2_amqp_util_conf_ctx_get_server_side(conf_ctx, env);
 
-bool Axis2QpidReceiver::start(void)
-{
-	if (!conf_ctx)
-		return false;
-	
-	Connection connection;
-	axis2_bool_t serverSide = AXIS2_TRUE;
-	
-	serverSide = axis2_amqp_util_conf_ctx_get_server_side(conf_ctx, env);
-
-	while (true)
-	{
-		try
-		{
-			std::list<string> queueNameList;
-			string qpidBrokerIP = axis2_amqp_util_conf_ctx_get_qpid_broker_ip(
-									conf_ctx, env);
-			int qpidBrokerPort = axis2_amqp_util_conf_ctx_get_qpid_broker_port(
-									conf_ctx, env);
-			
-			/* Check if Client Side and Resolve Dynamic Queue Name */
-			if (serverSide == AXIS2_TRUE) /* Server side */
-			{
-				std::cout << "Connecting to Qpid Broker on " << qpidBrokerIP 
-						  << ":" << qpidBrokerPort << " ... ";
-			}
-
-			/* Create Connection to Qpid Broker */
-			connection.open(qpidBrokerIP, qpidBrokerPort);
-			
-			if (serverSide == AXIS2_TRUE) /* Server side */
-			{
-				/* Create queue for each service. Queue name is equal to service name */
-				axis2_conf_t* conf = axis2_conf_ctx_get_conf(conf_ctx, env);
-				if (!conf)
-					return false;
-				
-				axutil_hash_t* serviceMap = axis2_conf_get_all_svcs(conf, env);
-				if (!serviceMap)
-					return false;
-					
-				axutil_hash_index_t* serviceHI = NULL;
-				void* serviceValue = NULL;
-				
-				for (serviceHI = axutil_hash_first(serviceMap, env);
-					 serviceHI; serviceHI = axutil_hash_next(env, serviceHI))
-				{
-					axutil_hash_this(serviceHI, NULL, NULL, &serviceValue);
-					
-					axis2_svc_t* service = (axis2_svc_t*)serviceValue;
-					if (!service)
-						return false;
-					
-					axis2_char_t* serviceName = axutil_qname_get_localpart(
-							axis2_svc_get_qname(service, env), env);
-					if (!serviceName)
-						return false;
-					
-					queueNameList.push_back(serviceName);
-				}
-
-				std::cout << "CONNECTED" << std::endl;
-			}
-			else /* Client side separate listener in dual-channel case */
-			{
-				string queueName = axis2_amqp_util_conf_ctx_get_dual_channel_queue_name(
-									conf_ctx, env);
-
-				queueNameList.push_back(queueName);
-			}
-			
-			/* Create new session */
-			Session session = connection.newSession();
-
-			/* Create Subscription manager */
-			SubscriptionManager subscriptionManager(session);
-			
-			Axis2QpidReceiverListener qpidReceiverListener(env, conf_ctx);
-
-			/* Subscribe to queues */
-			while (!queueNameList.empty())
-			{
-				string queueName = queueNameList.front();
-
-				session.queueDeclare(arg::queue = queueName, arg::autoDelete = true);
-				session.exchangeBind(arg::exchange = AXIS2_AMQP_EXCHANGE_DIRECT,
-									 arg::queue = queueName,
-									 arg::bindingKey = queueName);
-				
-				subscriptionManager.subscribe(qpidReceiverListener, queueName);
-
-				queueNameList.pop_front();
-			}
-	
-			/* Listen and Wait */
-			if (serverSide == AXIS2_TRUE) /* Server side */
-			{
-				std::cout << "Started Axis2 AMQP Server ..." << std::endl;
-			}
-			
-			subscriptionManager.run();
-
-			return true;
-		}
-		catch (const std::exception& e)
-		{
-			connection.close();
-
-			if (serverSide == AXIS2_TRUE) /* Server side */
-			{
-				std::cout << "FAILED" << std::endl;
-			}
-
-			sleep(5);
-		}
-	}
+    while(true)
+    {
+        try
+        {
+            std::list<string> queueNameList;
+            string qpidBrokerIP = axis2_amqp_util_conf_ctx_get_qpid_broker_ip(conf_ctx, env);
+            int qpidBrokerPort = axis2_amqp_util_conf_ctx_get_qpid_broker_port(conf_ctx, env);
+
+            /* Check if Client Side and Resolve Dynamic Queue Name */
+            if(serverSide == AXIS2_TRUE) /* Server side */
+            {
+                std::cout << "Connecting to Qpid Broker on " << qpidBrokerIP << ":"
+                    << qpidBrokerPort << " ... ";
+            }
+
+            /* Create Connection to Qpid Broker */
+            connection.open(qpidBrokerIP, qpidBrokerPort);
+
+            if(serverSide == AXIS2_TRUE) /* Server side */
+            {
+                /* Create queue for each service. Queue name is equal to service name */
+                axis2_conf_t* conf = axis2_conf_ctx_get_conf(conf_ctx, env);
+                if(!conf)
+                    return false;
+
+                axutil_hash_t* serviceMap = axis2_conf_get_all_svcs(conf, env);
+                if(!serviceMap)
+                    return false;
+
+                axutil_hash_index_t* serviceHI = NULL;
+                void* serviceValue = NULL;
+
+                for(serviceHI = axutil_hash_first(serviceMap, env); serviceHI; serviceHI
+                    = axutil_hash_next(env, serviceHI))
+                {
+                    axutil_hash_this(serviceHI, NULL, NULL, &serviceValue);
+
+                    axis2_svc_t* service = (axis2_svc_t*)serviceValue;
+                    if(!service)
+                        return false;
+
+                    axis2_char_t* serviceName = axutil_qname_get_localpart(axis2_svc_get_qname(
+                        service, env), env);
+                    if(!serviceName)
+                        return false;
+
+                    queueNameList.push_back(serviceName);
+                }
+
+                std::cout << "CONNECTED" << std::endl;
+            }
+            else /* Client side separate listener in dual-channel case */
+            {
+                string queueName = axis2_amqp_util_conf_ctx_get_dual_channel_queue_name(conf_ctx,
+                    env);
+
+                queueNameList.push_back(queueName);
+            }
+
+            /* Create new session */
+            Session session = connection.newSession();
+
+            /* Create Subscription manager */
+            SubscriptionManager subscriptionManager(session);
+
+            Axis2QpidReceiverListener qpidReceiverListener(env, conf_ctx);
+
+            /* Subscribe to queues */
+            while(!queueNameList.empty())
+            {
+                string queueName = queueNameList.front();
+
+                session.queueDeclare(arg::queue = queueName, arg::autoDelete = true);
+                session.exchangeBind(arg::exchange = AXIS2_AMQP_EXCHANGE_DIRECT, arg::queue
+                    = queueName, arg::bindingKey = queueName);
+
+                subscriptionManager.subscribe(qpidReceiverListener, queueName);
+
+                queueNameList.pop_front();
+            }
+
+            /* Listen and Wait */
+            if(serverSide == AXIS2_TRUE) /* Server side */
+            {
+                std::cout << "Started Axis2 AMQP Server ..." << std::endl;
+            }
+
+            subscriptionManager.run();
+
+            return true;
+        }
+        catch(const std::exception& e)
+        {
+            connection.close();
+
+            if(serverSide == AXIS2_TRUE) /* Server side */
+            {
+                std::cout << "FAILED" << std::endl;
+            }
+
+            sleep(5);
+        }
+    }
 
-	connection.close();
+    connection.close();
 
-	return false;
+    return false;
 }
 
-
-bool Axis2QpidReceiver::shutdown(void)
+bool
+Axis2QpidReceiver::shutdown(
+    void)
 {
-	return true;
+    return true;
 }

Modified: webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver_listener.cpp
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver_listener.cpp?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver_listener.cpp (original)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/axis2_qpid_receiver_listener.cpp Tue Aug 18 10:15:49 2009
@@ -23,100 +23,101 @@
 #include <string>
 
 Axis2QpidReceiverListener::Axis2QpidReceiverListener(
-		const axutil_env_t* env,
-		axis2_conf_ctx_t*   conf_ctx)
+    const axutil_env_t* env,
+    axis2_conf_ctx_t* conf_ctx)
 {
-	this->env = env;
-	this->conf_ctx = conf_ctx;
+    this->env = env;
+    this->conf_ctx = conf_ctx;
 }
 
+Axis2QpidReceiverListener::~Axis2QpidReceiverListener(
+    void)
+{
+}
 
-Axis2QpidReceiverListener::~Axis2QpidReceiverListener(void)
-{}
-
-
-void Axis2QpidReceiverListener::received(Message& message)
+void
+Axis2QpidReceiverListener::received(
+    Message& message)
 {
-	AXIS2_ENV_CHECK(env, void);
+    AXIS2_ENV_CHECK(env, void);
 
-	axis2_amqp_request_processor_resource_pack_t* request_data = NULL;
+    axis2_amqp_request_processor_resource_pack_t* request_data = NULL;
 #ifdef AXIS2_SVR_MULTI_THREADED
-	axutil_thread_t* worker_thread = NULL;
+    axutil_thread_t* worker_thread = NULL;
 #endif
 
-	request_data = (axis2_amqp_request_processor_resource_pack_t*)
-					AXIS2_MALLOC(env->allocator, 
-								  sizeof(axis2_amqp_request_processor_resource_pack_t));
-
-	if (!request_data)
-	{
-		AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Memory Allocation Error");
-		return;
-	}
-
-	request_data->env = (axutil_env_t*)env;
-	request_data->conf_ctx = conf_ctx;
-
-	/* Create a Local Copy of Request Content */
-	std::string message_data = message.getData();
-	axis2_char_t* request_content = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
-																message_data.size());
-	memcpy(request_content, message_data.c_str(), message_data.size());
-
-	request_data->request_content = request_content;
-	request_data->content_length = message_data.size();
-
-	/* Set ReplyTo */
-	request_data->reply_to = NULL;
-	if (message.getMessageProperties().hasReplyTo())
-	{
-		/* Create a Local Copy of ReplyTo */
-		std::string reply_to_tmp = message.getMessageProperties().getReplyTo().getRoutingKey();
-		axis2_char_t* reply_to = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
-															 reply_to_tmp.size() + 1);
-		strcpy(reply_to, reply_to_tmp.c_str());
-
-		request_data->reply_to = reply_to;
-	}
-
-	/* Copy AMQP headers */
-	/* Content-Type */
-	request_data->content_type = NULL;
-	std::string content_type_tmp = message.getHeaders().getAsString(AXIS2_AMQP_HEADER_CONTENT_TYPE);
-	if (!content_type_tmp.empty())
-	{
-		axis2_char_t* content_type = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
-															     content_type_tmp.size() + 1);
-		strcpy(content_type, content_type_tmp.c_str());
-
-		request_data->content_type = content_type;
-	}
-	
-	/* SOAPAction */
-	request_data->soap_action = NULL;
-	std::string soap_action_tmp = message.getHeaders().getAsString(AXIS2_AMQP_HEADER_SOAP_ACTION);
-	if (!soap_action_tmp.empty())
-	{
-		axis2_char_t* soap_action = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
-															    soap_action_tmp.size() + 1);
-		strcpy(soap_action, soap_action_tmp.c_str());
+    request_data = (axis2_amqp_request_processor_resource_pack_t*)AXIS2_MALLOC(env->allocator,
+        sizeof(axis2_amqp_request_processor_resource_pack_t));
+
+    if(!request_data)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Memory Allocation Error");
+        return;
+    }
+
+    request_data->env = (axutil_env_t*)env;
+    request_data->conf_ctx = conf_ctx;
+
+    /* Create a Local Copy of Request Content */
+    std::string message_data = message.getData();
+    axis2_char_t* request_content =
+        (axis2_char_t*)AXIS2_MALLOC(env->allocator, message_data.size());
+    memcpy(request_content, message_data.c_str(), message_data.size());
+
+    request_data->request_content = request_content;
+    request_data->content_length = message_data.size();
+
+    /* Set ReplyTo */
+    request_data->reply_to = NULL;
+    if(message.getMessageProperties().hasReplyTo())
+    {
+        /* Create a Local Copy of ReplyTo */
+        std::string reply_to_tmp = message.getMessageProperties().getReplyTo().getRoutingKey();
+        axis2_char_t* reply_to = (axis2_char_t*)AXIS2_MALLOC(env->allocator, reply_to_tmp.size()
+            + 1);
+        strcpy(reply_to, reply_to_tmp.c_str());
+
+        request_data->reply_to = reply_to;
+    }
+
+    /* Copy AMQP headers */
+    /* Content-Type */
+    request_data->content_type = NULL;
+    std::string content_type_tmp = message.getHeaders().getAsString(AXIS2_AMQP_HEADER_CONTENT_TYPE);
+    if(!content_type_tmp.empty())
+    {
+        axis2_char_t* content_type = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
+            content_type_tmp.size() + 1);
+        strcpy(content_type, content_type_tmp.c_str());
+
+        request_data->content_type = content_type;
+    }
+
+    /* SOAPAction */
+    request_data->soap_action = NULL;
+    std::string soap_action_tmp = message.getHeaders().getAsString(AXIS2_AMQP_HEADER_SOAP_ACTION);
+    if(!soap_action_tmp.empty())
+    {
+        axis2_char_t* soap_action = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
+            soap_action_tmp.size() + 1);
+        strcpy(soap_action, soap_action_tmp.c_str());
 
-		request_data->soap_action = soap_action;
-	}
+        request_data->soap_action = soap_action;
+    }
 
 #ifdef AXIS2_SVR_MULTI_THREADED
-	worker_thread = axutil_thread_pool_get_thread(env->thread_pool,
-												  axis2_amqp_request_processor_thread_function,
-												  (void*)request_data);
-
-	if (!worker_thread)
-	{
-		AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Create Thread");
-		return;
-	}
+    worker_thread = axutil_thread_pool_get_thread(env->thread_pool,
+        axis2_amqp_request_processor_thread_function,
+        (void*)request_data);
+
+    if (!worker_thread)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Create Thread");
+        return;
+    }
 
-	axutil_thread_pool_thread_detach(env->thread_pool, worker_thread);
+    axutil_thread_pool_thread_detach(env->thread_pool, worker_thread);
 #else
-	axis2_amqp_request_processor_thread_function(NULL, (void*)request_data);
+    axis2_amqp_request_processor_thread_function(NULL, (void*)request_data);
 #endif
 }

Modified: webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/axis2_amqp_request_processor.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/axis2_amqp_request_processor.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/axis2_amqp_request_processor.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/amqp/receiver/qpid_receiver/request_processor/axis2_amqp_request_processor.c Tue Aug 18 10:15:49 2009
@@ -27,121 +27,116 @@
 
 void* AXIS2_THREAD_FUNC
 axis2_amqp_request_processor_thread_function(
-	axutil_thread_t* thread,
-	void* request_data)
+    axutil_thread_t* thread,
+    void* request_data)
 {
-	axis2_status_t status = AXIS2_FAILURE;
-	axutil_env_t* env = NULL;
-	axutil_env_t* thread_env = NULL;
-	axis2_amqp_request_processor_resource_pack_t* request_resource_pack = NULL;
+    axis2_status_t status = AXIS2_FAILURE;
+    axutil_env_t* env = NULL;
+    axutil_env_t* thread_env = NULL;
+    axis2_amqp_request_processor_resource_pack_t* request_resource_pack = NULL;
 
 #ifndef WIN32
 #ifdef AXIS2_SVR_MULTI_THREADED
-	signal(SIGPIPE, SIG_IGN);
+    signal(SIGPIPE, SIG_IGN);
 #endif
 #endif
 
-	request_resource_pack = (axis2_amqp_request_processor_resource_pack_t*)request_data;
-	
-	env = request_resource_pack->env;
-	thread_env = axutil_init_thread_env(env);
-
-	/* Process Request */
-	status = axis2_amqp_process_request(thread_env, request_resource_pack);
-
-	if (status == AXIS2_SUCCESS)
-	{
-		AXIS2_LOG_INFO(thread_env->log, "Request Processed Successfully");
-	}
-	else
-	{
-		 AXIS2_LOG_WARNING(thread_env->log, AXIS2_LOG_SI, "Error while Processing Request");
-	}
-
-	AXIS2_FREE(thread_env->allocator, request_resource_pack->request_content);
-	AXIS2_FREE(thread_env->allocator, request_resource_pack->reply_to);
-	AXIS2_FREE(thread_env->allocator, request_resource_pack->content_type);
-	AXIS2_FREE(thread_env->allocator, request_resource_pack->soap_action);
-	
-	AXIS2_FREE(thread_env->allocator, request_resource_pack);
-
-	if (thread_env)
-	{
-		thread_env = NULL;
-	}
+    request_resource_pack = (axis2_amqp_request_processor_resource_pack_t*)request_data;
+
+    env = request_resource_pack->env;
+    thread_env = axutil_init_thread_env(env);
+
+    /* Process Request */
+    status = axis2_amqp_process_request(thread_env, request_resource_pack);
+
+    if(status == AXIS2_SUCCESS)
+    {
+        AXIS2_LOG_INFO(thread_env->log, "Request Processed Successfully");
+    }
+    else
+    {
+        AXIS2_LOG_WARNING(thread_env->log, AXIS2_LOG_SI, "Error while Processing Request");
+    }
+
+    AXIS2_FREE(thread_env->allocator, request_resource_pack->request_content);
+    AXIS2_FREE(thread_env->allocator, request_resource_pack->reply_to);
+    AXIS2_FREE(thread_env->allocator, request_resource_pack->content_type);
+    AXIS2_FREE(thread_env->allocator, request_resource_pack->soap_action);
+
+    AXIS2_FREE(thread_env->allocator, request_resource_pack);
+
+    if(thread_env)
+    {
+        thread_env = NULL;
+    }
 
 #ifdef AXIS2_SVR_MULTI_THREADED
-	axutil_thread_pool_exit_thread(env->thread_pool, thread);
+    axutil_thread_pool_exit_thread(env->thread_pool, thread);
 #endif
 
-	return NULL;
+    return NULL;
 }
 
-
 axis2_status_t
 axis2_amqp_process_request(
-	const axutil_env_t* env,
-	axis2_amqp_request_processor_resource_pack_t* request_resource_pack)
+    const axutil_env_t* env,
+    axis2_amqp_request_processor_resource_pack_t* request_resource_pack)
 {
-	axiom_xml_reader_t* xml_reader = NULL;
-	axiom_stax_builder_t* stax_builder = NULL;
-	axiom_soap_builder_t* soap_builder = NULL;
-	axis2_transport_out_desc_t* out_desc = NULL;
-	axis2_transport_in_desc_t* in_desc = NULL;
-	axis2_msg_ctx_t* msg_ctx = NULL;
-	axiom_soap_envelope_t* soap_envelope = NULL;
-	axis2_engine_t* engine = NULL;
-	const axis2_char_t* soap_ns_uri = NULL;
-	axis2_bool_t is_soap_11 = AXIS2_FALSE;
-	axis2_char_t *soap_body_str = NULL;
-	int soap_body_len = 0;
-	axis2_bool_t is_mtom = AXIS2_FALSE;
-	axis2_status_t status = AXIS2_FAILURE;
-	axutil_hash_t *binary_data_map = NULL;
-	axiom_soap_body_t *soap_body = NULL;
-	axutil_property_t* reply_to_property = NULL;
-
-	/* Create msg_ctx */
-	if (!request_resource_pack->conf_ctx)
-	{
-		AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Conf Context not Available");
-		return AXIS2_FAILURE;
-	}
-
-	out_desc = axis2_conf_get_transport_out(
-			axis2_conf_ctx_get_conf(request_resource_pack->conf_ctx, env),
-			env, AXIS2_TRANSPORT_ENUM_AMQP);
-	if (!out_desc)
-	{
-		AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Transport Out Descriptor not Found");
-		return AXIS2_FAILURE;
-	}
-
-	in_desc = axis2_conf_get_transport_in(
-			axis2_conf_ctx_get_conf(request_resource_pack->conf_ctx, env),
-			env, AXIS2_TRANSPORT_ENUM_AMQP);
-	if (!in_desc)
-	{
-		AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Transport In Descriptor not Found");
-		return AXIS2_FAILURE;
-	}
-
-	/* Create msg_ctx */
-	msg_ctx = axis2_msg_ctx_create(env, request_resource_pack->conf_ctx, in_desc, out_desc);
-	
-	axis2_msg_ctx_set_server_side(msg_ctx, env, AXIS2_TRUE);
-	
-	/* Handle MTOM */
-	if (strstr(request_resource_pack->content_type, AXIS2_AMQP_HEADER_ACCEPT_MULTIPART_RELATED))
-	{
-		axis2_char_t* mime_boundary = 
-			axis2_amqp_util_get_value_from_content_type(env,
-					request_resource_pack->content_type,
-					AXIS2_AMQP_HEADER_CONTENT_TYPE_MIME_BOUNDARY);
-
-		if (mime_boundary)
-		{
-			axiom_mime_parser_t *mime_parser = NULL;
+    axiom_xml_reader_t* xml_reader = NULL;
+    axiom_stax_builder_t* stax_builder = NULL;
+    axiom_soap_builder_t* soap_builder = NULL;
+    axis2_transport_out_desc_t* out_desc = NULL;
+    axis2_transport_in_desc_t* in_desc = NULL;
+    axis2_msg_ctx_t* msg_ctx = NULL;
+    axiom_soap_envelope_t* soap_envelope = NULL;
+    axis2_engine_t* engine = NULL;
+    const axis2_char_t* soap_ns_uri = NULL;
+    axis2_bool_t is_soap_11 = AXIS2_FALSE;
+    axis2_char_t *soap_body_str = NULL;
+    int soap_body_len = 0;
+    axis2_bool_t is_mtom = AXIS2_FALSE;
+    axis2_status_t status = AXIS2_FAILURE;
+    axutil_hash_t *binary_data_map = NULL;
+    axiom_soap_body_t *soap_body = NULL;
+    axutil_property_t* reply_to_property = NULL;
+
+    /* Create msg_ctx */
+    if(!request_resource_pack->conf_ctx)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Conf Context not Available");
+        return AXIS2_FAILURE;
+    }
+
+    out_desc = axis2_conf_get_transport_out(axis2_conf_ctx_get_conf(
+        request_resource_pack->conf_ctx, env), env, AXIS2_TRANSPORT_ENUM_AMQP);
+    if(!out_desc)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Transport Out Descriptor not Found");
+        return AXIS2_FAILURE;
+    }
+
+    in_desc = axis2_conf_get_transport_in(axis2_conf_ctx_get_conf(request_resource_pack->conf_ctx,
+        env), env, AXIS2_TRANSPORT_ENUM_AMQP);
+    if(!in_desc)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Transport In Descriptor not Found");
+        return AXIS2_FAILURE;
+    }
+
+    /* Create msg_ctx */
+    msg_ctx = axis2_msg_ctx_create(env, request_resource_pack->conf_ctx, in_desc, out_desc);
+
+    axis2_msg_ctx_set_server_side(msg_ctx, env, AXIS2_TRUE);
+
+    /* Handle MTOM */
+    if(strstr(request_resource_pack->content_type, AXIS2_AMQP_HEADER_ACCEPT_MULTIPART_RELATED))
+    {
+        axis2_char_t* mime_boundary = axis2_amqp_util_get_value_from_content_type(env,
+            request_resource_pack->content_type, AXIS2_AMQP_HEADER_CONTENT_TYPE_MIME_BOUNDARY);
+
+        if(mime_boundary)
+        {
+            axiom_mime_parser_t *mime_parser = NULL;
             int soap_body_len = 0;
             axutil_param_t *buffer_size_param = NULL;
             axutil_param_t *max_buffers_param = NULL;
@@ -153,23 +148,23 @@
             int num = 0;
 
             mime_parser = axiom_mime_parser_create(env);
-            
-			buffer_size_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_MTOM_BUFFER_SIZE);
-            if (buffer_size_param)
+
+            buffer_size_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_MTOM_BUFFER_SIZE);
+            if(buffer_size_param)
             {
                 value_size = (axis2_char_t*)axutil_param_get_value(buffer_size_param, env);
-                if (value_size)
+                if(value_size)
                 {
                     size = atoi(value_size);
                     axiom_mime_parser_set_buffer_size(mime_parser, env, size);
                 }
             }
-            
+
             max_buffers_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_MTOM_MAX_BUFFERS);
-            if (max_buffers_param)
+            if(max_buffers_param)
             {
                 value_num = (axis2_char_t*)axutil_param_get_value(max_buffers_param, env);
-                if (value_num)
+                if(value_num)
                 {
                     num = atoi(value_num);
                     axiom_mime_parser_set_max_buffers(mime_parser, env, num);
@@ -177,163 +172,163 @@
             }
 
             /* If this paramter is there mime_parser will cached the attachment 
-             * using to the directory for large attachments. */    
+             * using to the directory for large attachments. */
             attachment_dir_param = axis2_msg_ctx_get_parameter(msg_ctx, env, AXIS2_ATTACHMENT_DIR);
-            if (attachment_dir_param)
+            if(attachment_dir_param)
             {
                 value_dir = (axis2_char_t*)axutil_param_get_value(attachment_dir_param, env);
-                if (value_dir)
+                if(value_dir)
                 {
                     axiom_mime_parser_set_attachment_dir(mime_parser, env, value_dir);
                 }
             }
 
-            if (mime_parser)
+            if(mime_parser)
             {
-				axis2_callback_info_t *callback_ctx = NULL;
-				axutil_stream_t *stream = NULL;
+                axis2_callback_info_t *callback_ctx = NULL;
+                axutil_stream_t *stream = NULL;
 
-				callback_ctx = AXIS2_MALLOC(env->allocator, sizeof(axis2_callback_info_t));
+                callback_ctx = AXIS2_MALLOC(env->allocator, sizeof(axis2_callback_info_t));
 
-            	stream = axutil_stream_create_basic(env);
-            	if (stream)
-            	{
-					axutil_stream_write(stream, env, request_resource_pack->request_content, 
-							request_resource_pack->content_length);
-                	callback_ctx->env = env;
-                	callback_ctx->in_stream = stream;
-                	callback_ctx->content_length = request_resource_pack->content_length;
-                	callback_ctx->unread_len = request_resource_pack->content_length;
-                	callback_ctx->chunked_stream = NULL;
-            	}
+                stream = axutil_stream_create_basic(env);
+                if(stream)
+                {
+                    axutil_stream_write(stream, env, request_resource_pack->request_content,
+                        request_resource_pack->content_length);
+                    callback_ctx->env = env;
+                    callback_ctx->in_stream = stream;
+                    callback_ctx->content_length = request_resource_pack->content_length;
+                    callback_ctx->unread_len = request_resource_pack->content_length;
+                    callback_ctx->chunked_stream = NULL;
+                }
 
                 /*binary_data_map = 
-                    axiom_mime_parser_parse(mime_parser, env,
-                                            axis2_amqp_util_on_data_request,
-                                            (void*)callback_ctx,
-                                            mime_boundary);*/
-                if (!binary_data_map)
+                 axiom_mime_parser_parse(mime_parser, env,
+                 axis2_amqp_util_on_data_request,
+                 (void*)callback_ctx,
+                 mime_boundary);*/
+                if(!binary_data_map)
                 {
                     return AXIS2_FAILURE;
                 }
-                
+
                 soap_body_str = axiom_mime_parser_get_soap_body_str(mime_parser, env);
-				soap_body_len = axiom_mime_parser_get_soap_body_len(mime_parser, env);
+                soap_body_len = axiom_mime_parser_get_soap_body_len(mime_parser, env);
 
-				axutil_stream_free(stream, env);
-				AXIS2_FREE(env->allocator, callback_ctx);
-				axiom_mime_parser_free(mime_parser, env);
+                axutil_stream_free(stream, env);
+                AXIS2_FREE(env->allocator, callback_ctx);
+                axiom_mime_parser_free(mime_parser, env);
             }
 
-			AXIS2_FREE(env->allocator, mime_boundary);
-		}
+            AXIS2_FREE(env->allocator, mime_boundary);
+        }
 
-		is_mtom = AXIS2_TRUE;
-	}
-	else
-	{
-		soap_body_str = request_resource_pack->request_content;
-		soap_body_len = request_resource_pack->content_length;
-	}
-
-	soap_body_len = axutil_strlen(soap_body_str);
-
-	xml_reader = axiom_xml_reader_create_for_memory(env, soap_body_str, soap_body_len,
-			NULL, AXIS2_XML_PARSER_TYPE_BUFFER);
-	if (!xml_reader)
-	{
-		AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Create XML Reader");
-		return AXIS2_FAILURE;
-	}
-	
-	stax_builder = axiom_stax_builder_create(env, xml_reader);
-	if (!stax_builder)
-	{
-		AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Create StAX Builder");
-		return AXIS2_FAILURE;
-	}
-
-	soap_ns_uri = AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
-
-	if (request_resource_pack->content_type)
-	{
-		if (strstr(request_resource_pack->content_type, AXIS2_AMQP_HEADER_ACCEPT_TEXT_XML))
-		{
-			is_soap_11 = AXIS2_TRUE;
-			soap_ns_uri = AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI;
-		}
-		/*if (strstr(request_resource_pack->content_type, AXIS2_AMQP_HEADER_ACCEPT_APPL_SOAP))
-		{
-			is_soap_11 = AXIS2_FALSE;
-			soap_ns_uri = AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
-		}
-		else if (strstr(request_resource_pack->content_type, AXIS2_AMQP_HEADER_ACCEPT_TEXT_XML))
-		{
-			is_soap_11 = AXIS2_TRUE;
-			soap_ns_uri = AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI;
-		}*/
-	}
-
-	soap_builder = axiom_soap_builder_create(env, stax_builder, soap_ns_uri);
-	if (!soap_builder)
-	{
-		AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Create SOAP Builder");
-		return AXIS2_FAILURE;
-	}
-	
-	if (binary_data_map)
-	{
-		axiom_soap_builder_set_mime_body_parts(soap_builder, env, binary_data_map);
-	}
-
-	soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
-	axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);
-
-	soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
-	
-	if (!soap_body)
-	{
-		return AXIS2_FAILURE;
-	}
-
-	/* SOAPAction */
-	if (request_resource_pack->soap_action)
-	{
-		axis2_msg_ctx_set_soap_action(msg_ctx, env, 
-				axutil_string_create(env, request_resource_pack->soap_action));
-	}
-
-	/* SOAP version */
-	axis2_msg_ctx_set_is_soap_11(msg_ctx, env, is_soap_11);
-
-	/* Set ReplyTo in the msg_ctx as a property. This is used by the server when
-	 * 1. WS-A is not in use 
-	 * 2. ReplyTo is an anonymous EPR - Sandesha2/Dual-channel */
-	reply_to_property = axutil_property_create_with_args(env, AXIS2_SCOPE_REQUEST, 0, 0,
-			(void*)request_resource_pack->reply_to);
-	axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_AMQP_MSG_CTX_PROPERTY_REPLY_TO, 
-			reply_to_property);
-
-	engine = axis2_engine_create(env, request_resource_pack->conf_ctx);
-
-	if (AXIS2_TRUE == axiom_soap_body_has_fault(soap_body, env))
-	{
-		status = axis2_engine_receive_fault(engine, env, msg_ctx);
-	}
-	else
-	{
-		status = axis2_engine_receive(engine, env, msg_ctx);
-	}
-
-	if (engine)
-	{
-		axis2_engine_free(engine, env);
-	}
-
-	if (soap_body_str && is_mtom)
-	{
-		AXIS2_FREE(env->allocator, soap_body_str);
-	}
+        is_mtom = AXIS2_TRUE;
+    }
+    else
+    {
+        soap_body_str = request_resource_pack->request_content;
+        soap_body_len = request_resource_pack->content_length;
+    }
+
+    soap_body_len = axutil_strlen(soap_body_str);
+
+    xml_reader = axiom_xml_reader_create_for_memory(env, soap_body_str, soap_body_len, NULL,
+        AXIS2_XML_PARSER_TYPE_BUFFER);
+    if(!xml_reader)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Create XML Reader");
+        return AXIS2_FAILURE;
+    }
+
+    stax_builder = axiom_stax_builder_create(env, xml_reader);
+    if(!stax_builder)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Create StAX Builder");
+        return AXIS2_FAILURE;
+    }
+
+    soap_ns_uri = AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
+
+    if(request_resource_pack->content_type)
+    {
+        if(strstr(request_resource_pack->content_type, AXIS2_AMQP_HEADER_ACCEPT_TEXT_XML))
+        {
+            is_soap_11 = AXIS2_TRUE;
+            soap_ns_uri = AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI;
+        }
+        /*if (strstr(request_resource_pack->content_type, AXIS2_AMQP_HEADER_ACCEPT_APPL_SOAP))
+         {
+         is_soap_11 = AXIS2_FALSE;
+         soap_ns_uri = AXIOM_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
+         }
+         else if (strstr(request_resource_pack->content_type, AXIS2_AMQP_HEADER_ACCEPT_TEXT_XML))
+         {
+         is_soap_11 = AXIS2_TRUE;
+         soap_ns_uri = AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI;
+         }*/
+    }
+
+    soap_builder = axiom_soap_builder_create(env, stax_builder, soap_ns_uri);
+    if(!soap_builder)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Failed to Create SOAP Builder");
+        return AXIS2_FAILURE;
+    }
+
+    if(binary_data_map)
+    {
+        axiom_soap_builder_set_mime_body_parts(soap_builder, env, binary_data_map);
+    }
+
+    soap_envelope = axiom_soap_builder_get_soap_envelope(soap_builder, env);
+    axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_envelope);
+
+    soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
+
+    if(!soap_body)
+    {
+        return AXIS2_FAILURE;
+    }
+
+    /* SOAPAction */
+    if(request_resource_pack->soap_action)
+    {
+        axis2_msg_ctx_set_soap_action(msg_ctx, env, axutil_string_create(env,
+            request_resource_pack->soap_action));
+    }
+
+    /* SOAP version */
+    axis2_msg_ctx_set_is_soap_11(msg_ctx, env, is_soap_11);
+
+    /* Set ReplyTo in the msg_ctx as a property. This is used by the server when
+     * 1. WS-A is not in use
+     * 2. ReplyTo is an anonymous EPR - Sandesha2/Dual-channel */
+    reply_to_property = axutil_property_create_with_args(env, AXIS2_SCOPE_REQUEST, 0, 0,
+        (void*)request_resource_pack->reply_to);
+    axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_AMQP_MSG_CTX_PROPERTY_REPLY_TO,
+        reply_to_property);
+
+    engine = axis2_engine_create(env, request_resource_pack->conf_ctx);
+
+    if(AXIS2_TRUE == axiom_soap_body_has_fault(soap_body, env))
+    {
+        status = axis2_engine_receive_fault(engine, env, msg_ctx);
+    }
+    else
+    {
+        status = axis2_engine_receive(engine, env, msg_ctx);
+    }
+
+    if(engine)
+    {
+        axis2_engine_free(engine, env);
+    }
+
+    if(soap_body_str && is_mtom)
+    {
+        AXIS2_FREE(env->allocator, soap_body_str);
+    }
 
-	return status;
+    return status;
 }



Mime
View raw message