You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2006/01/16 06:59:11 UTC

svn commit: r369361 [3/3] - in /webservices/axis2/trunk/c/modules/core/transport/http: ./ receiver/ sender/

Added: 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=369361&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/http_client.c (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/http_client.c Sun Jan 15 21:58:47 2006
@@ -0,0 +1,397 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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_http_client.h>
+#include <axis2_http_transport.h>
+#include <axis2_stream.h>
+#include <axis2_string.h>
+#include <axis2_network_handler.h>
+#include <axis2_http_request_line.h>
+#include <axis2_http_header.h>
+#include <axis2_http_status_line.h>
+
+
+/** 
+ * @brief HTTP Client struct impl
+ *	Axis2 HTTP Client impl  
+ */
+typedef struct axis2_http_client_impl axis2_http_client_impl_t;  
+  
+struct axis2_http_client_impl
+{
+	axis2_http_client_t http_client;
+	int sockfd;
+	axis2_stream_t *data_stream;
+	axis2_url_t *url;
+	axis2_http_simple_response_t *response;
+	axis2_bool_t request_sent;
+	int timeout;
+};
+
+#define AXIS2_INTF_TO_IMPL(http_client) \
+                ((axis2_http_client_impl_t *)(http_client))
+
+/***************************** Function clients *******************************/
+axis2_status_t AXIS2_CALL 
+axis2_http_client_send (axis2_http_client_t *client, axis2_env_t **env,
+						axis2_http_simple_request_t *request);
+int AXIS2_CALL 
+axis2_http_client_recieve_header (axis2_http_client_t *client, 
+						axis2_env_t **env);
+axis2_http_simple_response_t* AXIS2_CALL 
+axis2_http_client_get_response (axis2_http_client_t *client, axis2_env_t **env);
+axis2_status_t AXIS2_CALL 
+axis2_http_client_set_url (axis2_http_client_t *client, 
+						axis2_env_t **env, axis2_url_t *url);
+axis2_url_t* AXIS2_CALL 
+axis2_http_client_get_url (axis2_http_client_t *client, axis2_env_t **env);
+axis2_status_t AXIS2_CALL 
+axis2_http_client_set_timeout (axis2_http_client_t *client, axis2_env_t **env, 
+						int timeout_ms);
+int AXIS2_CALL 
+axis2_http_client_get_timeout (axis2_http_client_t *client, axis2_env_t **env);
+
+axis2_status_t AXIS2_CALL 
+axis2_http_client_free (axis2_http_client_t *client, axis2_env_t **env);							
+
+/***************************** End of function clients ************************/
+
+AXIS2_DECLARE(axis2_http_client_t *) 
+axis2_http_client_create (axis2_env_t **env, axis2_url_t *url)
+{
+    AXIS2_ENV_CHECK(env, NULL);
+            
+    axis2_http_client_impl_t *http_client_impl = 
+                        (axis2_http_client_impl_t *)AXIS2_MALLOC 
+                        ((*env)->allocator, sizeof(axis2_http_client_impl_t));
+	
+    if(NULL == http_client_impl)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+	}
+    
+	http_client_impl->url = url;
+	http_client_impl->data_stream = NULL;
+	http_client_impl->sockfd = -1;
+	http_client_impl->response = NULL;
+	http_client_impl->request_sent = AXIS2_FALSE;
+	http_client_impl->timeout = AXIS2_HTTP_DEFAULT_CONNECTION_TIMEOUT;
+	
+    http_client_impl->http_client.ops = AXIS2_MALLOC((*env)->allocator,
+						sizeof(axis2_http_client_ops_t));
+    if(NULL == http_client_impl->http_client.ops)
+	{
+		axis2_http_client_free((axis2_http_client_t*) http_client_impl, env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+	}
+    
+    http_client_impl->http_client.ops->send = axis2_http_client_send;                        
+    http_client_impl->http_client.ops->recieve_header = 
+						axis2_http_client_recieve_header;
+    http_client_impl->http_client.ops->get_response = 
+						axis2_http_client_get_response;
+	http_client_impl->http_client.ops->set_url = axis2_http_client_set_url;
+	http_client_impl->http_client.ops->get_url = axis2_http_client_get_url;
+	http_client_impl->http_client.ops->set_timeout = 
+						axis2_http_client_set_timeout;
+	http_client_impl->http_client.ops->get_timeout = 
+						axis2_http_client_get_timeout;
+    http_client_impl->http_client.ops->free = axis2_http_client_free;
+                        
+	return &(http_client_impl->http_client);
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_http_client_free (axis2_http_client_t *client, axis2_env_t **env)
+{
+	AXIS2_FUNC_PARAM_CHECK(client, env, AXIS2_FAILURE);
+    axis2_http_client_impl_t *http_client_impl = AXIS2_INTF_TO_IMPL(client);
+    if(NULL != http_client_impl->url)
+    {
+        AXIS2_URL_FREE(http_client_impl->url, env);
+        http_client_impl->url = NULL;
+    }
+    if(NULL != http_client_impl->data_stream)
+    {
+        AXIS2_STREAM_FREE(http_client_impl->data_stream, env);
+        http_client_impl->data_stream = NULL;
+    }
+	if(NULL != http_client_impl->response)
+    {
+        AXIS2_HTTP_SIMPLE_RESPONSE_FREE(http_client_impl->response, env);
+        http_client_impl->response  = NULL;
+    }
+	if(-1 != http_client_impl->sockfd)
+	{
+		axis2_network_handler_close_socket(env, http_client_impl->sockfd);
+		http_client_impl->sockfd = -1;
+	}
+    if(NULL != client->ops)
+        AXIS2_FREE((*env)->allocator, client->ops);
+    
+	AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(client));
+	return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_http_client_send (axis2_http_client_t *client, axis2_env_t **env,
+						axis2_http_simple_request_t *request)
+{
+    axis2_http_client_impl_t *client_impl = NULL;
+	char *wire_format = NULL;
+	axis2_array_list_t *headers = NULL;
+	char *str_header = NULL;
+	char *str_body = NULL;
+	char *str_request_line = NULL;
+	int body_size = 0;
+	int written = 0;
+	AXIS2_FUNC_PARAM_CHECK(client, env, AXIS2_FAILURE);
+    client_impl = AXIS2_INTF_TO_IMPL(client);
+	
+	if(NULL != client_impl->url)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NULL_URL, AXIS2_FAILURE);
+	}
+    
+	client_impl->sockfd = axis2_network_handler_open_socket(env, 
+						AXIS2_URL_GET_SERVER(client_impl->url, env), 
+						AXIS2_URL_GET_PORT(client_impl->url, env));
+	if(client_impl->sockfd < 0)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_SOCKET_ERROR, AXIS2_FAILURE);
+		return AXIS2_FAILURE;
+	}
+	/* ONLY FOR TESTING
+	 * client_impl->data_stream = axis2_stream_create_file(env, 
+	 *				stdout);
+	 */
+	if(client_impl->timeout > 0)
+	{
+		axis2_network_handler_set_sock_option(env, client_impl->sockfd, 
+						SO_RCVTIMEO, client_impl->timeout);
+		axis2_network_handler_set_sock_option(env, client_impl->sockfd, 
+						SO_SNDTIMEO, client_impl->timeout);
+	}
+	client_impl->data_stream = axis2_stream_create_socket(env, 
+					client_impl->sockfd);
+	
+	if(NULL == client_impl->data_stream)
+	{
+		axis2_network_handler_close_socket(env, client_impl->sockfd);
+		return AXIS2_FAILURE;
+	}
+	
+	headers = AXIS2_HTTP_SIMPLE_REQUEST_GET_HEADERS(request, env);
+	if(NULL != headers)
+	{
+		int header_count = AXIS2_ARRAY_LIST_SIZE(headers, env);
+		int i = 0;
+		char *str_header2 = NULL;
+		for(i = 0; i < header_count; i++)
+		{
+			axis2_http_header_t *tmp_header = (axis2_http_header_t*)
+						AXIS2_ARRAY_LIST_GET(headers, env, i);
+			axis2_char_t *header_ext_form = AXIS2_HTTP_HEADER_TO_EXTERNAL_FORM(
+						tmp_header, env);
+			str_header2 = AXIS2_STRACAT(str_header, header_ext_form, env);
+			AXIS2_FREE((*env)->allocator, str_header);
+			str_header = NULL;
+			AXIS2_FREE((*env)->allocator, header_ext_form);
+			header_ext_form = NULL;
+			str_header = str_header2;
+		}
+	}
+	str_request_line = AXIS2_HTTP_REQUEST_LINE_TO_STRING(
+						AXIS2_HTTP_SIMPLE_REQUEST_GET_REQUEST_LINE(request, env)
+						, env);
+	wire_format = AXIS2_STRACAT(str_request_line, str_header, env);
+	AXIS2_FREE((*env)->allocator, str_header);
+	str_header = NULL;
+	AXIS2_FREE((*env)->allocator, str_request_line);
+	str_request_line = NULL;
+	written = AXIS2_STREAM_WRITE(client_impl->data_stream, env, wire_format, 
+						AXIS2_STRLEN(wire_format));
+	AXIS2_FREE((*env)->allocator, wire_format);
+	wire_format = NULL;
+	written = AXIS2_STREAM_WRITE(client_impl->data_stream, env, AXIS2_HTTP_CRLF, 
+						2);
+	body_size = AXIS2_HTTP_SIMPLE_REQUEST_GET_BODY_BYTES(request, env, 
+						&str_body);
+	if(body_size > 0 && NULL != str_body)
+	{
+		written = AXIS2_STREAM_WRITE(client_impl->data_stream, env, str_body, 
+						body_size);		
+	}
+	written = AXIS2_STREAM_WRITE(client_impl->data_stream, env, AXIS2_HTTP_CRLF, 
+						2); 
+	client_impl->request_sent = AXIS2_TRUE;
+	if(NULL != str_body)
+	{
+		AXIS2_FREE((*env)->allocator, str_body);
+		str_body = NULL;
+	}
+    return AXIS2_SUCCESS;
+}
+
+
+int AXIS2_CALL 
+axis2_http_client_recieve_header(axis2_http_client_t *client, axis2_env_t **env)
+{
+	int status_code = -1;
+	axis2_http_client_impl_t *client_impl = NULL;
+	axis2_http_status_line_t *status_line = NULL;
+	char str_status_line[512];
+	char tmp_buf[3];
+	char str_header[512];
+	int read = 0;
+	axis2_bool_t end_of_line = AXIS2_FALSE;
+	axis2_bool_t end_of_headers = AXIS2_FALSE;
+	
+    AXIS2_FUNC_PARAM_CHECK(client, env, AXIS2_CRTICAL_FAILURE);
+	
+	client_impl = AXIS2_INTF_TO_IMPL(client);
+	if(-1 == client_impl->sockfd || NULL == client_impl->data_stream || 
+						AXIS2_FALSE == client_impl->request_sent)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_HTTP_REQUEST_NOT_SENT, 
+						AXIS2_FAILURE);
+		return -1;
+	}
+	/* read the status line */
+	memset(str_status_line, 0, 512);
+	while((read = AXIS2_STREAM_READ(client_impl->data_stream, env, tmp_buf, 
+						1)) > 0)
+	{
+		tmp_buf[read] = '\0';
+		strcat(str_status_line, tmp_buf);
+		if(0 != strstr(str_status_line, AXIS2_HTTP_CRLF))
+		{
+			end_of_line = AXIS2_TRUE;
+			break;
+		}
+	}
+	status_line = axis2_http_status_line_create(env, str_status_line);
+	if(NULL == status_line)
+	{
+		AXIS2_ERROR_SET((*env)->error, 
+						AXIS2_ERROR_INVALID_HTTP_INVALID_HEADER_START_LINE, 
+						AXIS2_FAILURE);
+		return -1;
+	}
+	client_impl->response = axis2_http_simple_response_create_default(env);
+	AXIS2_HTTP_SIMPLE_RESPONSE_SET_STAUTUS_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), 
+						AXIS2_HTTP_STATUS_LINE_GET_REASON_PHRASE(status_line, 
+						env));
+
+	/* now read the headers */
+	memset(str_header, 0, 512);
+	end_of_line = AXIS2_FALSE;
+	while(AXIS2_FALSE == end_of_headers)
+	{
+		while((read = AXIS2_STREAM_READ(client_impl->data_stream, env, tmp_buf, 
+							1)) > 0)
+		{
+			tmp_buf[read] = '\0';
+			strcat(str_header, tmp_buf);
+			if(0 != strstr(str_header, AXIS2_HTTP_CRLF))
+			{
+				end_of_line = AXIS2_TRUE;
+				break;
+			}
+		}
+		if(AXIS2_TRUE == end_of_line)
+		{
+			if(0 == AXIS2_STRCMP(str_header, AXIS2_HTTP_CRLF))
+			{
+				end_of_headers = AXIS2_TRUE;
+			}
+			else
+			{
+				axis2_http_header_t *tmp_header = 
+						axis2_http_header_create_by_str(env, str_header);
+				memset(str_header, 0, 512);
+				if(NULL != tmp_header)
+				{
+					AXIS2_HTTP_SIMPLE_RESPONSE_SET_HEADER(client_impl->response,
+						env, tmp_header);
+				}
+			}
+		}
+		end_of_line = AXIS2_FALSE;
+	}
+	AXIS2_HTTP_SIMPLE_RESPONSE_SET_BODY_STREAM(client_impl->response, env, 
+						client_impl->data_stream); 
+	if(NULL != status_line)
+	{
+		status_code = AXIS2_HTTP_STATUS_LINE_GET_STATUS_CODE(status_line, env);
+		AXIS2_HTTP_STATUS_LINE_FREE(status_line, env);
+		status_line = NULL;
+	}
+    return status_code;
+}
+
+
+axis2_http_simple_response_t* AXIS2_CALL 
+axis2_http_client_get_response (axis2_http_client_t *client, axis2_env_t **env)
+{
+    AXIS2_FUNC_PARAM_CHECK(client, env, NULL);
+    return AXIS2_INTF_TO_IMPL(client)->response;
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_http_client_set_url (axis2_http_client_t *client, 
+						axis2_env_t **env, axis2_url_t *url)
+{
+    AXIS2_FUNC_PARAM_CHECK(client, env, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, url, AXIS2_FAILURE);
+	if(NULL != AXIS2_INTF_TO_IMPL(client)->url)
+	{
+		AXIS2_URL_FREE(AXIS2_INTF_TO_IMPL(client)->url, env);
+		AXIS2_INTF_TO_IMPL(client)->url = NULL;
+	}
+    AXIS2_INTF_TO_IMPL(client)->url = url;
+	return AXIS2_SUCCESS;
+}
+
+axis2_url_t* AXIS2_CALL 
+axis2_http_client_get_url (axis2_http_client_t *client, axis2_env_t **env)
+{
+    AXIS2_FUNC_PARAM_CHECK(client, env, NULL);
+    return AXIS2_INTF_TO_IMPL(client)->url;
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_http_client_set_timeout (axis2_http_client_t *client, axis2_env_t **env, 
+						int timeout_ms)
+{
+    AXIS2_FUNC_PARAM_CHECK(client, env, AXIS2_FAILURE);
+    AXIS2_INTF_TO_IMPL(client)->timeout = timeout_ms;
+	return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL 
+axis2_http_client_get_timeout (axis2_http_client_t *client, axis2_env_t **env)
+{
+    AXIS2_FUNC_PARAM_CHECK(client, env, AXIS2_CRTICAL_FAILURE);
+    return AXIS2_INTF_TO_IMPL(client)->timeout;
+}

Added: 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=369361&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c Sun Jan 15 21:58:47 2006
@@ -0,0 +1,405 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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_http_transport_sender.h>
+#include <axis2_string.h>
+#include <axis2_endpoint_ref.h>
+#include <axis2_addr.h>
+#include <axis2_xml_writer.h>
+#include <axis2_om_output.h>
+#include <axis2_http_transport_utils.h>
+#include <axis2_http_out_transport_info.h>
+#include <axis2_http_transport.h>
+#include <axis2_soap_over_http_sender.h>
+
+#define AXIS2_TRANSPORT_URL "TransportURL"
+
+/** 
+ * @brief HTTP Transport Sender struct impl
+ *	Axis2 HTTP Transport Sender impl  
+ */
+typedef struct axis2_http_transport_sender_impl 
+							axis2_http_transport_sender_impl_t;  
+  
+struct axis2_http_transport_sender_impl
+{
+	axis2_http_transport_sender_t transport_sender;
+	axis2_char_t *http_version;
+	axis2_bool_t chunked;
+	int connection_timeout;
+	int so_timeout;
+	
+};
+
+#define AXIS2_INTF_TO_IMPL(transport_sender) \
+                			((axis2_http_transport_sender_impl_t *)\
+							(transport_sender))
+
+/***************************** Function headers *******************************/
+axis2_status_t AXIS2_CALL 
+axis2_http_transport_sender_invoke
+							(axis2_http_transport_sender_t *transport_sender, 
+                    		axis2_env_t **env, axis2_msg_ctx_t *msg_ctx);
+    
+axis2_status_t AXIS2_CALL 
+axis2_http_transport_sender_clean_up
+							(axis2_http_transport_sender_t *transport_sender, 
+                    		axis2_env_t **env, axis2_msg_ctx_t *msg_ctx);
+    
+axis2_status_t AXIS2_CALL 
+axis2_http_transport_sender_init
+							(axis2_http_transport_sender_t *transport_sender, 
+                    		axis2_env_t **env, axis2_conf_ctx_t *conf_ctx, 
+							axis2_transport_out_desc_t *out_desc);
+axis2_status_t AXIS2_CALL
+axis2_http_transport_sender_write_message
+							(axis2_http_transport_sender_t *transport_sender, 
+                    		axis2_env_t **env, axis2_msg_ctx_t *msg_ctx,
+							axis2_endpoint_ref_t *epr, axis2_om_node_t *out, 
+							axis2_om_output_t *om_output);
+    
+axis2_status_t AXIS2_CALL 
+axis2_http_transport_sender_free 
+							(axis2_http_transport_sender_t *transport_sender, 
+                    		axis2_env_t **env);
+/***************************** End of function headers ************************/
+
+axis2_http_transport_sender_t* AXIS2_CALL
+axis2_http_transport_sender_create(axis2_env_t **env)
+{
+    AXIS2_ENV_CHECK(env, NULL);
+        
+    axis2_http_transport_sender_impl_t *transport_sender_impl = 
+                        (axis2_http_transport_sender_impl_t *)AXIS2_MALLOC 
+                        ((*env)->allocator, sizeof(
+                        axis2_http_transport_sender_impl_t));
+	
+    if(NULL == transport_sender_impl)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+		return NULL;
+	}
+
+    transport_sender_impl->http_version = AXIS2_STRDUP(
+						AXIS2_HTTP_HEADER_PROTOCOL_11, env);
+	transport_sender_impl->chunked = AXIS2_TRUE;
+	transport_sender_impl->connection_timeout = 
+						AXIS2_HTTP_DEFAULT_CONNECTION_TIMEOUT;
+	transport_sender_impl->so_timeout = AXIS2_HTTP_DEFAULT_SO_TIMEOUT;
+    transport_sender_impl->transport_sender.ops = AXIS2_MALLOC((*env)->allocator
+						,sizeof(axis2_http_transport_sender_ops_t));
+    if(NULL == transport_sender_impl->transport_sender.ops)
+	{
+		axis2_http_transport_sender_free((axis2_http_transport_sender_t*)
+						transport_sender_impl, env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+		return NULL;
+	}
+    
+    transport_sender_impl->transport_sender.ops->invoke = 
+                        axis2_http_transport_sender_invoke;
+    transport_sender_impl->transport_sender.ops->clean_up = 
+						axis2_http_transport_sender_clean_up;
+    transport_sender_impl->transport_sender.ops->init = 
+						axis2_http_transport_sender_init;
+    transport_sender_impl->transport_sender.ops->free = 
+						axis2_http_transport_sender_free;
+                        
+	return &(transport_sender_impl->transport_sender);
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_http_transport_sender_free 
+						(axis2_http_transport_sender_t *transport_sender, 
+						axis2_env_t **env)
+{
+	AXIS2_FUNC_PARAM_CHECK(transport_sender, env, AXIS2_FAILURE);
+    axis2_http_transport_sender_impl_t *transport_sender_impl =
+                        AXIS2_INTF_TO_IMPL(transport_sender);
+
+    if(NULL != transport_sender->ops)
+        AXIS2_FREE((*env)->allocator, transport_sender->ops);
+    
+	AXIS2_FREE((*env)->allocator, transport_sender_impl);
+	return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_http_transport_sender_invoke
+							(axis2_http_transport_sender_t *transport_sender, 
+                    		axis2_env_t **env, axis2_msg_ctx_t *msg_ctx)
+{
+    axis2_char_t *char_set_enc = NULL;
+	axis2_endpoint_ref_t *epr = NULL;
+	axis2_char_t *transport_url = NULL;
+	axis2_om_node_t *data_out = NULL;
+	axis2_xml_writer_t *xml_writer = NULL;
+	axis2_om_output_t *om_output = NULL;
+	axis2_char_t *buffer = NULL;
+	axis2_soap_envelope_t *soap_data_out = NULL;
+	
+	AXIS2_FUNC_PARAM_CHECK(transport_sender, env, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
+    
+	xml_writer = axis2_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0);
+	om_output = axis2_om_output_create(env, xml_writer);
+	
+	char_set_enc = AXIS2_MSG_CTX_GET_PROPERTY(msg_ctx, env, 
+							AXIS2_CHARACTER_SET_ENCODING, AXIS2_FALSE);
+	if(NULL != char_set_enc)
+	{
+		axis2_op_ctx_t *op_ctx = AXIS2_MSG_CTX_GET_OP_CTX(msg_ctx, env);
+		if(NULL != op_ctx)
+		{
+			char_set_enc = AXIS2_OP_CTX_GET_PROPERTY(op_ctx, env, 
+							AXIS2_CHARACTER_SET_ENCODING);
+		}
+	}
+	/**
+	 * If we still can't find the char set enc we will
+	 * use default
+	 */
+	if(NULL == char_set_enc)
+	{
+		char_set_enc = AXIS2_DEFAULT_CHAR_SET_ENCODING;
+	}
+		
+	axis2_bool_t do_mtom = axis2_http_transport_utils_do_write_mtom(env,
+							msg_ctx);
+	AXIS2_MSG_CTX_SET_DOING_MTOM(msg_ctx, env, do_mtom);
+	AXIS2_MSG_CTX_SET_DOING_REST(msg_ctx, 
+							env, axis2_http_transport_utils_is_doing_rest(env, 
+							msg_ctx));
+	transport_url = (axis2_char_t*)AXIS2_MSG_CTX_GET_PROPERTY(msg_ctx, env, 
+							AXIS2_TRANSPORT_URL, AXIS2_FALSE);
+	if(NULL != transport_url)
+	{
+		epr = axis2_endpoint_ref_create(env, transport_url);
+	}
+	else
+	{
+		axis2_endpoint_ref_t *ctx_epr = AXIS2_MSG_CTX_GET_TO(msg_ctx, env);
+		if(NULL !=  ctx_epr && 0 == AXIS2_STRCMP(
+							AXIS2_WSA_ANONYMOUS_URL_SUBMISSION, 
+							AXIS2_ENDPOINT_REF_GET_ADDRESS(ctx_epr, env)) &&
+							0 == AXIS2_STRCMP(AXIS2_WSA_ANONYMOUS_URL, 
+							AXIS2_ENDPOINT_REF_GET_ADDRESS(ctx_epr, env)))
+		{
+			epr = ctx_epr;
+		}
+	}
+	
+	/*if(AXIS2_TRUE == AXIS2_MSG_CTX_IS_DOING_REST(msg_ctx, env))
+	 *{
+	 *	data_out = AXIS2_SOAP_BODY_GET_FIRST_ELEMENT(AXIS2_SOAP_ENVELOPE_GET_BODY(
+							AXIS2_MSG_CTX_GET_ENVELOPE(msg_ctx, env), env),env);
+	 *}
+	 * else
+	 */
+	{
+		soap_data_out = AXIS2_MSG_CTX_GET_SOAP_ENVELOPE(msg_ctx, env);
+		if(NULL != soap_data_out)
+		{
+			data_out = AXIS2_SOAP_ENVELOPE_GET_BASE_NODE(soap_data_out, env);
+		}
+	}
+	if(NULL != epr)
+	{
+		axis2_http_transport_sender_write_message(transport_sender, env, msg_ctx
+							, epr, data_out, om_output);
+	}
+	else
+	{
+		axis2_stream_t *out_stream = AXIS2_MSG_CTX_GET_PROPERTY(msg_ctx, env,
+							AXIS2_TRANSPORT_OUT, AXIS2_FALSE);
+		if(AXIS2_TRUE == AXIS2_MSG_CTX_GET_SERVER_SIDE(msg_ctx, env))
+		{
+			axis2_http_out_transport_info_t *out_info = 
+							(axis2_http_out_transport_info_t *)
+							AXIS2_MSG_CTX_GET_PROPERTY(msg_ctx, env, 
+							AXIS2_HTTP_OUT_TRANSPORT_INFO, AXIS2_FALSE);
+			axis2_bool_t is_soap11 = AXIS2_FALSE;
+			
+			if(NULL == out_info)
+			{
+				AXIS2_ERROR_SET((*env)->error, 
+							AXIS2_ERROR_OUT_TRNSPORT_INFO_NULL, AXIS2_FAILURE);
+				return AXIS2_FAILURE;
+			}
+			is_soap11 = AXIS2_MSG_CTX_GET_IS_SOAP_11(msg_ctx, env);
+			/* AXIS2_OM_OUTPUT_SET_SOAP11(om_output, env, is_soap_11);
+			 */
+			AXIS2_HTTP_OUT_TRANSPORT_INFO_SET_CHAR_ENCODING(out_info, env, 
+							char_set_enc);
+			AXIS2_HTTP_OUT_TRANSPORT_INFO_SET_CONTENT_TYPE(out_info, env, 
+							AXIS2_OM_OUTPUT_GET_CONTENT_TYPE(om_output, env));
+			/* AXIS2_OM_OUTPUT_SET_DO_OPTIMIZE(om_output, env, 
+			 *				AXIS2_MSG_CTX_GET_IS_DOING_MTOM(msg_ctx, env);
+			 */
+			AXIS2_OM_NODE_SERIALIZE (data_out, env, om_output);
+			buffer = AXIS2_XML_WRITER_GET_XML(xml_writer, env);
+			AXIS2_STREAM_WRITE(out_stream, env, buffer, AXIS2_STRLEN(buffer));				
+			AXIS2_FREE((*env)->allocator, buffer);
+			
+			AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env, AXIS2_RESPONSE_WRITTEN,
+							"TRUE", AXIS2_FALSE);			
+		}
+	}
+	/*
+	 * TODO handle errors
+	 */	
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_http_transport_sender_clean_up
+							(axis2_http_transport_sender_t *transport_sender, 
+                    		axis2_env_t **env, axis2_msg_ctx_t *msg_ctx)
+{
+    AXIS2_FUNC_PARAM_CHECK(transport_sender, env, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
+	/*
+	 * Clean up is not used. If the http sender needs
+	 * to be cleaned up it should be done here.
+	 */
+	return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_http_transport_sender_init
+							(axis2_http_transport_sender_t *transport_sender, 
+                    		axis2_env_t **env, axis2_conf_ctx_t *conf_ctx, 
+							axis2_transport_out_desc_t *out_desc)
+{
+    axis2_char_t *version = NULL;
+	axis2_char_t *temp = NULL;
+	
+	AXIS2_FUNC_PARAM_CHECK(transport_sender, env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK((*env)->error, conf_ctx, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, out_desc, AXIS2_FAILURE);
+	
+	version = (axis2_char_t *)AXIS2_PARAM_CONTAINER_GET_PARAM(
+							out_desc->param_container, env, 
+							AXIS2_HTTP_PROTOCOL_VERSION);
+	if(NULL != version)
+	{
+		if(0 == AXIS2_STRCMP(version, AXIS2_HTTP_HEADER_PROTOCOL_11))
+		{
+			axis2_char_t *encoding = NULL;
+			if(NULL != AXIS2_INTF_TO_IMPL(transport_sender)->http_version)
+			{
+				AXIS2_FREE((*env)->allocator, 
+							AXIS2_INTF_TO_IMPL(transport_sender)->http_version);
+			}
+			AXIS2_INTF_TO_IMPL(transport_sender)->http_version = AXIS2_STRDUP(
+							version, env);
+			encoding = (axis2_char_t *)AXIS2_PARAM_CONTAINER_GET_PARAM(
+							out_desc->param_container, env, 
+							AXIS2_HTTP_HEADER_TRANSFER_ENCODING);
+			if(NULL != encoding && 0 == AXIS2_STRCMP(encoding, 
+							AXIS2_HTTP_HEADER_TRANSFER_ENCODING_CHUNKED))
+			{
+				AXIS2_INTF_TO_IMPL(transport_sender)->chunked = AXIS2_TRUE;
+			}
+		}
+		else if(0 == AXIS2_STRCMP(version, AXIS2_HTTP_HEADER_PROTOCOL_10))
+		{
+			if(NULL != AXIS2_INTF_TO_IMPL(transport_sender)->http_version)
+			{
+				AXIS2_FREE((*env)->allocator, 
+							AXIS2_INTF_TO_IMPL(transport_sender)->http_version);
+			}
+			AXIS2_INTF_TO_IMPL(transport_sender)->http_version = AXIS2_STRDUP(
+							version, env);
+			AXIS2_INTF_TO_IMPL(transport_sender)->chunked = AXIS2_FALSE;
+		}
+		else
+		{
+			AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NULL_HTTP_VERSION, 
+							AXIS2_FAILURE);
+			return AXIS2_FAILURE;
+			
+		}
+		
+		temp = (axis2_char_t *)AXIS2_PARAM_CONTAINER_GET_PARAM(
+							out_desc->param_container, env, 
+							AXIS2_HTTP_SO_TIMEOUT);
+		if(NULL != temp)
+		{
+			AXIS2_INTF_TO_IMPL(transport_sender)->so_timeout = atoi(temp);
+		}
+		temp = (axis2_char_t *)AXIS2_PARAM_CONTAINER_GET_PARAM(
+							out_desc->param_container, env, 
+							AXIS2_HTTP_CONNECTION_TIMEOUT);
+		if(NULL != temp)
+		{
+			AXIS2_INTF_TO_IMPL(transport_sender)->connection_timeout=atoi(temp);
+		}
+	}
+    
+	return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_http_transport_sender_write_message
+							(axis2_http_transport_sender_t *transport_sender, 
+                    		axis2_env_t **env, axis2_msg_ctx_t *msg_ctx,
+							axis2_endpoint_ref_t *epr, axis2_om_node_t *out, 
+							axis2_om_output_t *om_output)
+{
+	axis2_char_t *soap_action = NULL;
+	axis2_char_t *url = NULL;
+	
+	AXIS2_FUNC_PARAM_CHECK(transport_sender, env, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, epr, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, om_output, AXIS2_FAILURE);
+
+	url = AXIS2_ENDPOINT_REF_GET_ADDRESS(epr, env);
+	soap_action = AXIS2_MSG_CTX_GET_SOAP_ACTION(msg_ctx, env);
+	if(NULL == soap_action || 0 == AXIS2_STRLEN(soap_action))
+	{
+		soap_action = AXIS2_MSG_CTX_GET_WSA_ACTION(msg_ctx, env);
+	}
+	if(NULL == soap_action)
+	{
+		soap_action = "";
+	}
+	/*
+	 * TODO : when REST comes
+	 * if(AXIS2_TRUE == AXIS2_MSG_CTX_IS_DOING_REST(msg_ctx, env)
+	 * {
+	 * 		axis2_rest_sender_t *sender = axis2_rest_sender_create(env)
+	 *		AXIS2_REST_SENDER_SET_FORMAT(sender, env,
+	 *					AXIS2_INTF_TO_IMPL(transport_sender)->format);
+	 *		AXIS2_REST_SENDER_SEND(sender, env, msg_ctx, data_out, url, 
+	 *					soap_action);
+	 *	}
+	 */
+	axis2_soap_over_http_sender_t *sender = axis2_soap_over_http_sender_create
+							(env);
+	AXIS2_SOAP_OVER_HTTP_SENDER_SET_OM_OUTPUT(sender, env, om_output);
+	AXIS2_SOAP_OVER_HTTP_SENDER_SEND(sender, env, msg_ctx, out, url,
+						soap_action);
+	/*
+	 * TODO check for errors
+	 */
+	return AXIS2_SUCCESS;
+}

Added: 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=369361&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c (added)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c Sun Jan 15 21:58:47 2006
@@ -0,0 +1,378 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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_soap_over_http_sender.h>
+#include <axis2_string.h>
+#include <axis2_http_transport.h>
+#include <string.h>
+#include <axis2_om_output.h>
+#include <axis2_op_ctx.h>
+#include <axis2_ctx.h>
+#include <axis2_http_client.h>
+#include <axis2_xml_writer.h>
+
+/** 
+ * @brief SOAP over HTTP sender struct impl
+ *	Axis2 SOAP over HTTP sender impl  
+ */
+typedef struct axis2_soap_over_http_sender_impl 
+						axis2_soap_over_http_sender_impl_t;  
+  
+struct axis2_soap_over_http_sender_impl
+{
+	axis2_soap_over_http_sender_t sender;
+	axis2_char_t *http_version;
+	axis2_bool_t chunked;
+	int so_timeout;
+	int connection_timeout;
+	axis2_om_output_t *om_output;
+	axis2_http_client_t *client;
+};
+
+#define AXIS2_INTF_TO_IMPL(sender) \
+	                    ((axis2_soap_over_http_sender_impl_t *)(sender))
+
+/***************************** Function headers *******************************/
+axis2_status_t AXIS2_CALL 
+axis2_soap_over_http_sender_get_header_info 
+						(axis2_soap_over_http_sender_t *sender, 
+						axis2_env_t **env, axis2_msg_ctx_t *msg_ctx,
+						axis2_http_simple_response_t *response);
+
+axis2_status_t AXIS2_CALL
+axis2_soap_over_http_sender_process_response 
+						(axis2_soap_over_http_sender_t *sender, 
+						axis2_env_t **env, axis2_msg_ctx_t *msg_ctx, 
+						axis2_http_simple_response_t *response);
+
+axis2_status_t AXIS2_CALL
+axis2_soap_over_http_sender_get_timeout_values 
+						(axis2_soap_over_http_sender_t *sender, 
+						axis2_env_t **env, axis2_msg_ctx_t *msg_ctx);
+
+axis2_status_t AXIS2_CALL 
+axis2_soap_over_http_sender_send 
+						(axis2_soap_over_http_sender_t *sender, 
+						axis2_env_t **env, axis2_msg_ctx_t *msg_ctx,
+						axis2_om_node_t *output, axis2_char_t *str_url, 
+						axis2_char_t *soap_action);
+
+axis2_status_t AXIS2_CALL 
+axis2_soap_over_http_sender_set_chunked
+						(axis2_soap_over_http_sender_t *sender, 
+						axis2_env_t **env, axis2_bool_t chunked);
+
+axis2_status_t AXIS2_CALL 
+axis2_soap_over_http_sender_set_om_output
+						(axis2_soap_over_http_sender_t *sender, 
+						axis2_env_t **env, axis2_om_output_t *om_output);
+
+axis2_status_t AXIS2_CALL 
+axis2_soap_over_http_sender_free
+						(axis2_soap_over_http_sender_t *sender, 
+						axis2_env_t **env);
+/***************************** End of function headers ************************/
+
+axis2_soap_over_http_sender_t * AXIS2_CALL 
+axis2_soap_over_http_sender_create(axis2_env_t **env)
+{
+    AXIS2_ENV_CHECK(env, NULL);
+
+    axis2_soap_over_http_sender_impl_t *sender_impl = 
+                        (axis2_soap_over_http_sender_impl_t *)AXIS2_MALLOC 
+                        ((*env)->allocator, sizeof(
+                        axis2_soap_over_http_sender_impl_t));
+	
+    if(NULL == sender_impl)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+	}
+	
+    sender_impl->http_version = AXIS2_HTTP_HEADER_PROTOCOL_11;
+    sender_impl->so_timeout = AXIS2_HTTP_DEFAULT_SO_TIMEOUT;
+    sender_impl->connection_timeout = AXIS2_HTTP_DEFAULT_CONNECTION_TIMEOUT;
+	/* unlike the java impl we don't have a default om output
+	 * it should be explicitly set and it's a MUST
+	 */
+	sender_impl->om_output = NULL;
+	sender_impl->chunked = AXIS2_FALSE;
+	sender_impl->client = NULL;
+    
+    sender_impl->sender.ops = AXIS2_MALLOC((*env)->allocator,
+                        sizeof(axis2_soap_over_http_sender_ops_t));
+    if(NULL == sender_impl->sender.ops)
+	{
+		axis2_soap_over_http_sender_free((axis2_soap_over_http_sender_t*)
+						sender_impl, env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+	}
+    
+    sender_impl->sender.ops->send =
+                        axis2_soap_over_http_sender_send;
+    sender_impl->sender.ops->set_chunked =
+                        axis2_soap_over_http_sender_set_chunked;
+    sender_impl->sender.ops->set_om_output =
+                        axis2_soap_over_http_sender_set_om_output;
+    sender_impl->sender.ops->free =
+                        axis2_soap_over_http_sender_free;
+	return &(sender_impl->sender);
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_soap_over_http_sender_free (axis2_soap_over_http_sender_t *sender, 
+                        axis2_env_t **env)
+{
+	AXIS2_FUNC_PARAM_CHECK(sender, env, AXIS2_FAILURE);
+    axis2_soap_over_http_sender_impl_t *sender_impl =
+                        AXIS2_INTF_TO_IMPL(sender);
+    if(NULL != sender_impl->http_version)
+    {
+        AXIS2_FREE((*env)->allocator, sender_impl->http_version);
+        sender_impl->http_version= NULL;
+    }
+    if(NULL != sender_impl->om_output)
+    {
+        AXIS2_OM_OUTPUT_FREE(sender_impl->om_output, env);
+        sender_impl->om_output = NULL;
+    }
+    if(NULL != sender->ops)
+        AXIS2_FREE((*env)->allocator, sender->ops);
+    
+	AXIS2_FREE((*env)->allocator, sender_impl);
+	return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_soap_over_http_sender_send 
+						(axis2_soap_over_http_sender_t *sender, 
+						axis2_env_t **env, axis2_msg_ctx_t *msg_ctx,
+						axis2_om_node_t *output, axis2_char_t *str_url, 
+						axis2_char_t *soap_action)
+{
+	axis2_http_simple_request_t *request = NULL;
+	axis2_http_request_line_t *request_line = NULL;
+	axis2_url_t *url = NULL;
+	axis2_soap_over_http_sender_impl_t *sender_impl = NULL;
+	axis2_xml_writer_t *xml_writer = NULL;
+	axis2_char_t *buffer = NULL;
+	axis2_char_t *char_set_enc = NULL;
+	int status_code = -1;
+	axis2_http_header_t *http_header = NULL;
+	axis2_http_simple_response_t *response = NULL;
+	
+    AXIS2_FUNC_PARAM_CHECK(sender, env, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, output, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, url, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, soap_action, AXIS2_FAILURE);
+	
+	url = axis2_url_parse_string(env, str_url);
+	sender_impl = AXIS2_INTF_TO_IMPL(sender);
+	if(NULL == url)
+	{
+		return AXIS2_FAILURE;
+	}
+	sender_impl->client = axis2_http_client_create(env, url);
+	if(NULL == sender_impl->client)
+	{
+		return AXIS2_FAILURE;
+	}
+	if(NULL == sender_impl->om_output)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NULL_OM_OUTPUT, 
+						AXIS2_FAILURE);
+		return AXIS2_FAILURE;
+	}
+	xml_writer = AXIS2_OM_OUTPUT_GET_XML_WRITER(sender_impl->om_output, env);
+	
+	char_set_enc = AXIS2_MSG_CTX_GET_PROPERTY(msg_ctx, env, 
+							AXIS2_CHARACTER_SET_ENCODING, AXIS2_FALSE);
+	if(NULL == char_set_enc)
+	{
+		char_set_enc = AXIS2_DEFAULT_CHAR_SET_ENCODING;
+	}
+	/* AXIS2_OM_OUTPUT_SET_DO_OPTIMIZE(om_output, env, 
+	 *				AXIS2_MSG_CTX_GET_IS_DOING_MTOM(msg_ctx, env);
+	 */
+	AXIS2_OM_NODE_SERIALIZE (output, env, sender_impl->om_output);
+	buffer = AXIS2_XML_WRITER_GET_XML(xml_writer, env);
+	
+	request_line = axis2_http_request_line_create(env, "POST", 
+						AXIS2_URL_GET_PATH(url, env), 
+						sender_impl->http_version);
+	request = axis2_http_simple_request_create(env, request_line, NULL, 0, 
+						NULL);
+	
+	http_header = axis2_http_header_create(env, AXIS2_HTTP_HEADER_USER_AGENT, 
+						"Axis2/C");
+	AXIS2_HTTP_SIMPLE_REQUEST_ADD_HEADER(request, env, http_header);
+	http_header = axis2_http_header_create(env, AXIS2_HTTP_HEADER_SOAP_ACTION, 
+						soap_action);
+	AXIS2_HTTP_SIMPLE_REQUEST_ADD_HEADER(request, env, http_header);
+	AXIS2_HTTP_SIMPLE_REQUEST_SET_BODY_STRING(request, env, buffer);
+	
+	axis2_soap_over_http_sender_get_timeout_values(sender, env, msg_ctx);
+	AXIS2_HTTP_CLIENT_SET_TIMEOUT(sender_impl->client, env, 
+						sender_impl->so_timeout);
+	
+	status_code = AXIS2_HTTP_CLIENT_SEND(sender_impl->client, env, request);
+	
+	AXIS2_HTTP_SIMPLE_REQUEST_FREE(request, env);
+	request = NULL;
+	
+	status_code = AXIS2_HTTP_CLIENT_RECIEVE_HEADER(sender_impl->client, env);
+	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);    
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_soap_over_http_sender_set_chunked
+						(axis2_soap_over_http_sender_t *sender, 
+						axis2_env_t **env, axis2_bool_t chunked)
+{
+    AXIS2_FUNC_PARAM_CHECK(sender, env, AXIS2_FAILURE);
+    AXIS2_INTF_TO_IMPL(sender)->chunked = chunked;
+	return AXIS2_SUCCESS;	
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_soap_over_http_sender_set_om_output
+						(axis2_soap_over_http_sender_t *sender, 
+						axis2_env_t **env, axis2_om_output_t *om_output)
+{
+    AXIS2_FUNC_PARAM_CHECK(sender, env, AXIS2_FAILURE);
+    AXIS2_INTF_TO_IMPL(sender)->om_output = om_output;
+	return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_soap_over_http_sender_get_header_info 
+						(axis2_soap_over_http_sender_t *sender, 
+						axis2_env_t **env, axis2_msg_ctx_t *msg_ctx, 
+						axis2_http_simple_response_t *response)
+{
+	axis2_array_list_t *headers = NULL;
+	axis2_char_t *charset = NULL;
+	axis2_soap_over_http_sender_impl_t *sender_impl = NULL;
+	int i = 0;
+	
+	AXIS2_FUNC_PARAM_CHECK(sender, env, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, response, AXIS2_FAILURE);
+	
+	sender_impl = AXIS2_INTF_TO_IMPL(sender);
+	
+	/*
+	 * TODO MTOM support (MIME header)
+	 */
+	headers = AXIS2_HTTP_SIMPLE_RESPONSE_GET_HEADERS(response, env);
+	for(i = 0; i < AXIS2_ARRAY_LIST_SIZE(headers, env); i++)
+	{
+		axis2_http_header_t *header = AXIS2_ARRAY_LIST_GET(headers, env, i);
+		axis2_char_t *name = AXIS2_HTTP_HEADER_GET_NAME((axis2_http_header_t *)
+						header, env);
+		if(NULL != name && 0 != AXIS2_STRCMP(name, 
+						AXIS2_HTTP_HEADER_CONTENT_TYPE))
+		{
+			axis2_char_t *tmp_charset = NULL;
+			axis2_char_t *content_type = AXIS2_HTTP_HEADER_GET_VALUE(header, 
+						env);
+			tmp_charset = strstr(content_type, AXIS2_HTTP_CHAR_SET_ENCODING);
+			if(NULL != charset)
+			{
+				charset = AXIS2_STRDUP(tmp_charset, env);
+				break;
+			}
+		}
+	}
+	if(NULL != charset)
+	{
+		axis2_ctx_t *axis_ctx = AXIS2_OP_CTX_GET_BASE(AXIS2_MSG_CTX_GET_OP_CTX(
+						msg_ctx, env), env);
+		if(NULL != axis_ctx)
+		{
+			AXIS2_CTX_SET_PROPERTY(axis_ctx, env, AXIS2_CHARACTER_SET_ENCODING, 
+						(void*)charset, AXIS2_FALSE);
+		}
+	}
+	return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_soap_over_http_sender_process_response 
+								(axis2_soap_over_http_sender_t *sender, 
+                                axis2_env_t **env, axis2_msg_ctx_t *msg_ctx, 
+								axis2_http_simple_response_t *response)
+{
+    axis2_stream_t *in_stream = NULL;
+	axis2_ctx_t *axis_ctx = NULL;
+	
+	AXIS2_FUNC_PARAM_CHECK(sender, env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK((*env)->error, msg_ctx, AXIS2_FAILURE);
+	AXIS2_PARAM_CHECK((*env)->error, response, AXIS2_FAILURE);
+	
+	in_stream = AXIS2_HTTP_SIMPLE_RESPONSE_GET_BODY(response, env);
+	if(NULL == in_stream)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NULL_STREAM_IN_RESPONSE_BODY, 
+								AXIS2_FAILURE);
+		return AXIS2_FAILURE;
+	}
+	
+	axis2_soap_over_http_sender_get_header_info(sender, env, msg_ctx, response);
+	axis_ctx = AXIS2_OP_CTX_GET_BASE(AXIS2_MSG_CTX_GET_OP_CTX(msg_ctx, env), 
+						env);
+	AXIS2_CTX_SET_PROPERTY(axis_ctx, env, AXIS2_TRANSPORT_IN, (void *)in_stream, 
+						AXIS2_FALSE);
+	return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_soap_over_http_sender_get_timeout_values 
+								(axis2_soap_over_http_sender_t *sender, 
+                                axis2_env_t **env, axis2_msg_ctx_t *msg_ctx)
+{
+    axis2_char_t *so_str = NULL;
+	axis2_char_t *connection_str = NULL;
+	
+	AXIS2_FUNC_PARAM_CHECK(sender, env, AXIS2_FAILURE);
+	
+	so_str = (axis2_char_t*)AXIS2_MSG_CTX_GET_PARAMETER(msg_ctx, 
+						env, AXIS2_HTTP_SO_TIMEOUT);
+	connection_str = (axis2_char_t*)AXIS2_MSG_CTX_GET_PARAMETER(msg_ctx, 
+						env, AXIS2_HTTP_CONNECTION_TIMEOUT);
+	if(NULL != so_str)
+	{
+		AXIS2_INTF_TO_IMPL(sender)->so_timeout = atoi(so_str);
+	}
+	if(NULL != connection_str)
+	{
+		AXIS2_INTF_TO_IMPL(sender)->connection_timeout = atoi(connection_str);
+	}
+    
+	return AXIS2_SUCCESS;
+}