[wsf-c-dev] svn commit r413 - wsf/c/wsclient/src

svn at wso2.com svn at wso2.com
Fri Jan 12 05:53:22 PST 2007


Author: dinesh
Date: Fri Jan 12 05:53:12 2007
New Revision: 413

Modified:
   wsf/c/wsclient/src/wsclient.c
   wsf/c/wsclient/src/wsclient_stub.c
Log:
logging added

Modified: wsf/c/wsclient/src/wsclient.c
==============================================================================
--- wsf/c/wsclient/src/wsclient.c	(original)
+++ wsf/c/wsclient/src/wsclient.c	Fri Jan 12 05:53:12 2007
@@ -28,17 +28,22 @@
 	axis2_array_list_t *array_list;
 	axis2_status_t status;
 	env = axis2_env_create_all ("wsclient.log", AXIS2_LOG_LEVEL_INFO);
+	AXIS2_LOG_INFO(env->log, "[wsclient]wsclient initiated ");
+
 	if (argc > 1)
 	{
 	    if (!strcmp (argv[1], "-h") || !strcmp (argv[1], "--help"))
 			print_help ();
 		else if (!strcmp (argv[1], "-v") || !strcmp (argv[1], "--version"))
 			print_version ();
-
+		AXIS2_LOG_INFO(env->log, "[wsclient]waiting for input  ");
 	    parse_input (env, input);
 	    dest_uri = wsclient_destination (argc, argv);
+		AXIS2_LOG_INFO(env->log, "[wsclient]sending request to  %s", dest_uri);
 	    array_list = wsclient_process_options (argc, argv, env);
+		AXIS2_LOG_INFO(env->log, "[wsclient]invoking wsclient stub  ");
 	    status = wsclient_stub_invoke (env, array_list, dest_uri, *input);
+		AXIS2_LOG_INFO(env->log, "[wsclient]wsclient successfully invoked ");
 	    if (status == WSCLIENT_ERROR_NO_DESTURI)
 	    {
 			printf ("please enter valid destURI \n");

Modified: wsf/c/wsclient/src/wsclient_stub.c
==============================================================================
--- wsf/c/wsclient/src/wsclient_stub.c	(original)
+++ wsf/c/wsclient/src/wsclient_stub.c	Fri Jan 12 05:53:12 2007
@@ -137,6 +137,7 @@
 						is_soap_enabled = 0;
 						is_wsa_enabled = 0;
 						is_mtom_enabled = 0;
+						AXIS2_LOG_INFO(env->log, "[wsclient] processed get option ");
 					}
 					break;
 					case CONTENT_TYPE:
@@ -146,6 +147,7 @@
 						{			      
 							content_type = (char *)wsclient_options->value;
 						}
+						AXIS2_LOG_INFO(env->log, "[wsclient] processed content type ");
 					}
 					break;
 					case SOAP:
@@ -153,12 +155,14 @@
 						is_soap_enabled = 1;
 						/* Set the default soap version of 1.2 */
 						AXIS2_OPTIONS_SET_SOAP_VERSION(options, env, AXIOM_SOAP12);
+						AXIS2_LOG_INFO(env->log, "[wsclient] soap 1.2 selected");
 					}
 					break;
 					case SOAP_OLD:
 					{
 						is_soap_enabled = 1;
 						AXIS2_OPTIONS_SET_SOAP_VERSION(options, env, AXIOM_SOAP11);
+						AXIS2_LOG_INFO(env->log, "[wsclient] soap 1.1 selected");
 					}
 					break;
 					case SOAP_DUMP:
@@ -168,6 +172,7 @@
 						{
 							is_soap_enabled = 1;
 						}
+						AXIS2_LOG_INFO(env->log, "[wsclient] soap dumping  ");
 					}
 					break;
 					case SOAP_OUT:
@@ -179,6 +184,7 @@
 							AXIS2_OPTIONS_SET_SOAP_VERSION(
 								options, env, AXIOM_SOAP12);
 						} 
+						AXIS2_LOG_INFO(env->log, "[wsclient] soap out block");
 					}
 					break;
 					case ACTION:
@@ -192,17 +198,19 @@
 								env, 
 								(char *)wsclient_options->value);
 						}
-
+						AXIS2_LOG_INFO(env->log, "[wsclient] wsa action block %a", (char *)wsclient_options->value);
 					}
 					break;
 					case SEND_ONLY:
 					{
 						is_send_only = 1;
+						AXIS2_LOG_INFO(env->log, "[wsclient] send only block ");
 					}
 					break;
 					case NO_WSA:
 					{
 						is_wsa_enabled = 0;
+						AXIS2_LOG_INFO(env->log, "[wsclient] addressing disabled ");
 					}
 					break;
 					case TO:
@@ -213,6 +221,7 @@
 							to = axis2_endpoint_ref_create(env, 
 														   (char *)wsclient_options->value);
 						}
+						AXIS2_LOG_INFO(env->log, "[wsclient] wsa to  %s ", (char *)wsclient_options->value);
 					}
 					break;
 					case FROM:
@@ -223,6 +232,7 @@
 							from = axis2_endpoint_ref_create(env, 
 															 (char *)wsclient_options->value);
 						}
+						AXIS2_LOG_INFO(env->log, "[wsclient] wsa from  %s ", (char *)wsclient_options->value);
 					}
 					break;
 					case REPLY_TO:
@@ -233,6 +243,7 @@
 							reply_to = axis2_endpoint_ref_create(env, 
 																 (char *)wsclient_options->value);
 						}
+						AXIS2_LOG_INFO(env->log, "[wsclient] wsa reply to  %s ", (char *)wsclient_options->value);
 					}
 					break;
 					case IN_REPLY_TO:
@@ -243,6 +254,7 @@
 							relates_to = axis2_relates_to_create (env, (char *)wsclient_options->value,
 																  "http://www.w3.org/2005/08/addressing/reply");
 						}
+						AXIS2_LOG_INFO(env->log, "[wsclient] wsa in-reply-to  %s ", (char *)wsclient_options->value);
 					}
 					break;
 					case FAULT_TO:
@@ -253,11 +265,13 @@
 							fault_to = axis2_endpoint_ref_create (env, 
 																  (char *)wsclient_options->value);
 						}
+						AXIS2_LOG_INFO(env->log, "[wsclient] wsa fault-to  %s ", (char *)wsclient_options->value);
 					}
 					break;
 					case NO_MTOM:
 					{
 						is_mtom_enabled = 0;
+						AXIS2_LOG_INFO(env->log, "[wsclient] mtom disabled  ");
 					}
 					break;
 					case USER:
@@ -268,6 +282,7 @@
 						username_value = (char *)wsclient_options->value;
 						AXIS2_PROPERTY_SET_VALUE (username, env, AXIS2_STRDUP ((char *)wsclient_options->value, env));
 						AXIS2_OPTIONS_SET_PROPERTY (options, env, RAMPART_ACTION_USER, username);
+						AXIS2_LOG_INFO(env->log, "[wsclient] security user block ");
 					}
 					break;
 					case PASSWORD:
@@ -277,11 +292,13 @@
 						password = axis2_property_create (env);
 						AXIS2_PROPERTY_SET_VALUE (password, env, AXIS2_STRDUP ((char *)wsclient_options->value, env));
 						AXIS2_OPTIONS_SET_PROPERTY (options, env, RAMPART_ACTION_PASSWORD, password);
+						AXIS2_LOG_INFO(env->log, "[wsclient] security password block ");
 					}
 					break;
 					case TIMESTAMP:
 					{
 						is_user_tok_timestamp = 1;
+						AXIS2_LOG_INFO(env->log, "[wsclient] security timestamp block ");
 					}
 					break;
 					case PASSWORD_FILE:
@@ -290,11 +307,13 @@
 						is_password = 1;
 						is_soap_enabled = 1;
 						password_file = (char *) wsclient_options->value;
+						AXIS2_LOG_INFO(env->log, "[wsclient] security password file ");
 					}
 					break;
 					case DIGEST:
 					{
 						is_digest = 1;
+						AXIS2_LOG_INFO(env->log, "[wsclient] security digest block ");
 					}
 					break;
 					case XOP_IN:
@@ -303,12 +322,14 @@
 						is_xop_in = 1;
 						dir = (axis2_char_t *)wsclient_options->value;
 						wsclient_set_attachment (env, payload, dir, is_mtom_enabled);
+						AXIS2_LOG_INFO(env->log, "[wsclient] xop in block");
 					}
 					break;
 					case XOP_OUT:
 					{
 						is_xop_out = 1;
 						xop_out_dir = (axis2_char_t *)wsclient_options->value;
+						AXIS2_LOG_INFO(env->log, "[wsclient] xop out block");
 					}
 					break;
 					case HTTP_HEADER:
@@ -328,12 +349,14 @@
 							AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_TRANSPORT_HEADER_PROPERTY,
 													   header_property);
 						}
+						AXIS2_LOG_INFO(env->log, "[wsclient] add http header");
 					}
 					break;
 					case OUTPUT_HTTP_HEADERS:
 					{
 						is_output_http_headers = 1;
 						output_filename = (char *) wsclient_options->value;
+						AXIS2_LOG_INFO(env->log, "[wsclient] output http header %s", (char *) wsclient_options->value);
 					}
 					break;
 					case SERVER_CERT:
@@ -348,6 +371,7 @@
 							AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_SSL_SERVER_CERT,
 													   server_cert_property);
 						}
+						AXIS2_LOG_INFO(env->log, "[wsclient] server certificate path  %s", (char *) wsclient_options->value);
 					}
 					break;
 				};
@@ -357,6 +381,7 @@
 
 	if (!is_soap_enabled)
 	{
+		AXIS2_LOG_INFO(env->log, "[wsclient] soap not enabled");
 		is_wsa_enabled = 0;
  		is_mtom_enabled = 0;
 
@@ -372,6 +397,7 @@
 									 axis2_strdup(AXIS2_HTTP_HEADER_GET, env));
 			AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_HTTP_METHOD,
 									   get_property);
+		AXIS2_LOG_INFO(env->log, "[wsclient] set get property ");
 		}
 
 		if (is_contenty_type)
@@ -392,13 +418,16 @@
 /* 			AXIS2_PROPERTY_SET_FREE_FUNC (property, env, axis2_hash_free); */
 			AXIS2_OPTIONS_SET_PROPERTY(options, env, AXIS2_USER_DEFINED_HTTP_HEADER_CONTENT_TYPE,
 									   content_type_property);
+			AXIS2_LOG_INFO(env->log, "[wsclient] set contenty type");
 		}
 	}
 
 	if (is_wsa_enabled)
 	{
+		AXIS2_LOG_INFO(env->log, "[wsclient] addressing  enabled");
 	    if (is_send_only)
 	    {
+			AXIS2_LOG_INFO(env->log, "[wsclient] addressing  enabled sendonly ");
 			if(!is_reply_to)
 			{
 				reply_to = axis2_endpoint_ref_create(env,
@@ -409,6 +438,7 @@
 
 	    if (is_to)
 	    {
+			AXIS2_LOG_INFO(env->log, "[wsclient] adding \"to\" to options");
 			if (to)
 			{
 				AXIS2_OPTIONS_SET_TO(options, env, to);
@@ -417,6 +447,7 @@
 	    
 	    if (is_from)
 	    {
+			AXIS2_LOG_INFO(env->log, "[wsclient] adding from to options");
 			if (from)
 			{
 				AXIS2_OPTIONS_SET_FROM (options, env, from);
@@ -425,6 +456,7 @@
 
 	    if (is_reply_to)
 	    {
+			AXIS2_LOG_INFO(env->log, "[wsclient] adding reply-to to options");
 			if (reply_to)
 			{
 				AXIS2_OPTIONS_SET_REPLY_TO (options, env, reply_to);
@@ -433,6 +465,7 @@
 
 	    if (is_in_reply_to)
 	    {
+			AXIS2_LOG_INFO(env->log, "[wsclient] adding in-reply-to to options");
 			if (in_reply_to)
 			{
 			
@@ -442,6 +475,7 @@
 
 	    if (is_fault_to)
 	    {
+			AXIS2_LOG_INFO(env->log, "[wsclient] adding fault-to to options");
 			if (fault_to)
 			{
 				AXIS2_OPTIONS_SET_FAULT_TO (options, env, fault_to);
@@ -451,6 +485,7 @@
 
 	if (is_soap_dump)
 	{
+		AXIS2_LOG_INFO(env->log, "[wsclient] setting soap-dump property to options");
 	    dump_property = axis2_property_create (env);
 	    AXIS2_PROPERTY_SET_VALUE (dump_property,
 								  env,
@@ -462,6 +497,7 @@
 	{
 		if (is_password_file)
 		{
+			AXIS2_LOG_INFO(env->log, "[wsclient] processing password file");
 			if (username_value)
 			{
 				password_buffer = wsclient_get_password (env, username_value, password_file);
@@ -478,6 +514,7 @@
 
 		if (is_digest)
 		{
+			AXIS2_LOG_INFO(env->log, "[wsclient] adding digest password property");
 			pw_type = axis2_property_create(env);
 			AXIS2_PROPERTY_SET_VALUE(pw_type, env, AXIS2_STRDUP (RAMPART_PASSWORD_DIGEST, env));
 			AXIS2_OPTIONS_SET_PROPERTY(options, env, RAMPART_ACTION_PASSWORD_TYPE, pw_type);
@@ -485,6 +522,7 @@
 	    }
 	    else 
 	    {
+			AXIS2_LOG_INFO(env->log, "[wsclient] adding plain text password property");
 			pw_type = axis2_property_create(env);
 			AXIS2_PROPERTY_SET_VALUE(pw_type, env, AXIS2_STRDUP (RAMPART_PASSWORD_TEXT, env));
 			AXIS2_OPTIONS_SET_PROPERTY(options, env, RAMPART_ACTION_PASSWORD_TYPE, pw_type);
@@ -493,12 +531,14 @@
 
 	    if (is_user_tok_timestamp)
 	    {
+			AXIS2_LOG_INFO(env->log, "[wsclient] username token timestamp ");
 			items = axis2_property_create(env);
 			AXIS2_PROPERTY_SET_VALUE(items, env, AXIS2_STRDUP ("UsernameToken Timestamp", env));
 			AXIS2_OPTIONS_SET_PROPERTY(options, env, RAMPART_ACTION_ITEMS, items);
 	    }
 	    else
 	    {
+			AXIS2_LOG_INFO(env->log, "[wsclient] username token");
 			items = axis2_property_create(env);
 			AXIS2_PROPERTY_SET_VALUE(items, env, AXIS2_STRDUP ("UsernameToken", env));
 			AXIS2_OPTIONS_SET_PROPERTY(options, env, RAMPART_ACTION_ITEMS, items);
@@ -516,6 +556,7 @@
 	axis2_char_t *dest_uri,
 	axis2_char_t *input)
 {
+	AXIS2_LOG_INFO(env->log, "[wsclient] wsclient invoking ");
 	const axis2_char_t *address = NULL;
 	axis2_endpoint_ref_t* endpoint_ref = NULL;
 	axis2_options_t *options = NULL;
@@ -524,11 +565,14 @@
 	axiom_node_t *payload = NULL;
 	axiom_node_t *ret_node = NULL;
 
+	AXIS2_LOG_INFO(env->log, "[wsclient] payload %s \n", input);
 	payload = wsclient_payload (env, input);
+
 	client_home = AXIS2_GETENV("AXIS2C_HOME");
 	if (!client_home)
-	    client_home = "/home/dinesh/tmp/deploy";
+	    client_home = "../";
 
+	AXIS2_LOG_INFO(env->log, "[wsclient] AXIS2C_HOME %s", client_home);
 
 	if (dest_uri)
 	{
@@ -536,6 +580,7 @@
 	}
 	else
 	{
+		AXIS2_LOG_INFO(env->log, "[wsclient] destination uri not available");
 	    return WSCLIENT_ERROR_NO_DESTURI;
 	}
 
@@ -545,6 +590,8 @@
 	    return WSCLIENT_FALIURE;
 
 	svc_client = axis2_svc_client_create (env, client_home);
+	AXIS2_LOG_INFO(env->log, "[wsclient] svc client created");
+
 	if (!svc_client)
 	{
 	    AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Stub invoke FAILED: Error code:"
@@ -553,8 +600,8 @@
 	    return -1 /* WSCLIENT_ERROR_SENDING_MSG */;
 	}
 
-
 	options = wsclient_svc_option (env, array_list, payload);
+	AXIS2_LOG_INFO(env->log, "[wsclient] svc client created");
 
 	if (endpoint_ref)
 	    AXIS2_OPTIONS_SET_TO(options, env, endpoint_ref);
@@ -568,15 +615,20 @@
 			if (!is_action)
 				AXIS2_OPTIONS_SET_ACTION (options, env, "http://ws.apache.org/axis2/c");
 			AXIS2_SVC_CLIENT_ENGAGE_MODULE(svc_client, env, AXIS2_MODULE_ADDRESSING);
+			AXIS2_LOG_INFO(env->log, "[wsclient] addressing module engaged");
 		}
 
 		if (is_username && is_password)
 		{
 			AXIS2_SVC_CLIENT_ENGAGE_MODULE (svc_client, env, "rampart");
+			AXIS2_LOG_INFO(env->log, "[wsclient] rampart module engaged");
 		}
 
 		if (is_mtom_enabled)
+		{
 			AXIS2_OPTIONS_SET_ENABLE_MTOM (options, env, AXIS2_TRUE);
+			AXIS2_LOG_INFO(env->log, "[wsclient] mtom option enabled");
+		}
 	}
 
 
@@ -592,9 +644,11 @@
 			printf ("Sending request to: %s \n", dest_uri);
 
 #ifdef AXIS2_SSL_ENABLED
+		AXIS2_LOG_INFO(env->log, "[wsclient] compiled with ssl enabled");
 		if (strstr (dest_uri, "https"))
 			wsclient_set_https_transport_parameretes (env, svc_client);
 #endif
+		AXIS2_LOG_INFO(env->log, "[wsclient] prepareing for svc client send receive ");
 	    ret_node = AXIS2_SVC_CLIENT_SEND_RECEIVE(svc_client, env, payload);
 
 		if (is_soap_dump)
@@ -605,6 +659,7 @@
 
 	if (ret_node)
 	{
+		AXIS2_LOG_INFO(env->log, "[wsclient] response return node found");
 	    axis2_char_t *om_str = NULL;
 	    if(is_send_only)
 	    {
@@ -629,6 +684,7 @@
 		{
 			wsclient_get_attachment (env, ret_node, xop_out_dir, is_mtom_enabled);
 			wsclient_soap_out (env, svc_client, 1);
+			AXIS2_LOG_INFO(env->log, "[wsclient] invoke SUCCESSFUL");
 			printf("\nwsclient invoke SUCCESSFUL!\n");
 		}
 		else if (is_soap_out)
@@ -640,13 +696,15 @@
 			om_str = AXIOM_NODE_TO_STRING(ret_node, env);
 			if (om_str)
 				printf("\nReceived OM : %s\n", om_str);
+			AXIS2_LOG_INFO(env->log, "[wsclient] invoke SUCCESSFUL");
 			printf("\nwsclient invoke SUCCESSFUL!\n");
 			ret_node = NULL;
 	    }
 	}
 	else 
 	{
-	printf("\nwsclient invoke Failed!\n");
+			AXIS2_LOG_INFO(env->log, "[wsclient] invoke Failed");
+			printf("\nwsclient invoke Failed!\n");
 	}
 	if (password_buffer)
 	    AXIS2_FREE (env->allocator, password_buffer);




More information about the Wsf-c-dev mailing list