[wsf-c-dev] svn commit r384 - wsf/php/src

svn at wso2.com svn at wso2.com
Wed Jan 10 01:27:39 PST 2007


Author: buddhika
Date: Wed Jan 10 01:26:59 2007
New Revision: 384

Modified:
   wsf/php/src/wsf.c
Log:
 Modifing for WSDL Generation


Modified: wsf/php/src/wsf.c
==============================================================================
--- wsf/php/src/wsf.c	(original)
+++ wsf/php/src/wsf.c	Wed Jan 10 01:26:59 2007
@@ -1844,15 +1844,15 @@
 		req_info->req_data_length = Z_STRLEN_PP(raw_post);
 	}
 
-    if(SG(request_info).query_string && ((stricmp(SG(request_info).query_string, "wsdl") == 0) ||
-        (stricmp(SG(request_info).query_string, "WSDL") == 0))){        
+    if(SG(request_info).query_string && ((stricmp(SG(request_info).query_string, "wsdl") == 0) || 
+	(stricmp(SG(request_info).query_string, "wsdl2") == 0 ))){        
         /** the request is for wsdl */
 		char *service_name = NULL;
 		char *str1, *token, saveptr1;
 		const char *del[2];
 		int j = 0;
-		zval func, retval, param1, param2, param3, param4;
-		zval *params[4];
+		zval func, retval, param1, param2, param3, param4, param5;
+		zval *params[5];
 		axis2_hash_index_t *hi = NULL;
 		zval *f_val;
 		zend_file_handle script;
@@ -1863,7 +1863,7 @@
 		int len = 0;
 		zval **tmpval;
 		char *binding_name = NULL;
-
+		char *wsdl_version = NULL;
 		/** wsdl generation stuff */
 
 		location = VCWD_GETCWD(resolved_path, MAXPATHLEN);
@@ -1873,7 +1873,14 @@
 		params[1] = &param2;
 		params[2] = &param3;
 		params[3] = &param4;
+		params[4] = &param5;
 
+		/** for Wsdl version. default is wsdl 1.1*/
+		if((stricmp(SG(request_info).query_string, "wsdl")) == 0 )
+		    wsdl_version = estrdup("wsdl1.1");
+		else
+		    wsdl_version = estrdup("wsdl2.0");
+		
 		/** getting the correct binding style */
 		if ((zend_hash_find(Z_OBJPROP_P(obj), "bindingStyle", sizeof("bindingStyle"),
 				    (void**)&tmpval)) == SUCCESS && Z_TYPE_PP(tmpval) == IS_STRING)
@@ -1881,6 +1888,11 @@
 		   binding_name = Z_STRVAL_PP(tmpval);
 	
 		}
+
+		else
+		{
+		    binding_name = estrdup("doc-lit");
+		}
 		
 		/** finding the the functions in the service.php file */
 		MAKE_STD_ZVAL(f_val);
@@ -1906,14 +1918,15 @@
 		   }
 		}
 		ZVAL_STRING(&func, "ws_generate_wsdl", 0);
-		ZVAL_STRING(params[0], "wsdlgen/WS_WsdlCreater.php", 0); 	
+		ZVAL_STRING(params[0], "scripts/WS_WsdlCreater.php", 0); 	
 		ZVAL_STRING(params[1], service_name, 0);
 		ZVAL_ZVAL(params[2], f_val, NULL, NULL);
 		INIT_PZVAL(params[2]);
 		ZVAL_STRING(params[3], binding_name, 0);
+		ZVAL_STRING(params[4], wsdl_version, 0);
 
 		script.type = ZEND_HANDLE_FP;
-		script.filename = "wsdlgen/WS_WsdlScript.php";
+		script.filename = "scripts/WS_WsdlScript.php";
 		script.opened_path = NULL;
 		script.free_filename = 0;
 
@@ -1928,13 +1941,14 @@
 			if (call_user_function(CG(function_table), (zval**)NULL,
 	       				   &func, &retval, 4, params TSRMLS_CC ) == SUCCESS)
 			{
-			if (Z_TYPE_P(&retval) == IS_STRING && Z_TYPE_P(&retval) != IS_NULL)
-			{
-			    val = estrdup(Z_STRVAL(retval));
-			    len = Z_STRLEN(retval);
-			   /*  php_printf("Wsdl is created in the location tmp/test.wsdl"); */
-			}
-				else
+			    if (Z_TYPE_P(&retval) == IS_STRING && Z_TYPE_P(&retval) != IS_NULL)
+			    {
+				val = estrdup(Z_STRVAL(retval));
+				len = Z_STRLEN(retval);
+				php_printf("%s", val);
+			    }
+			    
+			    else
 				php_printf("A problem occured");
 			}
 			




More information about the Wsf-c-dev mailing list