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

svn commit: r389376 - in /webservices/axis2/trunk/c: include/ modules/core/transport/http/ modules/core/transport/http/receiver/ modules/core/transport/http/sender/ modules/core/transport/http/server/simple_axis2_server/ modules/util/

Author: sahan
Date: Mon Mar 27 19:04:49 2006
New Revision: 389376

URL: http://svn.apache.org/viewcvs?rev=389376&view=rev
Log:
Correct behaviour of sender in a fault. Correcting some spelling mistakes. Memory leak fixes 

Modified:
    webservices/axis2/trunk/c/include/axis2_error.h
    webservices/axis2/trunk/c/include/axis2_http_simple_response.h
    webservices/axis2/trunk/c/include/axis2_http_transport.h
    webservices/axis2/trunk/c/modules/core/transport/http/http_worker.c
    webservices/axis2/trunk/c/modules/core/transport/http/receiver/simple_http_svr_conn.c
    webservices/axis2/trunk/c/modules/core/transport/http/sender/http_client.c
    webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c
    webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c
    webservices/axis2/trunk/c/modules/core/transport/http/server/simple_axis2_server/http_server_main.c
    webservices/axis2/trunk/c/modules/util/allocator.c
    webservices/axis2/trunk/c/modules/util/dir_handler.c
    webservices/axis2/trunk/c/modules/util/error.c
    webservices/axis2/trunk/c/modules/util/log.c

Modified: webservices/axis2/trunk/c/include/axis2_error.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_error.h?rev=389376&r1=389375&r2=389376&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_error.h (original)
+++ webservices/axis2/trunk/c/include/axis2_error.h Mon Mar 27 19:04:49 2006
@@ -421,6 +421,8 @@
         AXIS2_ERROR_WSDL_PARSER_INVALID_STATE,
         /* Interface or Port Type not found for the binding */
         AXIS2_ERROR_INTERFACE_OR_PORT_TYPE_NOT_FOUND_FOR_THE_BINDING,
+        /* Error occured in transport */
+        AXIS2_ERROR_HTTP_CLIENT_TRANSPORT_ERROR,
         /** The following has to be the last error value all the time.
             All other error codes should appear above this.
             AXIS2_ERROR_LAST is used to track the number of error codes present

Modified: webservices/axis2/trunk/c/include/axis2_http_simple_response.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_http_simple_response.h?rev=389376&r1=389375&r2=389376&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_http_simple_response.h (original)
+++ webservices/axis2/trunk/c/include/axis2_http_simple_response.h Mon Mar 27 19:04:49 2006
@@ -164,7 +164,7 @@
 /************************** Start of function macros **************************/
 
 
-#define AXIS2_HTTP_SIMPLE_RESPONSE_SET_STAUTUS_LINE(\
+#define AXIS2_HTTP_SIMPLE_RESPONSE_SET_STATUS_LINE(\
 					simple_response, env, http_version, status_code, phrase)\
                     ((simple_response)->ops->set_status_line\
                     (simple_response, env, http_version, status_code, phrase))
@@ -177,7 +177,7 @@
 #define AXIS2_HTTP_SIMPLE_RESPONSE_GET_STATUS_CODE(simple_response, env)\
                     ((simple_response)->ops->get_status_code\
                     (simple_response, env))
-#define AXIS2_HTTP_SIMPLE_RESPONSE_GET_STAUTUS_LINE(simple_response, env) \
+#define AXIS2_HTTP_SIMPLE_RESPONSE_GET_STATUS_LINE(simple_response, env) \
                     ((simple_response)->ops->get_status_line\
                     (simple_response, env))
 #define AXIS2_HTTP_SIMPLE_RESPONSE_CONTAINS_HEADER(simple_response, env, name)\

Modified: webservices/axis2/trunk/c/include/axis2_http_transport.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_http_transport.h?rev=389376&r1=389375&r2=389376&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_http_transport.h (original)
+++ webservices/axis2/trunk/c/include/axis2_http_transport.h Mon Mar 27 19:04:49 2006
@@ -73,6 +73,11 @@
      * RESPONSE_CONTINUE_CODE_VAL
      */
     #define AXIS2_HTTP_RESPONSE_CONTINUE_CODE_VAL 100
+   
+    /*
+     * RESPONSE_INTERNAL_SERVER_ERROR_CODE_VAL
+     */ 
+    #define  AXIS2_HTTP_RESPONSE_INTERNAL_SERVER_ERROR_CODE_VAL 500
 
     /**
      * SOCKET

Modified: webservices/axis2/trunk/c/modules/core/transport/http/http_worker.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/http_worker.c?rev=389376&r1=389375&r2=389376&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/http_worker.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/http_worker.c Mon Mar 27 19:04:49 2006
@@ -207,7 +207,7 @@
 						AXIS2_HTTP_SIMPLE_REQUEST_GET_REQUEST_LINE(
 						simple_request, env), env), AXIS2_HTTP_HEADER_POST))
 		{
-			AXIS2_HTTP_SIMPLE_RESPONSE_SET_STAUTUS_LINE(response, env, 
+			AXIS2_HTTP_SIMPLE_RESPONSE_SET_STATUS_LINE(response, env, 
 						http_version, 411, "Length Required");
 			status = AXIS2_SIMPLE_HTTP_SVR_CONN_WRITE_RESPONSE(svr_conn, env, 
 						response);
@@ -304,7 +304,7 @@
 		{
 			axis2_http_header_t *cont_len = NULL;
 			axis2_char_t *body_string = NULL;
-			AXIS2_HTTP_SIMPLE_RESPONSE_SET_STAUTUS_LINE(response, env,
+			AXIS2_HTTP_SIMPLE_RESPONSE_SET_STATUS_LINE(response, env,
 						http_version, AXIS2_HTTP_RESPONSE_OK_CODE_VAL, "OK");
 			body_string = axis2_http_transport_utils_get_services_html(env, 
 						conf_ctx);
@@ -392,13 +392,13 @@
 	}
 	if(NULL != ctx_written && AXIS2_STRCASECMP(ctx_written, "TRUE") == 0)
 	{
-		AXIS2_HTTP_SIMPLE_RESPONSE_SET_STAUTUS_LINE(response, env, http_version,
+		AXIS2_HTTP_SIMPLE_RESPONSE_SET_STATUS_LINE(response, env, http_version,
 						AXIS2_HTTP_RESPONSE_OK_CODE_VAL, "OK");
 		AXIS2_HTTP_SIMPLE_RESPONSE_SET_BODY_STREAM(response, env, out_stream);
 	}
 	else
 	{
-		AXIS2_HTTP_SIMPLE_RESPONSE_SET_STAUTUS_LINE(response, env, http_version,
+		AXIS2_HTTP_SIMPLE_RESPONSE_SET_STATUS_LINE(response, env, http_version,
 						AXIS2_HTTP_RESPONSE_ACK_CODE_VAL, "Accepted");
 	}
 	axis2_http_worker_set_response_headers(http_worker, env, svr_conn, 

Modified: webservices/axis2/trunk/c/modules/core/transport/http/receiver/simple_http_svr_conn.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/receiver/simple_http_svr_conn.c?rev=389376&r1=389375&r2=389376&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/receiver/simple_http_svr_conn.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/receiver/simple_http_svr_conn.c Mon Mar 27 19:04:49 2006
@@ -393,7 +393,7 @@
 			}
 		}
 	}
-	status_line = AXIS2_HTTP_SIMPLE_RESPONSE_GET_STAUTUS_LINE(response, env);
+	status_line = AXIS2_HTTP_SIMPLE_RESPONSE_GET_STATUS_LINE(response, env);
 	if(NULL == status_line)
 	{
 		AXIS2_ERROR_SET((*env)->error, 

Modified: webservices/axis2/trunk/c/modules/core/transport/http/sender/http_client.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/sender/http_client.c?rev=389376&r1=389375&r2=389376&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/http_client.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/http_client.c Mon Mar 27 19:04:49 2006
@@ -373,7 +373,7 @@
     } while(AXIS2_HTTP_RESPONSE_OK_CODE_VAL > http_status);
 
 	client_impl->response = axis2_http_simple_response_create_default(env);
-	AXIS2_HTTP_SIMPLE_RESPONSE_SET_STAUTUS_LINE(client_impl->response, env, 
+	AXIS2_HTTP_SIMPLE_RESPONSE_SET_STATUS_LINE(client_impl->response, env, 
 						AXIS2_HTTP_STATUS_LINE_GET_HTTP_VERSION(status_line, 
 						env), AXIS2_HTTP_STATUS_LINE_GET_STATUS_CODE(
 						status_line, env), 

Modified: webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c?rev=389376&r1=389375&r2=389376&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c Mon Mar 27 19:04:49 2006
@@ -483,6 +483,8 @@
 	axis2_char_t *soap_action = NULL;
 	axis2_char_t *url = NULL;
 	axis2_soap_over_http_sender_t *sender = NULL;
+    axis2_status_t status = AXIS2_FAILURE;
+
 	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 	AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
 	AXIS2_PARAM_CHECK((*env)->error, epr, AXIS2_FAILURE);
@@ -520,14 +522,14 @@
 	AXIS2_SOAP_OVER_HTTP_SENDER_SET_OM_OUTPUT(sender, env, om_output);
 	AXIS2_SOAP_OVER_SENDER_SET_HTTP_VERSION(sender, env, 
 						AXIS2_INTF_TO_IMPL(transport_sender)->http_version);
-	AXIS2_SOAP_OVER_HTTP_SENDER_SEND(sender, env, msg_ctx, out, url,
+	status = AXIS2_SOAP_OVER_HTTP_SENDER_SEND(sender, env, msg_ctx, out, url,
 						soap_action);
 	/*
 	 * TODO check for errors
 	 */
     AXIS2_SOAP_OVER_HTTP_SENDER_FREE(sender, env);
     sender = NULL;
-	return AXIS2_SUCCESS;
+	return status;
 }
 
 /**

Modified: webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c?rev=389376&r1=389375&r2=389376&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c Mon Mar 27 19:04:49 2006
@@ -302,13 +302,39 @@
 	request = NULL;
 	
 	status_code = AXIS2_HTTP_CLIENT_RECIEVE_HEADER(sender_impl->client, env);
-	if(status_code < 0)
+    
+    if(status_code < 0)
 	{
 		return AXIS2_FAILURE;
 	}
-	response = AXIS2_HTTP_CLIENT_GET_RESPONSE(sender_impl->client, env);
-	return axis2_soap_over_http_sender_process_response(sender, env, msg_ctx,
-						response);    
+    response = AXIS2_HTTP_CLIENT_GET_RESPONSE(sender_impl->client, env);
+    if(AXIS2_HTTP_RESPONSE_OK_CODE_VAL == status_code || 
+                        AXIS2_HTTP_RESPONSE_ACK_CODE_VAL == status_code)
+    {
+        return axis2_soap_over_http_sender_process_response(sender, env, 
+                        msg_ctx, response);
+    }
+    else if(AXIS2_HTTP_RESPONSE_INTERNAL_SERVER_ERROR_CODE_VAL == status_code)
+    {
+        axis2_http_header_t *tmp_header = NULL;
+        axis2_char_t *tmp_header_val = NULL;
+        tmp_header = AXIS2_HTTP_SIMPLE_RESPONSE_GET_FIRST_HEADER(response, env,
+                        AXIS2_HTTP_HEADER_CONTENT_TYPE);
+        if(NULL != tmp_header)
+        {
+            tmp_header_val = AXIS2_HTTP_HEADER_GET_VALUE(tmp_header, env);
+        }
+        if(NULL != tmp_header_val && (AXIS2_STRSTR(tmp_header_val, 
+                        AXIS2_HTTP_HEADER_ACCEPT_APPL_SOAP) || AXIS2_STRSTR(
+                        tmp_header_val, AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML)))
+        {
+            return axis2_soap_over_http_sender_process_response(sender, env, 
+                        msg_ctx, response);
+        }
+    }
+    AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_HTTP_CLIENT_TRANSPORT_ERROR, 
+                        AXIS2_FAILURE);
+    return AXIS2_FAILURE;
 }
 
 

Modified: webservices/axis2/trunk/c/modules/core/transport/http/server/simple_axis2_server/http_server_main.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/simple_axis2_server/http_server_main.c?rev=389376&r1=389375&r2=389376&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/simple_axis2_server/http_server_main.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/simple_axis2_server/http_server_main.c Mon Mar 27 19:04:49 2006
@@ -45,14 +45,17 @@
 
 void system_exit(axis2_env_t *env, int status)
 {
+    axis2_allocator_t *allocator = NULL;
     if(NULL != server)
     {
        AXIS2_TRANSPORT_RECEIVER_FREE(server,  &system_env);
     }
 	if(NULL != env)
 	{
+        allocator = env->allocator;
 		axis2_env_free(env);
 	}
+    axis2_allocator_free(allocator);
 	_exit(status);
 }
 

Modified: webservices/axis2/trunk/c/modules/util/allocator.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/allocator.c?rev=389376&r1=389375&r2=389376&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/allocator.c (original)
+++ webservices/axis2/trunk/c/modules/util/allocator.c Mon Mar 27 19:04:49 2006
@@ -41,7 +41,11 @@
 AXIS2_DECLARE(axis2_status_t)
 axis2_allocator_free(axis2_allocator_t *allocator)
 {
+    void (*free_func)(void *) = NULL;
     if(allocator)
-        free(allocator);
+    {
+        free_func = allocator->free; 
+        free_func(allocator);
+    }
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/modules/util/dir_handler.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/dir_handler.c?rev=389376&r1=389375&r2=389376&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/dir_handler.c (original)
+++ webservices/axis2/trunk/c/modules/util/dir_handler.c Mon Mar 27 19:04:49 2006
@@ -328,9 +328,9 @@
 #ifndef WIN32
     for(i = 0; i < count; i++)
     {
-        AXIS2_FREE((*env)->allocator, files[i]);
+        free(files[i]);
     }
-    AXIS2_FREE((*env)->allocator, files);
+    free(files);
 #endif 
     return file_list;
 }

Modified: webservices/axis2/trunk/c/modules/util/error.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/error.c?rev=389376&r1=389375&r2=389376&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/error.c (original)
+++ webservices/axis2/trunk/c/modules/util/error.c Mon Mar 27 19:04:49 2006
@@ -425,6 +425,8 @@
     "Wsdl parsing has resulted in an invalid state";
     axis2_error_messages[AXIS2_ERROR_INTERFACE_OR_PORT_TYPE_NOT_FOUND_FOR_THE_BINDING] =
      "Interface or Port Type not found for the binding";
+    axis2_error_messages[AXIS2_ERROR_HTTP_CLIENT_TRANSPORT_ERROR] = 
+     "Error occured in transport";
 
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/modules/util/log.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/log.c?rev=389376&r1=389375&r2=389376&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/log.c (original)
+++ webservices/axis2/trunk/c/modules/util/log.c Mon Mar 27 19:04:49 2006
@@ -151,6 +151,7 @@
     }	
 	/* by default, log is enabled */
 	log_impl->log.enabled = 1;
+	log_impl->log.level = AXIS2_LOG_LEVEL_DEBUG;
 
     if (ops)
         log_impl->log.ops = ops;