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 da...@apache.org on 2006/05/01 23:45:03 UTC

svn commit: r398702 - in /webservices/axis2/trunk/c/modules/core/clientapi: op_client.c options.c svc_client.c

Author: damitha
Date: Mon May  1 14:45:01 2006
New Revision: 398702

URL: http://svn.apache.org/viewcvs?rev=398702&view=rev
Log:
Initial implementation of Service Client API added

Added:
    webservices/axis2/trunk/c/modules/core/clientapi/op_client.c
    webservices/axis2/trunk/c/modules/core/clientapi/options.c
    webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c

Added: webservices/axis2/trunk/c/modules/core/clientapi/op_client.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/clientapi/op_client.c?rev=398702&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/op_client.c (added)
+++ webservices/axis2/trunk/c/modules/core/clientapi/op_client.c Mon May  1 14:45:01 2006
@@ -0,0 +1,504 @@
+/*
+ * 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_op_client.h>
+#include <axis2.h>
+#include <axis2_hash.h>
+#include <axis2_mep_client.h>
+#include <listener_manager.h> /*TODO:change too axis2_listener_manager.h*/
+
+typedef struct axis2_op_client_impl
+{
+    /** op_client base struct */
+    axis2_op_client_t op_client;
+
+	axis2_mep_client_t *base;
+
+	axis2_svc_ctx_t *svc_ctx;
+
+	axis2_options_t *options;
+
+	axis2_op_ctx_t *op_ctx;
+
+	axis2_callback_t *callback;
+
+	axis2_bool_t completed;
+
+} axis2_op_client_impl_t;
+
+/** Interface to implementation conversion macro */
+#define AXIS2_INTF_TO_IMPL(op_client) ((axis2_op_client_impl_t *)op_client)
+
+/** private function prototypes */
+static void axis2_op_client_init_data(axis2_op_client_impl_t *op_client_impl);
+static void axis2_op_client_init_ops(axis2_op_client_t *op_client);
+static axis2_msg_ctx_t* axis2_op_client_invoke_blocking(axis2_op_client_impl_t *op_client_impl,
+															axis2_env_t **env,
+															axis2_msg_ctx_t *mc);
+/** public function prototypes */
+axis2_status_t AXIS2_CALL 
+axis2_op_client_set_options(struct axis2_op_client *op_client,
+                    			axis2_env_t **env,
+                    			axis2_options_t *options);
+
+axis2_options_t* AXIS2_CALL 
+axis2_op_client_get_options(struct axis2_op_client *op_client,
+                    			axis2_env_t **env);
+
+axis2_status_t AXIS2_CALL 
+axis2_op_client_add_msg_ctx(struct axis2_op_client *op_client,
+                        				axis2_env_t **env,
+                        				axis2_msg_ctx_t *mc);
+
+
+axis2_msg_ctx_t* AXIS2_CALL 
+axis2_op_client_get_msg_ctx(struct axis2_op_client *op_client,
+                            			axis2_env_t **env,
+                            			axis2_char_t *message_label);
+
+axis2_status_t AXIS2_CALL 
+axis2_op_client_set_callback(struct axis2_op_client *op_client,
+                    			axis2_env_t **env,
+                    			axis2_callback_t *callback);
+
+axis2_status_t AXIS2_CALL 
+axis2_op_client_execute(struct axis2_op_client *op_client,
+                			axis2_env_t **env,
+                			axis2_bool_t block);
+
+axis2_status_t AXIS2_CALL 
+axis2_op_client_reset(struct axis2_op_client *op_client,
+						axis2_env_t **env);
+
+axis2_status_t AXIS2_CALL 
+axis2_op_client_compelete(struct axis2_op_client *op_client,
+                			axis2_env_t **env,
+                			axis2_msg_ctx_t *mc);
+
+axis2_op_ctx_t* AXIS2_CALL 
+axis2_op_client_get_operation_context(struct axis2_op_client *op_client);
+
+
+
+axis2_op_client_t* AXIS2_CALL 
+axis2_op_client_create(axis2_env_t **env, axis2_op_t *operation,
+						axis2_svc_ctx_t *svc_ctx,
+						axis2_options_t *options)
+{
+    axis2_op_client_impl_t *op_client_impl = NULL;
+	axis2_char_t *mep_uri = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    op_client_impl = AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_op_client_impl_t) );
+    if (!op_client_impl)
+    { 
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;        
+    }
+
+	/** initialize data */
+   	axis2_op_client_init_data(op_client_impl);
+	op_client_impl->options = options;
+	op_client_impl->svc_ctx = svc_ctx;
+
+	mep_uri = AXIS2_OP_GET_MSG_EXCHANGE_PATTERN(operation, env);
+
+	if (!mep_uri)
+	{
+		axis2_op_client_free(&(op_client_impl->op_client), env);
+		return NULL;
+	}
+
+	op_client_impl->base = axis2_mep_client_create(env, svc_ctx, mep_uri);
+    if (!(op_client_impl->base))
+    {
+        axis2_op_client_free(&(op_client_impl->op_client), env);
+        return NULL;
+    }
+
+    /* initialize ops */    
+    op_client_impl->op_client.ops  = 
+        AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_op_client_ops_t) );
+    
+    if (!op_client_impl->op_client.ops)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        axis2_callback_free(&(op_client_impl->op_client), env);
+        return NULL;        
+    }
+
+	axis2_op_client_init_ops(&(op_client_impl->op_client));
+    
+	return &(op_client_impl->op_client);
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_op_client_set_options(struct axis2_op_client *op_client,
+                    			axis2_env_t **env,
+                    			axis2_options_t *options)
+{
+    axis2_op_client_impl_t *op_client_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	op_client_impl = AXIS2_INTF_TO_IMPL(op_client);
+	
+	if (op_client_impl->options)
+	{
+		AXIS2_OPTIONS_FREE(op_client_impl->options, env);
+	}
+	op_client_impl->options = options;
+
+	return AXIS2_SUCCESS;	
+}
+
+axis2_options_t* AXIS2_CALL 
+axis2_op_client_get_options(struct axis2_op_client *op_client,
+                    			axis2_env_t **env)
+{
+    axis2_op_client_impl_t *op_client_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+	op_client_impl = AXIS2_INTF_TO_IMPL(op_client);
+	
+	return op_client_impl->options;	
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_op_client_add_msg_ctx(struct axis2_op_client *op_client,
+                        				axis2_env_t **env,
+                        				axis2_msg_ctx_t *mc)
+{
+    axis2_op_client_impl_t *op_client_impl = NULL;
+ 	axis2_msg_ctx_t *out_msg_ctx = NULL, *in_msg_ctx = NULL;
+	axis2_hash_t *msg_ctx_map = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	op_client_impl = AXIS2_INTF_TO_IMPL(op_client);
+	
+	msg_ctx_map = AXIS2_OP_CTX_GET_MSG_CTX_MAP(op_client_impl->op_ctx, env);
+
+	out_msg_ctx = axis2_hash_get(msg_ctx_map, AXIS2_WSDL_MESSAGE_LABEL_OUT_VALUE, 
+									AXIS2_HASH_KEY_STRING);
+	in_msg_ctx = axis2_hash_get(msg_ctx_map, AXIS2_WSDL_MESSAGE_LABEL_IN_VALUE,
+									AXIS2_HASH_KEY_STRING);
+
+	if (out_msg_ctx && in_msg_ctx)
+	{
+		/*TODO:error - completed*/
+		return AXIS2_FAILURE;
+	}
+
+	if (!out_msg_ctx)
+	{
+		axis2_hash_set(msg_ctx_map, AXIS2_WSDL_MESSAGE_LABEL_OUT_VALUE, AXIS2_HASH_KEY_STRING, mc);
+	}
+	else
+	{
+		axis2_hash_set(msg_ctx_map, AXIS2_WSDL_MESSAGE_LABEL_IN_VALUE, AXIS2_HASH_KEY_STRING, mc);
+		AXIS2_OP_CTX_SET_IS_COMPLETE(op_client_impl->op_ctx, env, AXIS2_TRUE);
+	}
+	return AXIS2_SUCCESS;
+}
+
+
+axis2_msg_ctx_t* AXIS2_CALL 
+axis2_op_client_get_msg_ctx(struct axis2_op_client *op_client,
+                            			axis2_env_t **env,
+                            			axis2_char_t *message_label)
+{
+
+    axis2_op_client_impl_t *op_client_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+
+	op_client_impl = AXIS2_INTF_TO_IMPL(op_client);
+
+	if (!message_label)
+	{
+        /*AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);*/
+		return NULL;
+	}
+	return AXIS2_OP_CTX_GET_MSG_CTX(op_client_impl->op_ctx, env, message_label); 
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_op_client_set_callback(struct axis2_op_client *op_client,
+                    			axis2_env_t **env,
+                    			axis2_callback_t *callback)
+{
+    axis2_op_client_impl_t *op_client_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	op_client_impl = AXIS2_INTF_TO_IMPL(op_client);
+
+	if (op_client_impl->callback)
+	{
+		AXIS2_CALLBACK_FREE(op_client_impl->callback, env);
+	}
+
+	op_client_impl->callback = callback;	
+	return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_op_client_execute(struct axis2_op_client *op_client,
+                			axis2_env_t **env,
+                			axis2_bool_t block)
+{
+    axis2_op_client_impl_t *op_client_impl = NULL;
+   	axis2_conf_ctx_t *conf_ctx = NULL;
+   	axis2_msg_ctx_t *msg_ctx = NULL;
+	axis2_msg_info_headers_t *msg_info_headers = NULL;
+	
+	axis2_transport_out_desc_t *transport_out = NULL;
+	axis2_transport_in_desc_t *transport_in = NULL;
+
+	axis2_status_t status = AXIS2_FAILURE;
+	axis2_op_t *op = NULL;
+	axis2_char_t *msg_id = NULL;
+	
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    op_client_impl = AXIS2_INTF_TO_IMPL(op_client);
+
+	if (op_client_impl->completed)
+	{
+		/**TODO:error completed*/
+		return AXIS2_FAILURE;
+	}
+	
+	conf_ctx = AXIS2_SVC_CTX_GET_CONF_CTX(op_client_impl->svc_ctx, env);
+	msg_ctx = axis2_op_client_get_msg_ctx(op_client, env, 
+		AXIS2_WSDL_MESSAGE_LABEL_OUT_VALUE); 
+
+	if (!msg_ctx)
+	{
+		/*TODO:error msg ctx is null*/
+		return AXIS2_FAILURE;
+	}
+	
+	msg_info_headers = AXIS2_OPTIONS_GET_MSG_INFO_HEADERS(op_client_impl->options,
+							env);	
+	AXIS2_MSG_CTX_SET_MSG_INFO_HEADERS(msg_ctx, env, msg_info_headers);
+	
+	/** 
+	if the transport to use for sending is not specified, try to find it
+    from the URL
+	*/
+	transport_out = AXIS2_OPTIONS_GET_TRANSPORT_OUT(op_client_impl->options,
+						env);
+	if (!transport_out)
+	{
+		axis2_endpoint_ref_t *to_epr = NULL;
+		to_epr = AXIS2_OPTIONS_GET_TO(op_client_impl->options, env);
+		if (!to_epr)
+			to_epr = AXIS2_MSG_CTX_GET_TO(msg_ctx, env);
+		transport_out = AXIS2_MEP_CLIENT_INFER_TRANSPORT(op_client_impl->base, env, to_epr);
+	}
+	
+	if (!transport_out)
+	{
+		return AXIS2_FAILURE;
+	}
+
+	if (!(AXIS2_MSG_CTX_GET_TRANSPORT_OUT_DESC(msg_ctx, env)))
+		AXIS2_MSG_CTX_SET_TRANSPORT(msg_ctx, env, transport_out);
+        
+
+	transport_in = AXIS2_OPTIONS_GET_TRANSPORT_IN(op_client_impl->options, env);
+	if (!transport_in)
+	{
+        axis2_conf_ctx_t *conf_ctx = AXIS2_SVC_CTX_GET_CONF_CTX(op_client_impl->svc_ctx, env);
+        if (conf_ctx)
+        {
+            axis2_conf_t *conf = AXIS2_CONF_CTX_GET_CONF(conf_ctx, env);
+            if (conf)
+            {
+                transport_in = AXIS2_CONF_GET_TRANSPORT_IN(conf, env,
+                        AXIS2_TRANSPORT_OUT_DESC_GET_QNAME(transport_out, env));
+            }
+        }
+    }
+	
+	if (!(AXIS2_MSG_CTX_GET_TRANSPORT_IN_DESC(msg_ctx, env)))
+    {
+        AXIS2_MSG_CTX_SET_TRANSPORT_IN_DESC(msg_ctx, env, transport_in);
+    }
+
+	/*TODO:check - soap_action*/
+
+	/*TODO:check - add reference parametes*/	
+
+	op = AXIS2_OP_CTX_GET_OP(op_client_impl->op_ctx, env);
+	if (!op)
+		return AXIS2_FAILURE;
+
+	status = AXIS2_MEP_CLIENT_PREPARE_INVOCATION(op_client_impl->base, env, op, msg_ctx);
+	if (status != AXIS2_SUCCESS)
+		return AXIS2_FAILURE;
+	
+	msg_id = (axis2_char_t*)axis2_uuid_gen(env);
+	if(NULL != msg_id)
+    {
+		AXIS2_FREE((*env)->allocator, msg_id);
+		msg_id = NULL;
+	}
+
+	AXIS2_MSG_CTX_SET_MESSAGE_ID(msg_ctx, env, msg_id);
+
+		
+
+	if (AXIS2_OPTIONS_IS_USE_SEPERATE_LISTENER(op_client_impl->options, env))
+	{
+	}
+	else
+	{
+		if (block)
+		{
+			axis2_op_ctx_t *op_ctx = NULL;
+        	axis2_msg_ctx_t *response_mc = NULL;
+        	axis2_char_t *address = NULL;
+        	axis2_char_t *epr_address = NULL;
+			axis2_property_t *property = NULL;
+
+        	/* Usual Request-Response Sync implemetation */
+        	property = axis2_property_create(env);
+        	AXIS2_PROPERTY_SET_SCOPE(property, env, AXIS2_SCOPE_REQUEST);
+        	epr_address = AXIS2_ENDPOINT_REF_GET_ADDRESS(
+					AXIS2_OPTIONS_GET_TO(op_client_impl->options, env), env);
+        	address = AXIS2_STRDUP(epr_address, env);
+        	AXIS2_PROPERTY_SET_VALUE(property, env, address);
+        	AXIS2_MSG_CTX_SET_PROPERTY(msg_ctx, env,
+                                    AXIS2_TRANSPORT_URL, property, AXIS2_FALSE);
+        	/*AXIS2_MSG_CTX_SET_TO(msg_ctx, env, call_impl->to);*/
+        	AXIS2_MSG_CTX_SET_SVC_CTX(msg_ctx, env, op_client_impl->svc_ctx);
+        	AXIS2_MSG_CTX_SET_CONF_CTX(msg_ctx, env, AXIS2_SVC_CTX_GET_CONF_CTX(op_client_impl->svc_ctx, env));
+
+			/*TODO: check this if it is necessary*/
+        	op_ctx = axis2_op_ctx_create(env, op, op_client_impl->svc_ctx);
+        	AXIS2_OP_REGISTER_OP_CTX(op, env, msg_ctx, op_ctx);
+
+        	/*Send the SOAP Message and receive a response */
+        	response_mc = axis2_mep_client_two_way_send(env, msg_ctx);
+        	if (!response_mc)
+            	return AXIS2_FAILURE;
+			axis2_op_client_add_msg_ctx(&(op_client_impl->op_client), env, response_mc);	
+		}
+		else
+		{
+		}
+	}
+	return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_op_client_reset(struct axis2_op_client *op_client,
+							axis2_env_t **env)
+{
+    axis2_op_client_impl_t *op_client_impl = NULL;
+
+	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+	
+	op_client_impl = AXIS2_INTF_TO_IMPL(op_client);
+
+	if (!op_client_impl->completed)
+		return AXIS2_FAILURE;
+
+	op_client_impl->completed = AXIS2_FALSE;
+
+	/*TODO:check
+	if (op_client_impl->op_ctx)
+		AXIS2_OP_CTX_FREE(op_client_impl->op_ctx, env);
+	*/
+	op_client_impl->op_ctx = NULL;
+
+	return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_op_client_compelete(struct axis2_op_client *op_client,
+                			axis2_env_t **env,
+                			axis2_msg_ctx_t *mc)
+{
+    axis2_op_client_impl_t *op_client_impl = NULL;
+	axis2_conf_ctx_t *conf_ctx = NULL;
+	axis2_listener_manager_t *listener_manager = NULL;
+	axis2_char_t *transport = NULL;
+
+	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+	
+	op_client_impl = AXIS2_INTF_TO_IMPL(op_client);
+
+	conf_ctx = AXIS2_MSG_CTX_GET_CONF_CTX(mc, env);
+
+	if (!conf_ctx)
+		return AXIS2_FAILURE;
+
+	/*TODO:uncomment when implemented
+	listener_manager = AXIS2_CONF_CTX_GET_LISTENER_MANAGER(conf_ctx, env);
+	*/
+	if (!listener_manager)
+		return AXIS2_FAILURE;
+	/*TODO:set transport*/
+	return AXIS2_LISTENER_MANAGER_STOP(listener_manager, env, transport);
+}
+
+axis2_op_ctx_t* AXIS2_CALL 
+axis2_op_client_get_operation_context(struct axis2_op_client *op_client)
+{
+    axis2_op_client_impl_t *op_client_impl = NULL;
+
+	op_client_impl = AXIS2_INTF_TO_IMPL(op_client);
+	
+	return op_client_impl->op_ctx;
+}
+		
+/** private functions - implementation */
+
+static void axis2_op_client_init_data(axis2_op_client_impl_t *op_client_impl)
+{
+	op_client_impl->svc_ctx = NULL;
+	op_client_impl->options = NULL;
+	op_client_impl->op_ctx = NULL;
+	op_client_impl->callback = NULL;
+	op_client_impl->completed = AXIS2_FALSE;
+}
+
+static void axis2_op_client_init_ops(axis2_op_client_t *op_client)
+{
+	op_client->ops->set_options = axis2_op_client_set_options;
+	op_client->ops->get_options = axis2_op_client_get_options;
+	op_client->ops->add_msg_ctx = axis2_op_client_add_msg_ctx;
+	op_client->ops->get_msg_ctx = axis2_op_client_get_msg_ctx;
+	op_client->ops->set_callback = axis2_op_client_set_callback;
+	op_client->ops->execute = axis2_op_client_execute;
+	op_client->ops->reset = axis2_op_client_reset;
+	op_client->ops->compelete = axis2_op_client_compelete;
+	op_client->ops->get_operation_context = axis2_op_client_get_operation_context;
+}
+
+static axis2_msg_ctx_t* axis2_op_client_invoke_blocking(axis2_op_client_impl_t *op_client_impl, 
+										axis2_env_t **env,
+										axis2_msg_ctx_t *mc)
+{
+	return NULL;
+}

Added: webservices/axis2/trunk/c/modules/core/clientapi/options.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/clientapi/options.c?rev=398702&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/options.c (added)
+++ webservices/axis2/trunk/c/modules/core/clientapi/options.c Mon May  1 14:45:01 2006
@@ -0,0 +1,1122 @@
+/*
+ * 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_options.h>
+#include <axis2.h>
+#include <axis2_hash.h>
+#include <axis2_soap.h>
+#include <axis2_msg_info_headers.h>
+#include <axis2_array_list.h>
+
+typedef struct axis2_options_impl
+{
+    /** options base struct */
+    axis2_options_t options;
+
+	/** parent options */
+	axis2_options_t *parent;
+
+	axis2_hash_t *properties;
+
+	axis2_char_t *soap_version_uri;
+
+	long timeout_in_milli_seconds;
+	
+	axis2_bool_t use_seperate_listener;
+
+	/** addressing specific properties */
+	axis2_msg_info_headers_t *msg_info_headers;
+
+	axis2_transport_receiver_t *receiver;
+
+	axis2_transport_in_desc_t *transport_in;
+
+	axis2_char_t *transport_in_protocol;
+
+
+	/** for sending and receiving messages */
+
+	axis2_transport_out_desc_t *transport_out;
+
+	axis2_char_t *sender_transport_protocol;
+
+	axis2_bool_t manage_session;
+} axis2_options_impl_t;
+
+/** Interface to implementation conversion macro */
+#define AXIS2_INTF_TO_IMPL(options) ((axis2_options_impl_t *)options)
+
+/** private function prototypes */
+static void axis2_options_init_data(axis2_options_impl_t *options);
+static void axis2_options_init_ops(struct axis2_options *options);
+
+
+/** public function prototypes */
+axis2_char_t* AXIS2_CALL 
+axis2_options_get_action(struct axis2_options *options,
+                		axis2_env_t **env);
+
+
+axis2_endpoint_ref_t* AXIS2_CALL 
+axis2_options_get_fault_to(struct axis2_options *options,
+                    		axis2_env_t **env);
+
+
+axis2_endpoint_ref_t* AXIS2_CALL
+axis2_options_get_from(struct axis2_options *options,
+            			axis2_env_t **env);
+
+axis2_transport_receiver_t* AXIS2_CALL 
+axis2_options_get_transport_receiver(struct axis2_options *options,
+                            		axis2_env_t **env);
+
+
+axis2_transport_in_desc_t* AXIS2_CALL 
+axis2_options_get_transport_in(struct axis2_options *options,
+                            	axis2_env_t **env);
+
+axis2_char_t* AXIS2_CALL 
+axis2_options_get_transport_in_protocol(struct axis2_options *options,
+                                			axis2_env_t **env);
+
+axis2_char_t* AXIS2_CALL 
+axis2_options_get_message_id(struct axis2_options *options,
+                    			axis2_env_t **env);
+
+axis2_hash_t* AXIS2_CALL 
+axis2_options_get_properties(struct axis2_options *options,
+                    			axis2_env_t **env);
+
+void* AXIS2_CALL 
+axis2_options_get_property(struct axis2_options *options,
+                    		axis2_env_t **env,
+                    		axis2_char_t *key);
+
+axis2_relates_to_t* AXIS2_CALL 
+axis2_options_get_relates_to(struct axis2_options *options,
+                    			axis2_env_t **env);
+
+
+axis2_endpoint_ref_t* AXIS2_CALL 
+axis2_options_get_reply_to(struct axis2_options *options,
+                    		axis2_env_t **env);
+
+axis2_transport_out_desc_t* AXIS2_CALL 
+axis2_options_get_transport_out(struct axis2_options *options,
+                        		axis2_env_t **env);
+
+axis2_char_t* AXIS2_CALL 
+axis2_options_get_sender_transport_protocol(struct axis2_options *options,
+                                    		axis2_env_t **env);
+
+axis2_char_t* AXIS2_CALL 
+axis2_options_get_soap_version_uri(struct axis2_options *options,
+                            		axis2_env_t **env);
+
+long AXIS2_CALL 
+axis2_options_get_timeout_in_milli_seconds(struct axis2_options *options,
+											axis2_env_t **env);
+
+axis2_endpoint_ref_t* AXIS2_CALL 
+axis2_options_get_to(struct axis2_options *options,
+                    	axis2_env_t **env);
+
+
+axis2_bool_t AXIS2_CALL 
+axis2_options_is_use_seperate_listener(struct axis2_options *options,
+                                		axis2_env_t **env);
+
+struct axis2_options * AXIS2_CALL 
+axis2_options_get_parent(struct axis2_options *options,
+                			axis2_env_t **env);
+
+void AXIS2_CALL 
+axis2_options_set_parent(struct axis2_options *options,
+                    		axis2_env_t **env,
+                    		struct axis2_options *parent);
+
+void AXIS2_CALL 
+axis2_options_set_action(struct axis2_options *options,
+                			axis2_env_t **env,
+                			axis2_char_t *action);
+
+void AXIS2_CALL 
+axis2_options_set_fault_to(struct axis2_options *options,
+                			axis2_env_t **env,
+                			axis2_endpoint_ref_t *fault_to);
+
+void AXIS2_CALL 
+axis2_options_set_from(struct axis2_options *options,
+                		axis2_env_t **env,
+                		axis2_endpoint_ref_t *from);
+
+void AXIS2_CALL 
+axis2_options_set_to(struct axis2_options *options,
+                		axis2_env_t **env,
+                		axis2_endpoint_ref_t *to);
+
+void AXIS2_CALL 
+axis2_options_set_transport_receiver(struct axis2_options *options,
+                            			axis2_env_t **env,
+                            			axis2_transport_receiver_t *receiver);
+
+void AXIS2_CALL 
+axis2_options_set_transport_in(struct axis2_options *options,
+                        		axis2_env_t **env,
+                        		axis2_transport_in_desc_t *transport_in);
+
+void AXIS2_CALL 
+axis2_options_set_transport_in_protocol(struct axis2_options *options,
+                                		axis2_env_t **env,
+                                		axis2_char_t *transport_in_protocol);
+
+
+void AXIS2_CALL 
+axis2_options_set_message_id(struct axis2_options *options,
+                    			axis2_env_t **env,
+                    			axis2_char_t *message_id);
+
+axis2_status_t AXIS2_CALL 
+axis2_options_set_properties(struct axis2_options *options,
+                    			axis2_env_t **env,
+                    			axis2_hash_t *properties);
+
+void AXIS2_CALL 
+axis2_options_set_property(struct axis2_options *options,
+                    		axis2_env_t **env,
+                    		axis2_char_t *property_key,
+                    		void *property);
+
+
+void AXIS2_CALL 
+axis2_options_set_relates_to(struct axis2_options *options,
+                    			axis2_env_t **env,
+                    			axis2_relates_to_t *relates_to);
+
+void AXIS2_CALL 
+axis2_options_set_reply_to(struct axis2_options *options,
+                    		axis2_env_t **env,
+                    		axis2_endpoint_ref_t *reply_to);
+
+void AXIS2_CALL 
+axis2_options_set_transport_out(struct axis2_options *options,
+                        		axis2_env_t **env,
+                        		axis2_transport_out_desc_t *transport_out);
+
+
+axis2_status_t AXIS2_CALL 
+axis2_options_set_sender_transport(struct axis2_options *options,
+                            		axis2_env_t **env,
+                            		axis2_char_t *sender_transport,
+                            		axis2_conf_t *conf);
+
+void AXIS2_CALL 
+axis2_options_set_soap_version_uri(struct axis2_options *options,
+                            		axis2_env_t **env,
+                            		axis2_char_t *soap_version_uri);
+
+void AXIS2_CALL 
+axis2_options_set_timeout_in_milli_seconds(struct axis2_options *options,
+                                    		axis2_env_t **env,
+                                    		long timeout_in_milli_seconds);
+
+
+axis2_status_t AXIS2_CALL 
+axis2_options_set_transport_info(struct axis2_options *options,
+                        		axis2_env_t **env,
+                        		axis2_char_t *sender_transport,
+                        		axis2_char_t *receiver_transport,
+                        		axis2_bool_t use_seperate_listener);
+
+void AXIS2_CALL 
+axis2_options_set_use_seperate_listener(struct axis2_options *options,
+                                		axis2_env_t **env,
+                                		axis2_bool_t use_seperate_listener);
+/*TODO:check - changed om_element to om_node*/
+void AXIS2_CALL 
+axis2_options_add_reference_parameter(struct axis2_options *options,
+                            axis2_env_t **env,
+                            axis2_om_node_t *reference_parameter);
+
+void AXIS2_CALL 
+axis2_options_set_manage_session(struct axis2_options *options,
+                            axis2_env_t **env,
+                            axis2_bool_t manage_session);
+
+axis2_bool_t AXIS2_CALL 
+axis2_options_is_manage_session(struct axis2_options *options,
+                            axis2_env_t **env);
+
+axis2_msg_info_headers_t* AXIS2_CALL 
+axis2_options_get_msg_info_headers(struct axis2_options *options,
+                            axis2_env_t **env);
+
+axis2_status_t AXIS2_CALL
+axis2_options_free (struct axis2_options *options,
+		                     axis2_env_t **env);
+
+
+axis2_options_t* AXIS2_CALL 
+axis2_options_create(axis2_env_t **env)
+{
+    axis2_options_impl_t *options_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+    
+    options_impl = AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_options_impl_t) );
+    if (!options_impl)
+    { 
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;        
+    }
+
+	/** initialize private data */
+    axis2_options_init_data(options_impl);
+	
+	options_impl->msg_info_headers = axis2_msg_info_headers_create(env, NULL, NULL);
+	if (!(options_impl->msg_info_headers))
+	{
+		axis2_options_free(&(options_impl->options), env);
+		return NULL;
+	}
+
+	options_impl->properties = axis2_hash_make(env);
+	if (!(options_impl->properties))
+	{
+		axis2_options_free(&(options_impl->options), env);
+		return NULL;
+	}
+
+    /** initialize ops */    
+    options_impl->options.ops  = 
+        AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_options_ops_t) );
+    
+    if (!options_impl->options.ops)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        axis2_options_free(&(options_impl->options), env);
+        return NULL;        
+    }
+
+	axis2_options_init_ops(&(options_impl->options));
+
+    return &(options_impl->options);
+}
+
+axis2_options_t* AXIS2_CALL
+axis2_options_create_with_parent(axis2_env_t **env,
+									struct axis2_options *parent)
+{
+
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(axis2_create_options(env));
+
+	if (options_impl)
+	{
+		options_impl->parent = parent;
+	}
+	return &(options_impl->options);
+}
+
+axis2_char_t* AXIS2_CALL 
+axis2_options_get_action(struct axis2_options *options, 
+                                  axis2_env_t **env) 
+{
+	axis2_options_impl_t *options_impl = NULL;
+	axis2_char_t *action = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	action = AXIS2_MSG_INFO_HEADERS_GET_ACTION(options_impl->msg_info_headers, env);
+
+	if (action == NULL && options_impl->parent)
+	{
+		return axis2_options_get_action(options_impl->parent, env);
+	}
+
+	return action;
+}
+
+axis2_endpoint_ref_t* AXIS2_CALL 
+axis2_options_get_fault_to(struct axis2_options *options,
+                    		axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+	axis2_endpoint_ref_t *fault_to = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	fault_to = AXIS2_MSG_INFO_HEADERS_GET_FAULT_TO(options_impl->msg_info_headers, env);
+
+	if (fault_to == NULL && options_impl->parent)
+	{
+		return axis2_options_get_fault_to(options_impl->parent, env);
+	}
+
+	return fault_to;
+}
+
+
+axis2_endpoint_ref_t* AXIS2_CALL
+axis2_options_get_from(struct axis2_options *options,
+            			axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+	axis2_endpoint_ref_t *from = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	from = AXIS2_MSG_INFO_HEADERS_GET_FROM(options_impl->msg_info_headers, env);
+
+	if (from == NULL && options_impl->parent)
+	{
+		return axis2_options_get_from(options_impl->parent, env);
+	}
+
+	return from;
+}
+
+axis2_transport_receiver_t* AXIS2_CALL 
+axis2_options_get_transport_receiver(struct axis2_options *options,
+                            		axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	if (options_impl->receiver == NULL && options_impl->parent)
+	{
+		return axis2_options_get_transport_receiver(options_impl->parent, env);
+	}
+
+	return options_impl->receiver;
+}
+
+
+axis2_transport_in_desc_t* AXIS2_CALL 
+axis2_options_get_transport_in(struct axis2_options *options,
+                            	axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	if (options_impl->transport_in == NULL && options_impl->parent)
+	{
+		return axis2_options_get_transport_in(options_impl->parent, env);
+	}
+
+	return options_impl->transport_in;
+}
+
+axis2_char_t* AXIS2_CALL 
+axis2_options_get_transport_in_protocol(struct axis2_options *options,
+                                			axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	if (options_impl->transport_in_protocol == NULL && options_impl->parent)
+	{
+		return axis2_options_get_transport_in_protocol(options_impl->parent, env);
+	}
+
+	return options_impl->transport_in_protocol;
+}
+
+axis2_char_t* AXIS2_CALL 
+axis2_options_get_message_id(struct axis2_options *options,
+                    			axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+	axis2_char_t *message_id = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	message_id = AXIS2_MSG_INFO_HEADERS_GET_MESSAGE_ID(options_impl->msg_info_headers, env);
+
+	if (message_id == NULL && options_impl->parent)
+	{
+		return axis2_options_get_message_id(options_impl->parent, env);
+	}
+
+	return message_id;
+}
+
+/*TODO:pointer is returned; do we need to copy to a new axis2_hash_t 
+  as java does??
+  */
+axis2_hash_t* AXIS2_CALL 
+axis2_options_get_properties(struct axis2_options *options,
+                    			axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	if (axis2_hash_count(options_impl->properties) == 0 && options_impl->parent)
+	{
+		return axis2_options_get_properties(options_impl->parent, env);
+	}
+
+	return options_impl->properties;
+}
+
+void* AXIS2_CALL 
+axis2_options_get_property(struct axis2_options *options,
+                    		axis2_env_t **env,
+                    		axis2_char_t *key)
+{
+	void *property = NULL;
+	axis2_options_impl_t *options_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+	property = axis2_hash_get(options_impl->properties, key, AXIS2_HASH_KEY_STRING);
+
+	if (property == NULL && options_impl->parent)
+	{
+		return axis2_options_get_property(options_impl->parent, env, key);
+	}
+
+	return property;
+}
+
+axis2_relates_to_t* AXIS2_CALL 
+axis2_options_get_relates_to(struct axis2_options *options,
+                    			axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+	axis2_relates_to_t *relates_to = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	relates_to = AXIS2_MSG_INFO_HEADERS_GET_RELATES_TO(options_impl->msg_info_headers, env);
+
+	if (relates_to == NULL && options_impl->parent)
+	{
+		return axis2_options_get_relates_to(options_impl->parent, env);
+	}
+
+	return relates_to;
+}
+
+
+axis2_endpoint_ref_t* AXIS2_CALL 
+axis2_options_get_reply_to(struct axis2_options *options,
+                    		axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+	axis2_endpoint_ref_t *reply_to = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	reply_to = AXIS2_MSG_INFO_HEADERS_GET_REPLY_TO(options_impl->msg_info_headers, env);
+
+	if (reply_to == NULL && options_impl->parent)
+	{
+		return axis2_options_get_reply_to(options_impl->parent, env);
+	}
+
+	return reply_to;
+}
+
+axis2_transport_out_desc_t* AXIS2_CALL 
+axis2_options_get_transport_out(struct axis2_options *options,
+                        		axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	if (options_impl->transport_out == NULL && options_impl->parent)
+	{
+		return axis2_options_get_transport_out(options_impl->parent, env);
+	}
+
+	return options_impl->transport_out;
+}
+
+axis2_char_t* AXIS2_CALL 
+axis2_options_get_sender_transport_protocol(struct axis2_options *options,
+                                    		axis2_env_t **env)
+{
+
+	axis2_options_impl_t *options_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	if (options_impl->sender_transport_protocol == NULL && options_impl->parent)
+	{
+		return axis2_options_get_sender_transport_protocol(options_impl->parent, env);
+	}
+
+	return options_impl->sender_transport_protocol;
+}
+
+axis2_char_t* AXIS2_CALL 
+axis2_options_get_soap_version_uri(struct axis2_options *options,
+                            		axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	if (options_impl->soap_version_uri == NULL && options_impl->parent)
+	{
+		return axis2_options_get_soap_version_uri(options_impl->parent, env);
+	}
+
+	if (options_impl->soap_version_uri)
+	{
+		return options_impl->soap_version_uri;
+	}
+	/**TODO:java returns 11- isn't the default is 12?*/
+	return AXIS2_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI; 
+
+}
+
+long AXIS2_CALL 
+axis2_options_get_timeout_in_milli_seconds(struct axis2_options *options,
+											axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	if (options_impl->timeout_in_milli_seconds == -1 && options_impl->parent)
+	{
+		return axis2_options_get_timeout_in_milli_seconds(options_impl->parent, env);
+	}
+
+	if (options_impl->timeout_in_milli_seconds == -1)
+	{
+		return AXIS2_DEFAULT_TIMEOUT_MILLISECONDS;
+	}
+	
+	return options_impl->timeout_in_milli_seconds;
+}
+
+
+axis2_endpoint_ref_t* AXIS2_CALL 
+axis2_options_get_to(struct axis2_options *options,
+                    	axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+	axis2_endpoint_ref_t *to = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	to = AXIS2_MSG_INFO_HEADERS_GET_TO(options_impl->msg_info_headers, env);
+
+	if (to == NULL && options_impl->parent)
+	{
+		return axis2_options_get_to(options_impl->parent, env);
+	}
+
+	return to;
+}
+
+
+axis2_bool_t AXIS2_CALL 
+axis2_options_is_use_seperate_listener(struct axis2_options *options,
+                                		axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+    /*AXIS2_ENV_CHECK(env, NULL);*/
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	if (options_impl->use_seperate_listener == -1 && options_impl->parent)
+	{
+		return axis2_options_is_use_seperate_listener(options_impl->parent, env);
+	}
+
+	if (options_impl->use_seperate_listener == -1)
+	{
+		return AXIS2_FALSE;
+	}
+	
+	return options_impl->use_seperate_listener;
+}
+
+struct axis2_options * AXIS2_CALL 
+axis2_options_get_parent(struct axis2_options *options,
+                			axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+    /*AXIS2_ENV_CHECK(env, NULL);*/
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	return options_impl->parent;
+}
+
+void AXIS2_CALL 
+axis2_options_set_parent(struct axis2_options *options,
+                    		axis2_env_t **env,
+                    		struct axis2_options *parent)
+{
+	axis2_options_impl_t *options_impl = NULL;
+    /*AXIS2_ENV_CHECK(env, NULL);*/
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	options_impl->parent = parent;
+}
+
+void AXIS2_CALL 
+axis2_options_set_action(struct axis2_options *options,
+                			axis2_env_t **env,
+                			axis2_char_t *action)
+{
+	axis2_options_impl_t *options_impl = NULL;
+    /*AXIS2_ENV_CHECK(env, NULL);*/
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	AXIS2_MSG_INFO_HEADERS_SET_ACTION(options_impl->msg_info_headers, env, action);
+}
+
+void AXIS2_CALL 
+axis2_options_set_fault_to(struct axis2_options *options,
+                			axis2_env_t **env,
+                			axis2_endpoint_ref_t *fault_to)
+{
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	AXIS2_MSG_INFO_HEADERS_SET_FAULT_TO(options_impl->msg_info_headers, env, fault_to);
+}
+
+void AXIS2_CALL 
+axis2_options_set_from(struct axis2_options *options,
+                		axis2_env_t **env,
+                		axis2_endpoint_ref_t *from)
+{
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	AXIS2_MSG_INFO_HEADERS_SET_FROM(options_impl->msg_info_headers, env, from);
+}
+
+void AXIS2_CALL 
+axis2_options_set_to(struct axis2_options *options,
+                		axis2_env_t **env,
+                		axis2_endpoint_ref_t *to)
+{
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	AXIS2_MSG_INFO_HEADERS_SET_TO(options_impl->msg_info_headers, env, to);
+}
+
+void AXIS2_CALL 
+axis2_options_set_transport_receiver(struct axis2_options *options,
+                            			axis2_env_t **env,
+                            			axis2_transport_receiver_t *receiver)
+{
+
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	options_impl->receiver = receiver;
+}
+
+void AXIS2_CALL 
+axis2_options_set_transport_in(struct axis2_options *options,
+                        		axis2_env_t **env,
+                        		axis2_transport_in_desc_t *transport_in)
+{
+
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	options_impl->transport_in = transport_in;
+}
+
+void AXIS2_CALL 
+axis2_options_set_transport_in_protocol(struct axis2_options *options,
+                                		axis2_env_t **env,
+                                		axis2_char_t *transport_in_protocol)
+{
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	options_impl->transport_in_protocol = transport_in_protocol;
+}
+
+
+void AXIS2_CALL 
+axis2_options_set_message_id(struct axis2_options *options,
+                    			axis2_env_t **env,
+                    			axis2_char_t *message_id)
+{
+
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	AXIS2_MSG_INFO_HEADERS_SET_MESSAGE_ID(options_impl->msg_info_headers, env, message_id);
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_options_set_properties(struct axis2_options *options,
+                    			axis2_env_t **env,
+                    			axis2_hash_t *properties)
+{
+	axis2_options_impl_t *options_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	/*TODO:what happens to hash objects when freeing??*/
+	if (options_impl->properties)
+	{
+		axis2_hash_free(options_impl->properties, env);
+	}
+	options_impl->properties = properties;
+	return AXIS2_SUCCESS;
+}
+
+void AXIS2_CALL 
+axis2_options_set_property(struct axis2_options *options,
+                    		axis2_env_t **env,
+                    		axis2_char_t *property_key,
+                    		void *property)
+{
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+	axis2_hash_set(options_impl->properties, property_key,
+			AXIS2_HASH_KEY_STRING, property);
+}
+
+
+void AXIS2_CALL 
+axis2_options_set_relates_to(struct axis2_options *options,
+                    			axis2_env_t **env,
+                    			axis2_relates_to_t *relates_to)
+{
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	AXIS2_MSG_INFO_HEADERS_SET_RELATES_TO(options_impl->msg_info_headers, env, relates_to);
+}
+
+void AXIS2_CALL 
+axis2_options_set_reply_to(struct axis2_options *options,
+                    		axis2_env_t **env,
+                    		axis2_endpoint_ref_t *reply_to)
+{
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	AXIS2_MSG_INFO_HEADERS_SET_REPLY_TO(options_impl->msg_info_headers, env, reply_to);
+}
+
+void AXIS2_CALL 
+axis2_options_set_transport_out(struct axis2_options *options,
+                        		axis2_env_t **env,
+                        		axis2_transport_out_desc_t *transport_out)
+{
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	options_impl->transport_out = transport_out;
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_options_set_sender_transport(struct axis2_options *options,
+                            		axis2_env_t **env,
+                            		axis2_char_t *sender_transport,
+                            		axis2_conf_t *conf)
+{
+	axis2_options_impl_t *options_impl = NULL;
+	axis2_qname_t *tmp = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+	
+	tmp = axis2_qname_create(env, sender_transport, NULL, NULL);
+	if (!tmp)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+		return AXIS2_FAILURE;
+	}
+	
+	options_impl->transport_out = AXIS2_CONF_GET_TRANSPORT_OUT(conf, env, tmp);
+	AXIS2_QNAME_FREE(tmp, env);
+
+	if (!options_impl->transport_out)
+	{
+		/*TODO:error*/
+		return AXIS2_FAILURE;
+	}
+	return AXIS2_SUCCESS;
+}
+
+void AXIS2_CALL 
+axis2_options_set_soap_version_uri(struct axis2_options *options,
+                            		axis2_env_t **env,
+                            		axis2_char_t *soap_version_uri)
+{
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	options_impl->soap_version_uri = soap_version_uri;
+}
+
+void AXIS2_CALL 
+axis2_options_set_timeout_in_milli_seconds(struct axis2_options *options,
+                                    		axis2_env_t **env,
+                                    		long timeout_in_milli_seconds)
+{
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	options_impl->timeout_in_milli_seconds = timeout_in_milli_seconds;
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_options_set_transport_info(struct axis2_options *options,
+                        		axis2_env_t **env,
+                        		axis2_char_t *sender_transport,
+                        		axis2_char_t *receiver_transport,
+                        		axis2_bool_t use_seperate_listener)
+{
+	axis2_options_impl_t *options_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+	/**
+	  here we check for the legal combination
+	  */
+	if (!use_seperate_listener)
+	{
+		if (0 != strcmp(sender_transport, receiver_transport))	
+		{
+			/*TODO:error*/
+			return AXIS2_FAILURE;
+		}
+		/*TODO: check the transport is either HTTP or TCP*/
+	}
+	else
+	{
+		axis2_options_set_use_seperate_listener(&(options_impl->options),
+					env, use_seperate_listener);
+	}
+	axis2_options_set_transport_in_protocol(&(options_impl->options), env, receiver_transport);
+	options_impl->sender_transport_protocol = sender_transport;
+
+	return AXIS2_SUCCESS;
+}
+
+void AXIS2_CALL 
+axis2_options_set_use_seperate_listener(struct axis2_options *options,
+                                		axis2_env_t **env,
+                                		axis2_bool_t use_seperate_listener)
+{
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	options_impl->use_seperate_listener = use_seperate_listener;
+}
+
+void AXIS2_CALL
+axis2_options_add_reference_parameter(struct axis2_options *options,
+                            axis2_env_t **env,
+                            axis2_om_node_t *reference_parameter)
+{
+
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	AXIS2_MSG_INFO_HEADERS_ADD_REF_PARAM(options_impl->msg_info_headers,
+				env, reference_parameter);
+}
+
+
+void AXIS2_CALL 
+axis2_options_set_manage_session(struct axis2_options *options,
+                            axis2_env_t **env,
+                            axis2_bool_t manage_session)
+{
+	axis2_options_impl_t *options_impl = NULL;
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	options_impl->manage_session = manage_session;
+}
+
+axis2_bool_t AXIS2_CALL 
+axis2_options_is_manage_session(struct axis2_options *options,
+                            axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	if (options_impl->manage_session == -1 && options_impl->parent)
+	{
+		return axis2_options_is_manage_session(options_impl->parent, env);
+	}
+
+	if (options_impl->manage_session == -1)
+	{
+		return AXIS2_FALSE;
+	}
+	
+	return options_impl->manage_session;
+}
+
+axis2_msg_info_headers_t* AXIS2_CALL 
+axis2_options_get_msg_info_headers(struct axis2_options *options,
+                            axis2_env_t **env)
+{
+	axis2_options_impl_t *options_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+	options_impl = AXIS2_INTF_TO_IMPL(options);
+
+	return options_impl->msg_info_headers;
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_options_free (struct axis2_options *options, 
+                     axis2_env_t **env)
+{
+    axis2_options_impl_t *options_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    options_impl = AXIS2_INTF_TO_IMPL(options);
+    
+    if (options_impl->options.ops)
+    {
+        AXIS2_FREE((*env)->allocator, options_impl->options.ops);
+        options_impl->options.ops = NULL;
+    }
+
+	if (options_impl->properties)
+	{
+		axis2_hash_free(options_impl->properties, env);
+		options_impl->properties = NULL;
+	}
+
+    AXIS2_FREE((*env)->allocator, options_impl);
+    options_impl = NULL;
+    
+    return AXIS2_SUCCESS;
+}
+
+static void axis2_options_init_data(axis2_options_impl_t *options_impl)
+{
+    options_impl->options.ops = NULL;
+	options_impl->parent = NULL;
+	options_impl->properties = NULL;
+	options_impl->soap_version_uri = NULL;
+	/*AXIS2_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;*/
+	options_impl->timeout_in_milli_seconds = -1;
+	/*AXIS2_DEFAULT_TIMEOUT_MILLISECONDS;*/
+	options_impl->use_seperate_listener = -1;
+	/*AXIS2_FALSE;*/
+
+	options_impl->receiver = NULL;
+	options_impl->transport_in = NULL;
+	options_impl->transport_in_protocol = NULL;
+	options_impl->transport_out = NULL;
+	options_impl->sender_transport_protocol = NULL;
+	options_impl->manage_session = -1;
+}
+
+static void axis2_options_init_ops(struct axis2_options *options)
+{
+
+	options->ops->get_action = axis2_options_get_action;
+	options->ops->get_fault_to = axis2_options_get_fault_to;
+	options->ops->get_from = axis2_options_get_from;
+	options->ops->get_transport_receiver = axis2_options_get_transport_receiver;
+	options->ops->get_transport_in = axis2_options_get_transport_in;
+	options->ops->get_transport_in_protocol = axis2_options_get_transport_in_protocol;
+	options->ops->get_message_id = axis2_options_get_message_id;
+	options->ops->get_properties = axis2_options_get_properties;
+	options->ops->get_property = axis2_options_get_property;
+	options->ops->get_relates_to = axis2_options_get_relates_to;
+	options->ops->get_reply_to = axis2_options_get_reply_to;
+	options->ops->get_transport_out = axis2_options_get_transport_out;
+	options->ops->get_sender_transport_protocol = axis2_options_get_sender_transport_protocol;
+	options->ops->get_soap_version_uri = axis2_options_get_soap_version_uri;
+	options->ops->get_timeout_in_milli_seconds = axis2_options_get_timeout_in_milli_seconds;
+	options->ops->get_to = axis2_options_get_to;
+	options->ops->is_use_seperate_listener = axis2_options_is_use_seperate_listener;
+	options->ops->get_parent = axis2_options_get_parent;
+	options->ops->set_parent = axis2_options_set_parent;
+	options->ops->set_action = axis2_options_set_action;
+	options->ops->set_fault_to = axis2_options_set_fault_to;
+	options->ops->set_from = axis2_options_set_from;
+	options->ops->set_to = axis2_options_set_to;
+	options->ops->set_transport_receiver = axis2_options_set_transport_receiver;
+	options->ops->set_transport_in = axis2_options_set_transport_in;
+	options->ops->set_transport_in_protocol = axis2_options_set_transport_in_protocol;
+	options->ops->set_message_id = axis2_options_set_message_id;
+	options->ops->set_properties = axis2_options_set_properties;
+	options->ops->set_property = axis2_options_set_property;
+	options->ops->set_relates_to = axis2_options_set_relates_to;
+	options->ops->set_reply_to = axis2_options_set_reply_to;
+	options->ops->set_transport_out = axis2_options_set_transport_out;
+	options->ops->set_sender_transport = axis2_options_set_sender_transport;
+	options->ops->set_soap_version_uri = axis2_options_set_soap_version_uri;
+	options->ops->set_timeout_in_milli_seconds = axis2_options_set_timeout_in_milli_seconds;
+	options->ops->set_transport_info = axis2_options_set_transport_info;
+	options->ops->set_use_seperate_listener = axis2_options_set_use_seperate_listener;
+	options->ops->add_reference_parameter = axis2_options_add_reference_parameter;
+	options->ops->set_manage_session = axis2_options_set_manage_session;
+	options->ops->is_manage_session = axis2_options_is_manage_session;
+	options->ops->free = axis2_options_free;
+}

Added: webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c?rev=398702&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c (added)
+++ webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c Mon May  1 14:45:01 2006
@@ -0,0 +1,999 @@
+/*
+ * 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_svc_client.h>
+#include <axis2.h>
+#include <axis2_hash.h>
+#include <callback_recv.h>
+#include <axis2_soap.h>
+#include <axis2_soap_body.h>
+#include <listener_manager.h>
+#include <axis2_module_desc.h>
+#include <axis2_array_list.h>
+#include <axis2_options.h>
+
+typedef struct axis2_svc_client_impl
+{
+    /** svc_client base struct */
+    axis2_svc_client_t svc_client;
+
+	axis2_svc_t *svc;
+
+	axis2_conf_t *conf;
+
+	axis2_conf_ctx_t *conf_ctx;
+
+	axis2_svc_ctx_t *svc_ctx;
+
+	axis2_options_t *options;
+
+	axis2_options_t *override_options;
+
+	axis2_array_list_t *headers;
+	
+	/** for receiving the async messages */
+	axis2_callback_recv_t *callback_recv;	
+
+} axis2_svc_client_impl_t;
+
+/** Interface to implementation conversion macro */
+#define AXIS2_INTF_TO_IMPL(svc_client) ((axis2_svc_client_impl_t *)svc_client)
+
+/** private functions */
+static axis2_bool_t initialize_transport(axis2_env_t **env, 
+									axis2_svc_client_impl_t *svc_client_impl,
+									axis2_conf_ctx_t *conf_ctx,
+									axis2_char_t *client_home);
+static axis2_bool_t axis2_svc_client_init_data(axis2_env_t **env,
+									axis2_svc_client_impl_t *svc_client_impl);
+static void axis2_svc_client_init_ops(axis2_svc_client_t *svc_client);
+static axis2_svc_t* axis2_create_annonymous_svc(axis2_env_t **env);
+static axis2_bool_t fill_soap_envelope(axis2_env_t **env, axis2_svc_client_impl_t *svc_client_impl,
+                                axis2_msg_ctx_t *msg_ctx, axis2_om_node_t *payload);
+
+/** public funcitons */
+axis2_svc_t* AXIS2_CALL 
+axis2_svc_client_get_axis_service(struct axis2_svc_client *svc_client);
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_set_options(struct axis2_svc_client *svc_client,
+                axis2_env_t **env,
+                axis2_options_t *options);
+
+axis2_options_t* AXIS2_CALL 
+axis2_svc_client_get_options(struct axis2_svc_client *svc_client);
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_set_override_options(struct axis2_svc_client *svc_client,
+                        axis2_env_t **env,
+                        axis2_options_t *override_options);
+
+axis2_options_t* AXIS2_CALL 
+axis2_svc_client_get_override_options(struct axis2_svc_client *svc_client);
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_engage_module(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_qname_t *module_name);
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_disengage_module(struct axis2_svc_client *svc_client,
+                        axis2_env_t **env,
+                        axis2_qname_t *module_name);
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_add_header(struct axis2_svc_client *svc_client,
+                				axis2_env_t **env,
+                				axis2_om_node_t *header);
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_remove_headers(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env);
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_add_header_with_text(struct axis2_svc_client *svc_client,
+                        axis2_env_t **env,
+                        axis2_qname_t *header_name,
+                        axis2_char_t *header_text);
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_send_robust(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_om_node_t *payload);
+
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_send_robust_with_operation(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_qname_t *operation,
+                    axis2_om_node_t *payload);
+
+void AXIS2_CALL 
+axis2_svc_client_fire_and_forget(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_om_node_t *payload);
+
+
+void AXIS2_CALL 
+axis2_svc_client_fire_and_forget_with_operation(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_qname_t *operation,
+                    axis2_om_node_t *payload);
+
+axis2_om_node_t* AXIS2_CALL 
+axis2_svc_client_send_receive(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_om_node_t *payload);
+
+
+axis2_om_node_t* AXIS2_CALL 
+axis2_svc_client_send_receive_with_operation(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_qname_t *operation,
+                    axis2_om_node_t *payload);
+
+
+void AXIS2_CALL 
+axis2_svc_client_send_receive_non_blocking(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_om_node_t *payload,
+                    axis2_callback_t *callback);
+
+void AXIS2_CALL 
+axis2_svc_client_send_receive_non_blocking_with_operation(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_qname_t *operation,
+                    axis2_om_node_t *payload,
+                    axis2_callback_t *callback);
+
+axis2_op_client_t* AXIS2_CALL 
+axis2_svc_client_create_client(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_qname_t *operation);
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_finalize_invoke(struct axis2_svc_client *svc_client,
+                        axis2_env_t **env);
+    
+axis2_endpoint_ref_t* AXIS2_CALL 
+axis2_svc_client_get_my_epr(struct axis2_svc_client *svc_client,
+                axis2_env_t **env,
+                axis2_char_t *transport);
+
+axis2_endpoint_ref_t* AXIS2_CALL 
+axis2_svc_client_get_target_epr(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env);
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_set_target_epr(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_endpoint_ref_t *target_epr);
+    
+axis2_svc_ctx_t* AXIS2_CALL 
+axis2_svc_client_get_svc_ctx(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env);
+
+
+axis2_svc_client_t* AXIS2_CALL
+axis2_svc_client_create(axis2_env_t **env, axis2_char_t *client_home)
+{
+    axis2_svc_client_impl_t *svc_client_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+   	svc_client_impl = AXIS2_INTF_TO_IMPL(axis2_svc_client_create_with_conf_ctx_and_svc
+											(env, NULL, NULL, client_home));
+	
+	if (!svc_client_impl)
+		return NULL;
+ 
+	return &(svc_client_impl->svc_client);
+}
+
+axis2_svc_client_t* AXIS2_CALL
+axis2_svc_client_create_with_conf_ctx_and_svc(axis2_env_t **env,
+                                         	axis2_conf_ctx_t *conf_ctx,
+                                         	axis2_svc_t *svc,
+											axis2_char_t *client_home)
+{
+    axis2_svc_client_impl_t *svc_client_impl = NULL;
+	axis2_svc_grp_t *svc_grp = NULL;
+	axis2_svc_grp_ctx_t *svc_grp_ctx = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    svc_client_impl = AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_svc_client_impl_t));
+    if (!svc_client_impl)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+    /** initialize private data to NULL, create options */
+    if (!axis2_svc_client_init_data(env, svc_client_impl))
+	{
+		axis2_svc_client_free(&(svc_client_impl->svc_client), env);
+		retrun NULL;
+	}
+	
+	if (!initialize_transport(env, svc_client_impl, conf_ctx, client_home))
+	{
+		axis2_svc_client_free(&(svc_client_impl->svc_client), env);
+		return NULL;
+	}
+
+	svc_client_impl->conf = AXIS2_CONF_CTX_GET_CONF(svc_client_impl->conf_ctx, env);
+	
+	if (svc)
+	{
+		svc_client_impl->svc = svc;
+	}
+	else
+	{
+		if (NULL == (svc_client_impl->svc = axis2_create_annonymous_svc(env)))
+		{
+			axis2_svc_client_free(&(svc_client_impl->svc_client), env);
+			return NULL;
+		}
+	}
+	
+	/** add the service to the config context if it isn't in there already */
+	if (NULL == AXIS2_CONF_GET_SVC(svc_client_impl->conf, env, 
+					AXIS2_SVC_GET_AXIS2_SVC_NAME(svc_client_impl->svc, env)))
+	{
+		AXIS2_CONF_ADD_SVC(svc_client_impl->conf, env, svc_client_impl->svc);
+	}
+
+    /** create a service context for myself: create a new service group
+     context and then get the service context for myself as I'll need that
+     later for stuff that I gotta do
+	 */
+	svc_grp = AXIS2_SVC_GET_PARENT(svc_client_impl->svc, env);
+    if (!svc_grp)
+        return NULL;
+    
+	svc_grp_ctx = AXIS2_SVC_GRP_GET_SVC_GRP_CTX(svc_grp, env, 
+					svc_client_impl->conf_ctx);
+    if (!svc_grp_ctx)
+        return NULL;
+    
+	AXIS2_CONF_CTX_REGISTER_SVC_GRP_CTX(svc_client_impl->conf_ctx, env, 
+		AXIS2_SVC_GET_AXIS2_SVC_NAME(svc_client_impl->svc, env), svc_grp_ctx);
+    
+	svc_client_impl->svc_ctx = AXIS2_SVC_GRP_CTX_GET_SVC_CTX(svc_grp_ctx, env,
+		        AXIS2_SVC_GET_AXIS2_SVC_NAME(svc_client_impl->svc, env));
+    
+    /* create ops */
+    svc_client_impl->svc_client.ops  =
+        AXIS2_MALLOC( (*env)->allocator, sizeof(axis2_svc_client_ops_t));
+
+    if (!svc_client_impl->svc_client.ops)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        axis2_svc_client_free(&(svc_client_impl->svc_client), env);
+        return NULL;
+    }
+
+    /** initialize ops */
+    axis2_svc_client_init_ops(&(svc_client_impl->svc_client));
+
+    return &(svc_client_impl->svc_client);
+}
+
+
+
+axis2_svc_t* AXIS2_CALL 
+axis2_svc_client_get_axis_service(struct axis2_svc_client *svc_client)
+{
+    axis2_svc_client_impl_t *svc_client_impl = NULL;
+    
+   	svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+	return svc_client_impl->svc;
+
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_set_options(struct axis2_svc_client *svc_client,
+                axis2_env_t **env,
+                axis2_options_t *options)
+{
+    axis2_svc_client_impl_t *svc_client_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+	
+	/*TODO:double check whether we need to free*/
+	if (svc_client_impl->options)
+		axis2_options_free(svc_client_impl->options, env);
+   	svc_client_impl->options = options;
+	return AXIS2_SUCCESS;	
+}
+
+axis2_options_t* AXIS2_CALL 
+axis2_svc_client_get_options(struct axis2_svc_client *svc_client)
+{
+    axis2_svc_client_impl_t *svc_client_impl = NULL;
+
+    svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+
+	return svc_client_impl->options;
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_set_override_options(struct axis2_svc_client *svc_client,
+                        axis2_env_t **env,
+                        axis2_options_t *override_options)
+{
+    axis2_svc_client_impl_t *svc_client_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+
+	if (svc_client_impl->override_options)
+		axis2_options_free(svc_client_impl->override_options, env);
+
+	svc_client_impl->override_options = override_options;
+
+	return AXIS2_SUCCESS;
+}
+
+axis2_options_t* AXIS2_CALL 
+axis2_svc_client_get_override_options(struct axis2_svc_client *svc_client)
+{
+    axis2_svc_client_impl_t *svc_client_impl = NULL;
+
+    svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+
+	return svc_client_impl->override_options;
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_engage_module(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_qname_t *module_name)
+{
+    axis2_svc_client_impl_t *svc_client_impl = NULL;
+	axis2_module_desc_t *module = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+
+	module = AXIS2_CONF_GET_MODULE(svc_client_impl->conf, env, module_name);
+
+	if (module)
+	{
+		return AXIS2_SVC_ENGAGE_MODULE(svc_client_impl->svc, env, module,
+										svc_client_impl->conf);
+	}
+	return AXIS2_FAILURE;
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_disengage_module(struct axis2_svc_client *svc_client,
+                        axis2_env_t **env,
+                        axis2_qname_t *module_name)
+{
+    axis2_svc_client_impl_t *svc_client_impl = NULL;
+	axis2_module_desc_t *module = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+
+	module = AXIS2_CONF_GET_MODULE(svc_client_impl->conf, env, module_name);
+
+	/**TODO:uncomment once axis2_svc_disengage_module is implemented
+	if (module)
+	{
+		return AXIS2_SVC_DISENGAGE_MODULE(svc_client_impl->svc, env, module);
+		
+	}
+	*/
+
+	return AXIS2_FAILURE;
+
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_add_header(struct axis2_svc_client *svc_client,
+                				axis2_env_t **env,
+                				axis2_om_node_t *header)
+{
+    axis2_svc_client_impl_t *svc_client_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+
+	if (!svc_client_impl->headers)
+	{
+		svc_client_impl->headers = axis2_array_list_create(env, 0);
+		if(!svc_client_impl->headers)
+		{
+			AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+			return AXIS2_FAILURE;
+		}
+	}
+	AXIS2_ARRAY_LIST_ADD(svc_client_impl->headers, env, header);
+
+	return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_remove_headers(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env)
+{
+    axis2_svc_client_impl_t *svc_client_impl = NULL;
+	int i = 0, size = 0;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+
+	if (!svc_client_impl->headers)
+		return AXIS2_FAILURE;
+	
+	size = AXIS2_ARRAY_LIST_SIZE(svc_client_impl->headers, env);
+	for (i = 0; i < size; i++)
+	{
+		axis2_om_node_t *node = NULL;
+		node = AXIS2_ARRAY_LIST_GET(svc_client_impl->headers, env, i);
+		if (node)
+		{
+			AXIS2_OM_NODE_FREE_TREE(node, env);
+			node = NULL;
+		}
+	}
+	return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_add_header_with_text(struct axis2_svc_client *svc_client,
+                        axis2_env_t **env,
+                        axis2_qname_t *header_name,
+                        axis2_char_t *header_text)
+{
+	axis2_om_node_t *node_name, *node_text;
+	axis2_om_element_t *element = NULL;
+	axis2_om_text_t *text = NULL;
+    axis2_svc_client_impl_t *svc_client_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+
+	element = axis2_om_element_create_with_qname(env, NULL, header_name, &node_name);
+	if (!element)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+		return AXIS2_FAILURE;
+	}
+	text = axis2_om_text_create(env, node_name, header_text, &node_text);
+	if (!text)
+	{
+		AXIS2_OM_ELEMENT_FREE(element, env);
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+		return AXIS2_FAILURE;
+	}
+	return axis2_svc_client_add_header(&(svc_client_impl->svc_client), env,
+			node_name);
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_send_robust(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_om_node_t *payload)
+{
+	return AXIS2_FAILURE;
+}
+
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_send_robust_with_operation(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_qname_t *operation,
+                    axis2_om_node_t *payload)
+{
+	return AXIS2_FAILURE;
+}
+
+void AXIS2_CALL 
+axis2_svc_client_fire_and_forget(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_om_node_t *payload)
+{
+
+}
+
+void AXIS2_CALL 
+axis2_svc_client_fire_and_forget_with_operation(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_qname_t *operation,
+                    axis2_om_node_t *payload)
+{
+
+}
+
+axis2_om_node_t* AXIS2_CALL 
+axis2_svc_client_send_receive(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_om_node_t *payload)
+{
+	axis2_svc_client_impl_t *svc_client_impl = NULL;
+	axis2_qname_t *op = NULL;
+	AXIS2_ENV_CHECK(env, NULL);
+
+	svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+	op = axis2_qname_create(env, AXIS2_ANON_OUT_IN_OP, NULL, NULL);
+	
+	return axis2_svc_client_send_receive_with_operation(
+			&(svc_client_impl->svc_client), env, op, payload);
+}
+
+
+axis2_om_node_t* AXIS2_CALL 
+axis2_svc_client_send_receive_with_operation(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_qname_t *operation,
+                    axis2_om_node_t *payload)
+{
+	axis2_svc_client_impl_t *svc_client_impl = NULL;
+
+	AXIS2_ENV_CHECK(env, NULL);
+
+	svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+
+	if (AXIS2_OPTIONS_IS_USE_SEPERATE_LISTENER(svc_client_impl->options, env))
+	{
+		return NULL;
+	}
+	else
+	{
+		axis2_op_client_t *mep_client = NULL;
+		axis2_msg_ctx_t *res_msg_ctx = NULL;
+		axis2_msg_ctx_t *mc = NULL;
+		axis2_soap_envelope_t *soap_envelope = NULL;
+		axis2_soap_body_t *soap_body = NULL;
+		axis2_om_node_t *soap_node = NULL;
+
+		mc = axis2_msg_ctx_create(env, 
+				AXIS2_SVC_CTX_GET_CONF_CTX(svc_client_impl->svc_ctx, env), NULL, NULL);
+		if (!fill_soap_envelope(env, svc_client_impl, mc, payload))
+			return NULL;
+		
+		mep_client = axis2_svc_client_create_client(&(svc_client_impl->svc_client), env, operation);
+		
+		AXIS2_OP_CLIENT_ADD_MSG_CTX(mep_client, env, mc);
+		AXIS2_OP_CLIENT_EXECUTE(mep_client, env, AXIS2_TRUE);
+		res_msg_ctx = AXIS2_OP_CTX_GET_MSG_CTX(mep_client, env, AXIS2_WSDL_MESSAGE_LABEL_IN_VALUE);
+		
+		if (!res_msg_ctx)
+        {
+			return NULL;
+		}
+
+        soap_envelope = AXIS2_MSG_CTX_GET_SOAP_ENVELOPE(res_msg_ctx, env);
+        if (!soap_envelope)
+        {
+			return NULL;
+		}
+        soap_body = AXIS2_SOAP_ENVELOPE_GET_BODY(soap_envelope, env);
+
+        if (!soap_body)
+        {
+			return NULL;
+		}
+        
+        soap_node = AXIS2_SOAP_BODY_GET_BASE_NODE(soap_body, env);
+        if (!soap_node)
+        {
+			return NULL;
+		}
+        return AXIS2_OM_NODE_GET_FIRST_CHILD(soap_node, env);
+	}
+}
+
+
+void AXIS2_CALL 
+axis2_svc_client_send_receive_non_blocking(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_om_node_t *payload,
+                    axis2_callback_t *callback)
+{
+
+}
+
+void AXIS2_CALL 
+axis2_svc_client_send_receive_non_blocking_with_operation(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_qname_t *operation,
+                    axis2_om_node_t *payload,
+                    axis2_callback_t *callback)
+{
+
+}
+
+axis2_op_client_t* AXIS2_CALL 
+axis2_svc_client_create_client(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_qname_t *operation)
+{
+	axis2_op_t *op = NULL;
+	axis2_op_client_t *op_client = NULL;
+	axis2_svc_client_impl_t *svc_client_impl = NULL;
+
+	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+
+	op = AXIS2_SVC_GET_OP_WITH_QNAME(svc_client_impl->svc, env, operation);
+	if (!op)
+	{
+		/*TODO:error - svc does not have the operation*/
+		return NULL;
+	}
+	op_client = axis2_op_client_create(env, op, svc_client_impl->svc_ctx, 
+			svc_client_impl->options);
+	/**
+	 if overide options have been set, that means we need to make sure
+     those options override the options of even the operation client. So,
+     what we do is switch the parents around to make that work.
+	*/
+	if (!svc_client_impl->override_options)
+	{
+		AXIS2_OPTIONS_SET_PARENT(svc_client_impl->override_options, env, 
+			AXIS2_OPERATION_CLIENT_GET_OPTIONS(op_client, env));
+		AXIS2_OPERATION_CLIENT_SET_OPTIONS(op_client, env, svc_client_impl->override_options);
+	}
+
+	return op_client;	
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_finalize_invoke(struct axis2_svc_client *svc_client,
+                        axis2_env_t **env)
+{
+	axis2_svc_client_impl_t *svc_client_impl = NULL;
+	axis2_listener_manager_t *listener_manager = NULL;
+	axis2_char_t *transport = NULL;
+
+	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+
+	/*TODO:uncomment once implemented
+	listener_manager = AXIS2_CONF_CTX_GET_LISTENER_MANAGER(svc_client_impl->conf_ctx,
+			env);
+			*/
+
+	if (!listener_manager)
+	{
+		/*TODO:error - listener manager not found*/
+		return AXIS2_FAILURE;
+	}
+	/*TODO:set transport*/
+	return AXIS2_LISTENER_MANAGER_STOP(listener_manager, env, transport);
+}
+    
+axis2_endpoint_ref_t* AXIS2_CALL 
+axis2_svc_client_get_my_epr(struct axis2_svc_client *svc_client,
+                axis2_env_t **env,
+                axis2_char_t *transport)
+{
+	axis2_svc_client_impl_t *svc_client_impl = NULL;
+
+	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+	/*TODO:implement-issue - there's not get_my_epr in svc_ctx*/
+	
+	return NULL;
+}
+
+axis2_endpoint_ref_t* AXIS2_CALL 
+axis2_svc_client_get_target_epr(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env)
+{
+	axis2_svc_client_impl_t *svc_client_impl = NULL;
+
+	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+	/*TODO:implement-issue - there's not get_target_epr in svc_ctx*/
+
+	return NULL;
+}
+
+axis2_status_t AXIS2_CALL 
+axis2_svc_client_set_target_epr(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env,
+                    axis2_endpoint_ref_t *target_epr)
+{
+	axis2_svc_client_impl_t *svc_client_impl = NULL;
+
+	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+	/*TODO:implement-issue - there's not set_my_epr in svc_ctx*/
+
+	return AXIS2_FAILURE;
+}
+    
+axis2_svc_ctx_t* AXIS2_CALL 
+axis2_svc_client_get_svc_ctx(struct axis2_svc_client *svc_client,
+                    axis2_env_t **env)
+{
+	axis2_svc_client_impl_t *svc_client_impl = NULL;
+
+	AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+	svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
+
+	return svc_client_impl->svc_ctx;
+}
+
+
+
+
+/** private function implementation */
+
+static axis2_bool_t initialize_transport(axis2_env_t **env,
+                                    axis2_svc_client_impl_t *svc_client_impl,
+                                    axis2_conf_ctx_t *conf_ctx,
+									axis2_char_t *client_home)
+{
+	axis2_listener_manager_t *listener_manager = NULL;
+
+	if (conf_ctx)
+	{
+		svc_client_impl->conf_ctx = conf_ctx;
+		/*TODO:uncomment once implemented
+		listener_manager = AXIS2_CONF_CTX_GET_LISTENER_MANAGER(conf_ctx, env);
+		*/
+    	if (!listener_manager)
+    	{
+		    listener_manager = axis2_listener_manager_create(env);
+			if (!listener_manager)
+			{
+				AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        		return AXIS2_FALSE;
+			}
+			/*TODO:uncomment once implemented
+			AXIS2_LISTENER_MANAGER_INIT(listener_manager, conf_ctx);
+			*/
+    	}
+
+	}
+	else
+	{
+		svc_client_impl->conf_ctx = build_client_conf_ctx(env, client_home);
+		if (!svc_client_impl->conf_ctx)
+		{
+			AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+			return AXIS2_FALSE;
+		}
+		listener_manager = axis2_listener_manager_create(env);
+		if (!listener_manager)
+        {
+            AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+            return AXIS2_FALSE;
+        }
+		/*TODO:uncomment when implemented
+		AXIS2_LISTENER_MANAGER_INIT(listener_manager, svc_client_impl->conf_ctx);
+		*/
+	}
+	return AXIS2_TRUE;
+}
+
+static axis2_bool_t axis2_svc_client_init_data(axis2_env_t **env,
+								axis2_svc_client_impl_t *svc_client_impl)
+{
+    svc_client_impl->svc = NULL;
+
+    svc_client_impl->conf_ctx = NULL;
+
+    svc_client_impl->svc_ctx = NULL;
+
+	svc_client_impl->options = AXIS2_MALLOC((*env)->allocator, sizeof(axis2_options_t));
+    if (!svc_client_impl->options)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return AXIS2_FALSE;
+	}
+
+    svc_client_impl->override_options = NULL;
+
+    svc_client_impl->headers = NULL;
+
+    svc_client_impl->callback_recv = axis2_callback_recv_create(env);
+    if (!(svc_client_impl->callback_recv))
+    {
+        axis2_svc_client_free(&(svc_client_impl->svc_client), env);
+        return AXIS2_FALSE;
+    }
+
+	return AXIS2_TRUE;
+}
+
+static void axis2_svc_client_init_ops(axis2_svc_client_t *svc_client)
+{
+
+	svc_client->ops->get_axis_service = axis2_svc_client_get_axis_service;
+	svc_client->ops->set_options = axis2_svc_client_set_options;
+	svc_client->ops->get_options = axis2_svc_client_get_options;
+	svc_client->ops->set_override_options = axis2_svc_client_set_override_options;
+	svc_client->ops->get_override_options = axis2_svc_client_get_override_options;
+	svc_client->ops->engage_module = axis2_svc_client_engage_module;
+	svc_client->ops->disengage_module = axis2_svc_client_disengage_module;
+	svc_client->ops->add_header = axis2_svc_client_add_header;
+	svc_client->ops->remove_headers = axis2_svc_client_remove_headers;
+	svc_client->ops->add_header_with_text = axis2_svc_client_add_header_with_text;
+	svc_client->ops->send_robust = axis2_svc_client_send_robust;
+	svc_client->ops->send_robust_with_operation = axis2_svc_client_send_robust_with_operation;
+	svc_client->ops->fire_and_forget = axis2_svc_client_fire_and_forget;
+	svc_client->ops->fire_and_forget_with_operation = axis2_svc_client_fire_and_forget_with_operation;
+	svc_client->ops->send_receive = axis2_svc_client_send_receive;
+	svc_client->ops->send_receive_with_operation = axis2_svc_client_send_receive_with_operation;
+	svc_client->ops->send_receive_non_blocking = axis2_svc_client_send_receive_non_blocking;
+	svc_client->ops->send_receive_non_blocking_with_operation = axis2_svc_client_send_receive_non_blocking_with_operation;
+	svc_client->ops->create_client = axis2_svc_client_create_client;
+	svc_client->ops->finalize_invoke = axis2_svc_client_finalize_invoke;
+	svc_client->ops->get_my_epr = axis2_svc_client_get_my_epr;
+	svc_client->ops->get_target_epr = axis2_svc_client_get_target_epr;
+	svc_client->ops->set_target_epr = axis2_svc_client_set_target_epr;
+	svc_client->ops->get_svc_ctx = axis2_svc_client_get_svc_ctx;
+}
+
+/**
+  * Create an anonymous axisService with one (anonymous) operation each for
+  * each MEP that I support dealing with anonymously using the convenience
+  * APIs.
+  *
+  * @return the minted anonymous service
+  */
+
+static axis2_svc_t* axis2_create_annonymous_svc(axis2_env_t **env)
+{
+	/**
+	now add anonymous operations to the axis2 service for use with the
+    shortcut client API. NOTE: We only add the ones we know we'll use
+    later in the convenience API; if you use
+    this constructor then you can't expect any magic!
+	*/
+	axis2_qname_t *tmp_qname;
+	axis2_svc_t *svc;
+	axis2_op_t *op_out_in, *op_out_only, *op_robust_out_only;
+
+	tmp_qname = axis2_qname_create(env, AXIS2_ANON_SERVICE, NULL, NULL);
+	
+	if (!tmp_qname)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+		return NULL;
+	}
+
+	svc = axis2_svc_create_with_qname(env, tmp_qname);	
+	
+	if (!svc)
+	{
+		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+		return NULL;
+	}
+	AXIS2_QNAME_FREE(tmp_qname, env);
+
+	tmp_qname = axis2_qname_create(env, AXIS2_ANON_OUT_IN_OP, NULL, NULL);
+
+    if (!tmp_qname)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+	op_out_in = axis2_op_create_with_qname(env, tmp_qname);
+	AXIS2_QNAME_FREE(tmp_qname, env);
+
+			
+	tmp_qname = axis2_qname_create(env, AXIS2_ANON_OUT_ONLY_OP, NULL, NULL);
+
+    if (!tmp_qname)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+	op_out_only = axis2_op_create_with_qname(env, tmp_qname);
+	AXIS2_QNAME_FREE(tmp_qname, env);
+
+	tmp_qname = axis2_qname_create(env, AXIS2_ANON_ROBUST_OUT_ONLY_OP, NULL, NULL);
+
+    if (!tmp_qname)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+	op_robust_out_only = axis2_op_create_with_qname(env, tmp_qname);
+	AXIS2_QNAME_FREE(tmp_qname, env);
+
+	if (!op_out_in || !op_out_only || !op_robust_out_only)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+		if (op_out_in)
+		{
+			AXIS2_OP_FREE(op_out_in, env);
+		}
+		if (op_out_only)
+		{
+			AXIS2_OP_FREE(op_out_only, env);
+		}
+		if (op_robust_out_only)
+		{
+			AXIS2_OP_FREE(op_robust_out_only, env);
+		}
+
+        return NULL;
+    }
+
+	AXIS2_OP_SET_MSG_EXCHANGE_PATTERN(op_out_in, env, AXIS2_MEP_URI_OUT_IN);
+	AXIS2_OP_SET_MSG_EXCHANGE_PATTERN(op_out_only, env, AXIS2_MEP_URI_OUT_ONLY);
+	AXIS2_OP_SET_MSG_EXCHANGE_PATTERN(op_robust_out_only, env, AXIS2_MEP_URI_ROBUST_OUT_ONLY);
+	
+	AXIS2_SVC_ADD_OP(svc, env, op_out_in);
+	AXIS2_SVC_ADD_OP(svc, env, op_out_only);
+	AXIS2_SVC_ADD_OP(svc, env, op_robust_out_only);
+	return svc;	
+}
+
+static axis2_bool_t fill_soap_envelope(axis2_env_t **env, axis2_svc_client_impl_t *svc_client_impl,
+								axis2_msg_ctx_t *msg_ctx, axis2_om_node_t *payload)
+{
+	axis2_char_t *soap_version_uri;
+	int soap_version;
+	axis2_soap_envelope_t *envelope = NULL;
+
+	soap_version_uri = AXIS2_OPTIONS_GET_SOAP_VERSION_URI(svc_client_impl->options, env);
+
+    if (soap_version_uri)
+    {
+		return AXIS2_FALSE;
+	}
+
+    if (AXIS2_STRCMP(soap_version_uri,
+                AXIS2_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI) == 0)
+    	soap_version = AXIS2_SOAP11;
+    else
+    	soap_version = AXIS2_SOAP12;
+    
+
+    envelope = axis2_soap_envelope_create_default_soap_envelope(env, soap_version);
+    if (!envelope)
+    {
+        return AXIS2_FALSE;
+    }
+
+    if (payload)
+    {
+        axis2_soap_body_t *soap_body = NULL;
+        soap_body = AXIS2_SOAP_ENVELOPE_GET_BODY(envelope, env);
+        if (soap_body)
+        {
+            axis2_om_node_t *node = NULL;
+            node = AXIS2_SOAP_BODY_GET_BASE_NODE(soap_body, env);
+            if (node)
+            {
+                AXIS2_OM_NODE_ADD_CHILD(node, env, payload);
+            }
+        }
+    }
+
+    AXIS2_MSG_CTX_SET_SOAP_ENVELOPE(msg_ctx, env, envelope);
+	return AXIS2_TRUE;
+}
+