[wsf-c-dev] svn commit r721 - in wsf/php/src: . scripts

svn at wso2.com svn at wso2.com
Mon Feb 5 01:42:28 PST 2007


Author: buddhika
Date: Mon Feb  5 01:41:52 2007
New Revision: 721

Modified:
   wsf/php/src/scripts/WS_WsdlBinding.php
   wsf/php/src/scripts/WS_WsdlConsts.php
   wsf/php/src/scripts/WS_WsdlCreator.php
   wsf/php/src/scripts/WS_WsdlScript.php
   wsf/php/src/scripts/WS_WsdlService.php
   wsf/php/src/wsf.c
Log:
removing the hardcoded soap action in wsdl


Modified: wsf/php/src/scripts/WS_WsdlBinding.php
==============================================================================
--- wsf/php/src/scripts/WS_WsdlBinding.php	(original)
+++ wsf/php/src/scripts/WS_WsdlBinding.php	Mon Feb  5 01:41:52 2007
@@ -25,11 +25,13 @@
 
        private $svr_name;
        public  $operations;
-       //function __construct($service_name, $operations)
-       function __construct($service_name, $operations = false)
+       private $wsdl_location;
+
+       function __construct($service_name, $wsdl_ep, $operations = false)
        {
 	   $this->svr_name = $service_name;
 	   $this->operations = $operations;
+	   $this->wsdl_location = $wsdl_ep;
        }
 
 
@@ -57,7 +59,8 @@
 	      $action_ele = $binding_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_SOAP_NAMESPACE,
 							  WS_WsdlConst::WS_WSDL_OPERATION_ATTR_NAME);
 	      $action_ele->setAttribute(WS_WsdlConst::WS_WSDL_SOAP_ACTION_ATTR_NAME,
-					"http://localhost/wsdlgen");
+					WS_WsdlConst::WS_WSDL_HTTP_ATTR_NAME.$this->wsdl_location.
+					"/".$name);
 	      $action_ele->setAttribute(WS_WsdlConst::WS_WSDL_STYLE_ATTR_NAME,
 					WS_WsdlConst::WS_WSDL_DOCUMENT_ATTR_NAME);
 	      $op->appendChild($action_ele);

Modified: wsf/php/src/scripts/WS_WsdlConsts.php
==============================================================================
--- wsf/php/src/scripts/WS_WsdlConsts.php	(original)
+++ wsf/php/src/scripts/WS_WsdlConsts.php	Mon Feb  5 01:41:52 2007
@@ -97,7 +97,7 @@
     //const WS_WSDL_BINDING_VERSION_ATTR_VAL = "1.2";
     const WS_WSDL_SOAP_ATTR_NAME = "soap";
     
-    
+    const WS_WSDL_HTTP_ATTR_NAME = "http://";
     const WS_WSDL_PORTTYPE_ATTR_NAME ='portType';
       
     const WS_WSDL_PATTERN_ATTR_NAME = "pattern";

Modified: wsf/php/src/scripts/WS_WsdlCreator.php
==============================================================================
--- wsf/php/src/scripts/WS_WsdlCreator.php	(original)
+++ wsf/php/src/scripts/WS_WsdlCreator.php	Mon Feb  5 01:41:52 2007
@@ -121,13 +121,13 @@
 
 	      if ($this->Binding_style == "doc-lit")
 	      {
-		  $bind_obj = new WS_WsdlBinding($this->service_name, $operationsArry);
+		  $bind_obj = new WS_WsdlBinding($this->service_name, $this->endpoint,  $operationsArry);
 		  $bind_obj->createDocLitBinding($wsdl_dom, $wsdl_root_ele);
 	      }
 	      
 	      if ($this->Binding_style == "rpc")
 	      {
-		$bind_obj = new WS_WsdlBinding($this->service_name, $operationsArry);
+		$bind_obj = new WS_WsdlBinding($this->service_name, $this->endpoint,  $operationsArry);
 		$bind_obj->createRPCBinding($wsdl_dom, $wsdl_root_ele);
 	       
 	      }
@@ -138,10 +138,6 @@
 	      
 	      
 	      $wsdl_dom->appendChild($wsdl_root_ele);
-	      // if ($this->Binding_style == "doc-lt")
-// 		  $wsdl_dom->save("/tmp/doc-lit.wsdl");
-// 	      if ($this->Binding_style == "rpc")
-// 		  $wsdl_dom->save("/tmp/rpc.wsdl");
 	      return $wsdl_dom->saveXML();
 	      
 	 }

Modified: wsf/php/src/scripts/WS_WsdlScript.php
==============================================================================
--- wsf/php/src/scripts/WS_WsdlScript.php	(original)
+++ wsf/php/src/scripts/WS_WsdlScript.php	Mon Feb  5 01:41:52 2007
@@ -17,7 +17,8 @@
  */
 
 
-function ws_generate_wsdl($include_location, $service_name, $fn_arry, $binding_style, $wsdl_version)
+function ws_generate_wsdl($include_location, $service_name, $fn_arry,
+			  $binding_style, $wsdl_version, $request_uri)
 {
     include $include_location;
     
@@ -43,9 +44,8 @@
 	exit(0);
     }
 
-
     
-    $wsdl = new WS_WsdlCreator($fn_arry ,$service_name, 'http://localhost/Wso2/Wsdl_gen.php', $Binding_style, 'http://www.wso2.org/php/', $wsdl_version);
+    $wsdl = new WS_WsdlCreator($fn_arry ,$service_name, $request_uri, $Binding_style, 'http://www.wso2.org/php/', $wsdl_version);
     $wsdl_out = $wsdl->WS_WsdlOut();
 
 

Modified: wsf/php/src/scripts/WS_WsdlService.php
==============================================================================
--- wsf/php/src/scripts/WS_WsdlService.php	(original)
+++ wsf/php/src/scripts/WS_WsdlService.php	Mon Feb  5 01:41:52 2007
@@ -45,11 +45,12 @@
 						  WS_WsdlConst::WS_WSDL_PORT_ATTR_NAME);
 	    $svr_port->setAttribute(WS_WsdlConst::WS_WSDL_NAME_ATTR_NAME, $this->S_name);
 	    $svr_port->setAttribute(WS_WsdlConst::WS_WSDL_BINDING_ATTR_NAME,
-				    "tns".$this->S_name);
+				    $this->S_name);
 	    
 	    $svr_addr = $svr_dom->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
 						  WS_WsdlConst::WS_WSDL_ADDRESS_ATTR_NAME);
-	    $svr_addr->setAttribute(WS_WsdlConst::WS_WSDL_LOCATION_ATTR_NAME, $this->endpoint);
+	    $svr_addr->setAttribute(WS_WsdlConst::WS_WSDL_LOCATION_ATTR_NAME, 
+				    WS_WsdlConst::WS_WSDL_HTTP_ATTR_NAME.$this->endpoint);
 	    
 	    $svr_ele->appendChild($svr_port);
 	    $svr_ele->appendChild($svr_addr);

Modified: wsf/php/src/wsf.c
==============================================================================
--- wsf/php/src/wsf.c	(original)
+++ wsf/php/src/wsf.c	Mon Feb  5 01:41:52 2007
@@ -390,7 +390,6 @@
 	wsf_globals->enable_exception = 0;
 	wsf_globals->soap_version = AXIOM_SOAP12;
 	wsf_globals->passwd_location = NULL;
-	wsf_globals->soap_uri = WS_SOAP_1_2_NAMESPACE_URI;
 	
 }
 /* }}} */
@@ -692,7 +691,7 @@
 			}else if(Z_TYPE_PP(tmp) == IS_STRING){
 				add_property_stringl(object, "reliable", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
 			}else if(Z_TYPE_PP(tmp) == IS_LONG){
-				add_property_long(object, "reliable", Z_LVAL_PP(tmp));
+				add_property_long(object, "reliable", Z_TYPE_PP(tmp));
 			}
 		}
 
@@ -1581,8 +1580,8 @@
 	(stricmp(SG(request_info).query_string, "wsdl2") == 0 ))){        
       
 		char *service_name = NULL;
-		zval func, retval, param1, param2, param3, param4, param5;
-		zval *params[5];
+		zval func, retval, param1, param2, param3, param4, param5, param6;
+		zval *params[6];
 		axis2_hash_index_t *hi = NULL;
 		zval *f_val;
 		zend_file_handle script;
@@ -1592,15 +1591,19 @@
 		char *binding_name = NULL;
 		char *wsdl_version = NULL;
 		char *cwd = emalloc(100);
+		char *full_path = emalloc(100);
 
+		/* 	full_path = SG(request_info).http */
 		service_name = svc_info->svc_name;
-	
+		strcpy(full_path, req_info->svr_name);
+		strcat(full_path, req_info->request_uri);
+		
 		params[0] = &param1;
 		params[1] = &param2;
 		params[2] = &param3;
 		params[3] = &param4;
 		params[4] = &param5;
-
+		params[5] = &param6;
 		/** for Wsdl version. default is wsdl 1.1*/
 		if((stricmp(SG(request_info).query_string, "wsdl")) == 0 )
 		    wsdl_version = strdup("wsdl1.1");
@@ -1650,6 +1653,7 @@
 		INIT_PZVAL(params[2]);
 		ZVAL_STRING(params[3], binding_name, 1);
 		ZVAL_STRING(params[4], wsdl_version, 1);
+		ZVAL_STRING(params[5], full_path, 1);
 
 		script.type = ZEND_HANDLE_FP;
 		script.filename = "scripts/WS_WsdlScript.php";
@@ -1664,7 +1668,7 @@
 		{
 			php_execute_script(&script TSRMLS_CC); 
 			if (call_user_function(CG(function_table), (zval**)NULL,
-	       				   &func, &retval, 5, params TSRMLS_CC ) == SUCCESS)
+	       				   &func, &retval, 6, params TSRMLS_CC ) == SUCCESS)
 			{
 			    if (Z_TYPE_P(&retval) == IS_STRING && Z_TYPE_P(&retval) != IS_NULL)
 			    {
@@ -1864,7 +1868,7 @@
 	zend_bool must_understand = 0;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|zbz", 
-			 &name, &name_len, &ns, &ns_len, &data, &must_understand, &role) == FAILURE) {
+			&ns, &ns_len, &name, &name_len, &data, &must_understand, &role) == FAILURE) {
 			php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
 	}
 	if (ns_len == 0) {
@@ -1875,7 +1879,7 @@
 	}
 
 	add_property_stringl(this_ptr, "namespace", ns, ns_len, 1);
-	add_property_stringl(this_ptr, "localname", name, name_len, 1);
+	add_property_stringl(this_ptr, "name", name, name_len, 1);
 	if (data) {
 #ifndef ZEND_ENGINE_2
 		zval_add_ref(&data);
@@ -1883,14 +1887,16 @@
 		add_property_zval(this_ptr, "data", data);
 	}
 	add_property_bool(this_ptr, "mustUnderstand", must_understand);
-	
-	if (role && Z_TYPE_P(role) == IS_LONG &&
+	if (role == NULL) {
+	} else if (Z_TYPE_P(role) == IS_LONG &&
 		(Z_LVAL_P(role) == WS_SOAP_ROLE_NEXT ||
 		Z_LVAL_P(role) == WS_SOAP_ROLE_NONE ||
 		Z_LVAL_P(role) == WS_SOAP_ROLE_ULTIMATE_RECEIVER)) {
 			add_property_long(this_ptr, "role", Z_LVAL_P(role));
-	} else if (role && Z_TYPE_P(role) == IS_STRING && Z_STRLEN_P(role) > 0) {
+	} else if (Z_TYPE_P(role) == IS_STRING && Z_STRLEN_P(role) > 0) {
 		add_property_stringl(this_ptr, "role", Z_STRVAL_P(role), Z_STRLEN_P(role), 1);
+	} else {
+		php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters. Invalid role.");
 	}
 }
 




More information about the Wsf-c-dev mailing list