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 di...@apache.org on 2007/02/28 18:25:42 UTC

svn commit: r512857 - in /webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender: http_sender.c soap_over_http_sender.c

Author: dinesh
Date: Wed Feb 28 09:25:41 2007
New Revision: 512857

URL: http://svn.apache.org/viewvc?view=rev&rev=512857
Log:
there was a problem in chunked stream, it fixed now.

Modified:
    webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/http_sender.c
    webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/soap_over_http_sender.c

Modified: webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/http_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/http_sender.c?view=diff&rev=512857&r1=512856&r2=512857
==============================================================================
--- webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/http_sender.c (original)
+++ webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/http_sender.c Wed Feb 28 09:25:41 2007
@@ -55,7 +55,7 @@
 	axis2_bool_t is_soap;
 }axis2_http_sender_impl_t;
 
-#define AXIS2_INTF_TO_IMPL(sender)\
+#define AXIS2_INTF_TO_IMPL(sender)				\
 	((axis2_http_sender_impl_t *)(sender))
 
 /***************************** Function headers *******************************/
@@ -295,8 +295,8 @@
         if (NULL == soap_body)
         {
             AXIS2_ERROR_SET(env->error,
-                    AXIS2_ERROR_SOAP_ENVELOPE_OR_SOAP_BODY_NULL,
-                    AXIS2_FAILURE);
+							AXIS2_ERROR_SOAP_ENVELOPE_OR_SOAP_BODY_NULL,
+							AXIS2_FAILURE);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "%s",
 							AXIS2_ERROR_GET_MESSAGE(env->error));
             return AXIS2_FAILURE;
@@ -440,7 +440,7 @@
     
 	if (AXIS2_TRUE == AXIS2_MSG_CTX_GET_IS_SOAP_11(msg_ctx, env))
     {
-       if ('\"' != *soap_action)
+		if ('\"' != *soap_action)
         {
             axis2_char_t *tmp_soap_action = NULL;
             tmp_soap_action = AXIS2_MALLOC(env->allocator, (
@@ -456,38 +456,70 @@
     }
 
 	if (!send_via_get)
+	{
 		buffer_size = AXIOM_XML_WRITER_GET_XML_SIZE(xml_writer, env);
 
-    if (AXIS2_FALSE == sender_impl->chunked)
-    {
-        axis2_char_t tmp_buf[10];
-        if (!buffer)
-        {
-            buffer_size = output_stream_size;
-        }
+		if (AXIS2_FALSE == sender_impl->chunked)
+		{
+			axis2_char_t tmp_buf[10];
+			if (!buffer)
+			{
+				buffer_size = output_stream_size;
+			}
 
-        sprintf(tmp_buf, "%d", buffer_size);
-		axis2_http_sender_util_add_header (env, request, AXIS2_HTTP_HEADER_CONTENT_LENGTH, tmp_buf);
-    }
-    else
-    {
-		axis2_http_sender_util_add_header (env, request, 
-										   AXIS2_HTTP_HEADER_TRANSFER_ENCODING, 
-										   AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED);
-    }
+			if (buffer_size)
+			{
+				sprintf(tmp_buf, "%d", buffer_size);
+				axis2_http_sender_util_add_header (env, request, AXIS2_HTTP_HEADER_CONTENT_LENGTH, tmp_buf);
+			}
+		}
+		else
+		{
+			axis2_http_sender_util_add_header (env, request, 
+											   AXIS2_HTTP_HEADER_TRANSFER_ENCODING, 
+											   AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED);
+		}
     
-	if (is_soap)
-	{
-		if (doing_mtom)
+		if (is_soap)
 		{
-			content_type = (axis2_char_t *)AXIOM_OUTPUT_GET_CONTENT_TYPE(sender_impl->om_output,
-																		 env);
-			if (AXIS2_TRUE != AXIS2_MSG_CTX_GET_IS_SOAP_11(msg_ctx, env))
+			if (doing_mtom)
+			{
+				content_type = (axis2_char_t *)AXIOM_OUTPUT_GET_CONTENT_TYPE(sender_impl->om_output,
+																			 env);
+				if (AXIS2_TRUE != AXIS2_MSG_CTX_GET_IS_SOAP_11(msg_ctx, env))
+				{
+					/* handle SOAP action for SOAP 1.2 case */
+					if (axis2_strcmp(soap_action, ""))
+					{
+						axis2_char_t *temp_content_type = NULL;
+						temp_content_type = AXIS2_STRACAT(content_type, ";action=", env);
+						AXIS2_FREE(env->allocator, content_type);
+						content_type = temp_content_type;
+						temp_content_type = AXIS2_STRACAT(content_type, soap_action, env);
+						AXIS2_FREE(env->allocator, content_type);
+						content_type = temp_content_type;
+					}
+				}
+			}
+			else if (AXIS2_TRUE == AXIS2_MSG_CTX_GET_IS_SOAP_11(msg_ctx, env))
+			{
+				axis2_char_t *temp_content_type = NULL;
+				content_type = (axis2_char_t *)AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML;
+				content_type = AXIS2_STRACAT(content_type, ";charset=", env);
+				temp_content_type = AXIS2_STRACAT(content_type, char_set_enc, env);
+				AXIS2_FREE(env->allocator, content_type);
+				content_type = temp_content_type;
+			}
+			else
 			{
-				/* handle SOAP action for SOAP 1.2 case */
+				axis2_char_t *temp_content_type = NULL;
+				content_type = (axis2_char_t *)AXIS2_HTTP_HEADER_ACCEPT_APPL_SOAP;
+				content_type = AXIS2_STRACAT(content_type, ";charset=", env);
+				temp_content_type = AXIS2_STRACAT(content_type, char_set_enc, env);
+				AXIS2_FREE(env->allocator, content_type);
+				content_type = temp_content_type;
 				if (axis2_strcmp(soap_action, ""))
 				{
-					axis2_char_t *temp_content_type = NULL;
 					temp_content_type = AXIS2_STRACAT(content_type, ";action=", env);
 					AXIS2_FREE(env->allocator, content_type);
 					content_type = temp_content_type;
@@ -495,66 +527,40 @@
 					AXIS2_FREE(env->allocator, content_type);
 					content_type = temp_content_type;
 				}
+				temp_content_type = AXIS2_STRACAT(content_type, ";", env);
+				AXIS2_FREE(env->allocator, content_type);
+				content_type = temp_content_type;
 			}
 		}
-		else if (AXIS2_TRUE == AXIS2_MSG_CTX_GET_IS_SOAP_11(msg_ctx, env))
-		{
-			axis2_char_t *temp_content_type = NULL;
-			content_type = (axis2_char_t *)AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML;
-			content_type = AXIS2_STRACAT(content_type, ";charset=", env);
-			temp_content_type = AXIS2_STRACAT(content_type, char_set_enc, env);
-			AXIS2_FREE(env->allocator, content_type);
-			content_type = temp_content_type;
-		}
 		else
 		{
-			axis2_char_t *temp_content_type = NULL;
-			content_type = (axis2_char_t *)AXIS2_HTTP_HEADER_ACCEPT_APPL_SOAP;
-			content_type = AXIS2_STRACAT(content_type, ";charset=", env);
-			temp_content_type = AXIS2_STRACAT(content_type, char_set_enc, env);
-			AXIS2_FREE(env->allocator, content_type);
-			content_type = temp_content_type;
-			if (axis2_strcmp(soap_action, ""))
+			content_type_property  = (axis2_property_t *)AXIS2_MSG_CTX_GET_PROPERTY(
+				msg_ctx, env,
+				AXIS2_USER_DEFINED_HTTP_HEADER_CONTENT_TYPE, 
+				AXIS2_FALSE);
+		
+			if (content_type_property)
 			{
-				temp_content_type = AXIS2_STRACAT(content_type, ";action=", env);
-				AXIS2_FREE(env->allocator, content_type);
-				content_type = temp_content_type;
-				temp_content_type = AXIS2_STRACAT(content_type, soap_action, env);
-				AXIS2_FREE(env->allocator, content_type);
-				content_type = temp_content_type;
+				content_type_hash = (axis2_hash_t *) AXIS2_PROPERTY_GET_VALUE (content_type_property, env);
+				if (content_type_hash)
+					content_type_value = (char *) axis2_hash_get (content_type_hash, 
+																  AXIS2_HTTP_HEADER_CONTENT_TYPE, 
+																  AXIS2_HASH_KEY_STRING);
 			}
-			temp_content_type = AXIS2_STRACAT(content_type, ";", env);
-			AXIS2_FREE(env->allocator, content_type);
-			content_type = temp_content_type;
+			if (content_type_value)
+				content_type = content_type_value;
+			else
+				content_type = AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML;
 		}
-	}
-	else
-	{
-		content_type_property  = (axis2_property_t *)AXIS2_MSG_CTX_GET_PROPERTY(
-			msg_ctx, env,
-			AXIS2_USER_DEFINED_HTTP_HEADER_CONTENT_TYPE, 
-			AXIS2_FALSE);
-		
-		if (content_type_property)
+
+		axis2_http_sender_util_add_header (env, request, AXIS2_HTTP_HEADER_CONTENT_TYPE, content_type);
+
+		if (content_type)
 		{
-			content_type_hash = (axis2_hash_t *) AXIS2_PROPERTY_GET_VALUE (content_type_property, env);
-			if (content_type_hash)
-				content_type_value = (char *) axis2_hash_get (content_type_hash, 
-															  AXIS2_HTTP_HEADER_CONTENT_TYPE, 
-															  AXIS2_HASH_KEY_STRING);
+			AXIS2_FREE(env->allocator, content_type);
+			content_type = NULL;
 		}
-		if (content_type_value)
-			content_type = content_type_value;
-		else
-			content_type = AXIS2_HTTP_HEADER_ACCEPT_TEXT_XML;
 	}
-	axis2_http_sender_util_add_header (env, request, AXIS2_HTTP_HEADER_CONTENT_TYPE, content_type);
-    if (content_type)
-    {
-        AXIS2_FREE(env->allocator, content_type);
-        content_type = NULL;
-    }
-
 
     if (0 == AXIS2_STRCMP(sender_impl->http_version,
 						  AXIS2_HTTP_HEADER_PROTOCOL_11))
@@ -736,18 +742,23 @@
 															  , env), AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
             {
                 axis2_char_t *transfer_encoding = NULL;
-
+/*                transfer_encoding = */
+/*                     AXIS2_STRDUP(AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED, */
+/* 								 env); */
+/*                 property = axis2_property_create(env); */
+/*                 AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_REQUEST); */
+/*                 AXIS2_PROPERTY_SET_VALUE(property, env, transfer_encoding); */
+/*                 AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env, */
+/* 										   AXIS2_HTTP_HEADER_TRANSFER_ENCODING, */
+/* 										   property, */
+/* 										   AXIS2_FALSE); */
+/*                 response_chunked = AXIS2_TRUE; */
                 transfer_encoding =
                     AXIS2_STRDUP(AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED,
 								 env);
-                property = axis2_property_create(env);
-                AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_REQUEST);
-                AXIS2_PROPERTY_SET_VALUE(property, env, transfer_encoding);
-                AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env,
-										   AXIS2_HTTP_HEADER_TRANSFER_ENCODING,
-										   property,
-										   AXIS2_FALSE);
                 response_chunked = AXIS2_TRUE;
+                axis2_msg_ctx_set_transfer_encoding(msg_ctx, env, transfer_encoding);
+ 
             }
             if (0 != AXIS2_STRCMP(name, AXIS2_HTTP_HEADER_CONTENT_TYPE))
             {
@@ -1119,7 +1130,7 @@
         return NULL;
     }
     body_node = AXIOM_SOAP_BODY_GET_BASE_NODE(
-                AXIOM_SOAP_ENVELOPE_GET_BODY(soap_env, env), env);
+		AXIOM_SOAP_ENVELOPE_GET_BODY(soap_env, env), env);
     data_node = AXIOM_NODE_GET_FIRST_CHILD(body_node, env);
     if (NULL == data_node)
     {
@@ -1146,7 +1157,7 @@
 		encoded_value = axis2_url_encode (env, encoded_value, value, strlen (value));
 
         AXIS2_ARRAY_LIST_ADD(param_list, env, axis2_strcat(env, name, "=",
-                encoded_value, NULL));
+														   encoded_value, NULL));
     }
     for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(param_list, env); i++)
     {
@@ -1157,7 +1168,7 @@
 		if(i ==0)
 			tmp_string = AXIS2_STRACAT(param_string, pair, env);
 		else
-		tmp_string = axis2_strcat(env, param_string, "&", pair, NULL);				
+			tmp_string = axis2_strcat(env, param_string, "&", pair, NULL);				
 
         if (param_string)
         {

Modified: webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/soap_over_http_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/soap_over_http_sender.c?view=diff&rev=512857&r1=512856&r2=512857
==============================================================================
--- webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/soap_over_http_sender.c (original)
+++ webservices/axis2/scratch/c/dinesh/532/c/modules/core/transport/http/sender/soap_over_http_sender.c Wed Feb 28 09:25:41 2007
@@ -367,7 +367,7 @@
     else
     {
 		axis2_http_sender_util_add_header (env, request, 
-										   AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED, 
+										   AXIS2_HTTP_HEADER_TRANSFER_ENCODING, 
 										   AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED);
     }
     



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org