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

svn at wso2.com svn at wso2.com
Sun Jan 7 20:12:01 PST 2007


Author: buddhika
Date: Sun Jan  7 20:12:00 2007
New Revision: 340

Modified:
   wsf/php/src/config.m4
   wsf/php/src/scripts/WS_WsdlBinding.php
   wsf/php/src/scripts/WS_WsdlConsts.php
   wsf/php/src/scripts/WS_WsdlCreater.php
   wsf/php/src/scripts/WS_WsdlMessage.php
   wsf/php/src/scripts/WS_WsdlOperations.php
   wsf/php/src/scripts/WS_WsdlPort.php
   wsf/php/src/scripts/WS_WsdlScript.php
   wsf/php/src/scripts/WS_WsdlType.php
   wsf/php/src/wsf.c
Log:
 modified for WSDL generation stuff-binding styles


Modified: wsf/php/src/config.m4
==============================================================================
--- wsf/php/src/config.m4	(original)
+++ wsf/php/src/config.m4	Sun Jan  7 20:12:00 2007
@@ -14,24 +14,19 @@
 	fi
 	
 	 dnl # add include path
-	PHP_ADD_INCLUDE(../wsf_c/axis2/include/)
-	PHP_ADD_INCLUDE(../wsf_c/axis2/util/include/)
-	PHP_ADD_INCLUDE(../wsf_c/axis2/axiom/include/)
-	PHP_ADD_INCLUDE(../wsf_c/axis2/xml_schema/include/)
-	PHP_ADD_INCLUDE(../wsf_c/axis2/woden/include/)
-	PHP_ADD_INCLUDE(../wsf_c/axis2/rampart/include/)
+	PHP_ADD_INCLUDE($AXIS2C_HOME/include)
 	PHP_ADD_INCLUDE(/usr/include/libxml2)
   	dnl # check for lib and symbol presence
 
-  	PHP_ADD_LIBRARY_WITH_PATH(axis2_parser, ../wsf_c/axis2/axiom/src/parser/libxml2/.libs, WSF_SHARED_LIBADD)
-  	PHP_ADD_LIBRARY_WITH_PATH(axis2_axiom, ../wsf_c/axis2/axiom/src/om/.libs, WSF_SHARED_LIBADD)
-  	PHP_ADD_LIBRARY_WITH_PATH(axis2_minizip, ../wsf_c/axis2/util/src/minizip/.libs, WSF_SHARED_LIBADD)
+  	PHP_ADD_LIBRARY_WITH_PATH(axis2_parser, $AXIS2C_HOME/lib, WSF_SHARED_LIBADD)
+  	PHP_ADD_LIBRARY_WITH_PATH(axis2_axiom, $AXIS2C_HOME/lib, WSF_SHARED_LIBADD)
+  	PHP_ADD_LIBRARY_WITH_PATH(axis2_minizip, $AXIS2C_HOME/lib, WSF_SHARED_LIBADD)
 	
-	PHP_ADD_LIBRARY_WITH_PATH(axis2_engine, ../wsf_c/axis2/modules/core/engine/.libs, WSF_SHARED_LIBADD)	
-	PHP_ADD_LIBRARY_WITH_PATH(axis2_wsdl, ../wsf_c/axis2/modules/wsdl/.libs, WSF_SHARED_LIBADD)	
-	PHP_ADD_LIBRARY_WITH_PATH(axis2_util, ../wsf_c/axis2/util/src/.libs, WSF_SHARED_LIBADD)	
-	PHP_ADD_LIBRARY_WITH_PATH(axis2_http_sender, ../wsf_c/axis2/modules/core/transport/http/sender/.libs, WSF_SHARED_LIBADD)	
-	PHP_ADD_LIBRARY_WITH_PATH(axis2_http_receiver, ../wsf_c/axis2/modules/core/transport/http/receiver/.libs, WSF_SHARED_LIBADD)	
+	PHP_ADD_LIBRARY_WITH_PATH(axis2_engine, $AXIS2C_HOME/lib, WSF_SHARED_LIBADD)	
+	PHP_ADD_LIBRARY_WITH_PATH(axis2_wsdl, $AXIS2C_HOME/lib, WSF_SHARED_LIBADD)	
+	PHP_ADD_LIBRARY_WITH_PATH(axis2_util, $AXIS2C_HOME/lib, WSF_SHARED_LIBADD)	
+	PHP_ADD_LIBRARY_WITH_PATH(axis2_http_sender, $AXIS2C_HOME/lib, WSF_SHARED_LIBADD)	
+	PHP_ADD_LIBRARY_WITH_PATH(axis2_http_receiver, $AXIS2C_HOME/lib, WSF_SHARED_LIBADD)	
 
   	PHP_SUBST(WSF_SHARED_LIBADD)
 

Modified: wsf/php/src/scripts/WS_WsdlBinding.php
==============================================================================
--- wsf/php/src/scripts/WS_WsdlBinding.php	(original)
+++ wsf/php/src/scripts/WS_WsdlBinding.php	Sun Jan  7 20:12:00 2007
@@ -9,6 +9,7 @@
        const WS_WSDL_BINDING_BINDING_TAG = 'binding';
        const WS_WSDL_BINDING_STYLE_TAG = 'style';
        const WS_WSDL_BINDING_RPC_TAG = 'rpc';
+       const WS_WSDL_BINDING_DOCUMENT_TAG = 'document';
        const WS_WSDL_BINDING_TRANSPORT_TAG = 'transport';
        const WS_WSDL_BINDING_INPUT_TAG = 'input';
        const WS_WSDL_BINDING_OUTPUT_TAG = 'output';
@@ -16,8 +17,9 @@
        const WS_WSDL_BINDING_BODY_TAG = 'body';
        const WS_WSDL_BINDING_USE_TAG = 'use';
        const WS_WSDL_BINDING_ENC_TAG = 'encoded';
+       const WS_WSDL_BINDING_LITERAL_TAG = 'literal';
        const WS_WSDL_BINDING_ENCOD_STYLE_TAG = 'encodingStyle';
-       
+       const WS_WSDL_BINDING_SOAP_ACTION_TAG = 'soapAction';
 
        private $svr_name;
        public  $operations;
@@ -28,7 +30,7 @@
        }
 
 
-      public function createBinding(DomDocument $binding_doc, DomElement $binding_root)
+      public function createDocLitBinding(DomDocument $binding_doc, DomElement $binding_root)
       {
           $binding_ele = $binding_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
 				      self::WS_WSDL_BINDING_BINDING_TAG);
@@ -38,8 +40,8 @@
 	  
 	  $s_binding = $binding_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_SOAP_NAMESPACE,
 					     self::WS_WSDL_BINDING_BINDING_TAG);
-	  $s_binding->setAttribute(self::WS_WSDL_BINDING_STYLE_TAG, self::WS_WSDL_BINDING_RPC_TAG);
 	  $s_binding->setAttribute(self::WS_WSDL_BINDING_TRANSPORT_TAG, WS_WsdlConst::WS_SCHEMA_SOAP_HTTP_NAMESPACE);
+	  $s_binding->setAttribute(self::WS_WSDL_BINDING_STYLE_TAG, self::WS_WSDL_BINDING_DOCUMENT_TAG);
 	  $binding_ele->appendChild($s_binding);
 	  
 	  foreach($this->operations as $name => $params) 
@@ -47,6 +49,12 @@
 	      $op = $binding_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
 					  self::WS_WSDL_BINDING_OPERATION_TAG);
 	      $op->setAttribute(self::WS_WSDL_BINDING_NAME_TAG, $name);
+	      $action_ele = $binding_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_SOAP_NAMESPACE, self::WS_WSDL_BINDING_OPERATION_TAG);
+	      $action_ele->setAttribute(self::WS_WSDL_BINDING_SOAP_ACTION_TAG,"http://localhost/wsdlgen");
+	      $action_ele->setAttribute(self::WS_WSDL_BINDING_STYLE_TAG, self::WS_WSDL_BINDING_DOCUMENT_TAG);
+	      $op->appendChild($action_ele);
+	      
+
 	      foreach(array(self::WS_WSDL_BINDING_INPUT_TAG,
 			    self::WS_WSDL_BINDING_OUTPUT_TAG) as $type) 
 	      {
@@ -54,9 +62,7 @@
 		  $s_body = $binding_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_SOAP_NAMESPACE,
 						  self::WS_WSDL_BINDING_BODY_TAG);
 		  $s_body->setAttribute(self::WS_WSDL_BINDING_USE_TAG, 
-					self::WS_WSDL_BINDING_ENC_TAG);
-		  $s_body->setAttribute(self::WS_WSDL_BINDING_ENCOD_STYLE_TAG,
-					WS_WsdlConst::WS_SOAP_SCHEMA_ENCODING_NAMESPACE);
+					self::WS_WSDL_BINDING_LITERAL_TAG);
 		  $sbinding_ele->appendChild($s_body);
 		  $op->appendChild($sbinding_ele);
 	      }
@@ -64,6 +70,47 @@
 	  }
 	  $binding_root->appendChild($binding_ele);
       }
-  }
+
+
+
+
+       public function createRPCBinding(DomDocument $binding_doc, DomElement $binding_root)
+       {
+	   $binding_ele = $binding_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
+							self::WS_WSDL_BINDING_BINDING_TAG);
+	   $binding_ele->setAttribute(self::WS_WSDL_BINDING_NAME_TAG, $this->svr_name);
+	   $binding_ele->setAttribute(self::WS_WSDL_BINDING_TYPE_TAG,
+				      self::WS_WSDL_BINDING_TNS_TAG.$this->svr_name);
+	   
+	   $s_binding = $binding_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_SOAP_NAMESPACE,
+						      self::WS_WSDL_BINDING_BINDING_TAG);
+	   $s_binding->setAttribute(self::WS_WSDL_BINDING_STYLE_TAG, self::WS_WSDL_BINDING_RPC_TAG);
+	   $s_binding->setAttribute(self::WS_WSDL_BINDING_TRANSPORT_TAG, WS_WsdlConst::WS_SCHEMA_SOAP_HTTP_NAMESPACE);
+	   $binding_ele->appendChild($s_binding);
+
+	   foreach($this->operations as $name => $params)
+	   {
+	       $op = $binding_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
+						   self::WS_WSDL_BINDING_OPERATION_TAG);
+	       $op->setAttribute(self::WS_WSDL_BINDING_NAME_TAG, $name);
+	       foreach(array(self::WS_WSDL_BINDING_INPUT_TAG,
+			     self::WS_WSDL_BINDING_OUTPUT_TAG) as $type)
+	       {
+		   $sbinding_ele = $binding_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE, $type);
+		   $s_body = $binding_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_SOAP_NAMESPACE,
+							       self::WS_WSDL_BINDING_BODY_TAG);
+		   $s_body->setAttribute(self::WS_WSDL_BINDING_USE_TAG,
+					     self::WS_WSDL_BINDING_ENC_TAG);
+		   $s_body->setAttribute(self::WS_WSDL_BINDING_ENCOD_STYLE_TAG,
+					     WS_WsdlConst::WS_SOAP_SCHEMA_ENCODING_NAMESPACE);
+		   $sbinding_ele->appendChild($s_body);
+		   $op->appendChild($sbinding_ele);
+	       }
+	       $binding_ele->appendChild($op);
+	   }
+	   $binding_root->appendChild($binding_ele);
+       }
+       
+}
 
 ?>
\ No newline at end of file

Modified: wsf/php/src/scripts/WS_WsdlConsts.php
==============================================================================
--- wsf/php/src/scripts/WS_WsdlConsts.php	(original)
+++ wsf/php/src/scripts/WS_WsdlConsts.php	Sun Jan  7 20:12:00 2007
@@ -8,7 +8,7 @@
     const WS_WSDL_DEFINITION = 'definitions';
     const WS_WSDL_DEF_XSD_QN = 'xmlns:xsd';
     const WS_WSDL_DEF_TNS_QN = 'xmlns:tns';
-    const WS_WSDL_DEF_SOAP_ENV_QN = 'xmlns:soap-env';
+    const WS_WSDL_DEF_SOAP_ENV_QN = 'xmlns:soap';
     const WS_WSDL_DEF_WSDL_QN = 'xmlns:wsdl';
     const WS_WSDL_DEF_SOAP_ENC_QN = 'xmlns:soapenc';
     const WS_WSDL_DEF_TARGET_NS = 'targetNamespace';
@@ -86,6 +86,8 @@
 			  'name' => 'gMonthDay'),
 	'gYear' => array('ns'   => self::WS_SOAP_XML_SCHEMA_NAMESPACE,
 			  'name' => 'gYear'),
+	'gDay' => array('ns'   => self::WS_SOAP_XML_SCHEMA_NAMESPACE,
+			  'name' => 'gDay'),
 	'duration' => array('ns'   => self::WS_SOAP_XML_SCHEMA_NAMESPACE,
 				'name' =>'duration'),
 	'Name' => array('ns'   => self::WS_SOAP_XML_SCHEMA_NAMESPACE,

Modified: wsf/php/src/scripts/WS_WsdlCreater.php
==============================================================================
--- wsf/php/src/scripts/WS_WsdlCreater.php	(original)
+++ wsf/php/src/scripts/WS_WsdlCreater.php	Sun Jan  7 20:12:00 2007
@@ -14,9 +14,10 @@
 	 private $endpoint;
 	 private $f_name;
 	 private $service_name;
+	 private $Binding_style;
 
 	 function __construct($obj_name, $service, $endpoints, 
-			      $ns = false, $obj_type = false)
+			      $binding_style,  $ns = false, $obj_type = false)
 	 {
 	     if(!$ns)
 	     {
@@ -28,6 +29,23 @@
 	     $this->endpoint = $endpoints;
 	     $this->f_name = $obj_name;
 	     $this->service_name = $service;
+	     if (!$binding_style )
+	     {
+		 $this->Binding_style = "doc-lit";
+	     }
+	     else if ($binding_style == "rpc")
+	     {
+		 $this->Binding_style = "rpc";
+	     }
+	     else if ($binding_style == "doc-lit")
+	     {
+		 $this->Binding_style = "doc-lit";
+	     }
+	     else
+	     {
+		 echo " Wrong binding style\n";
+		 exit(0);
+	     }
 	 }
 	 
 	 private function buildWsdlDom()
@@ -58,36 +76,70 @@
 					    WS_Wsdlconst::WS_WSDL_DEF_SOAP_ENC_QN,
 					    WS_Wsdlconst::WS_SOAP_SCHEMA_ENCODING_NAMESPACE);
 	     
-	     $wsdl_root_ele->setAttribute(WS_Wsdlconst::WS_WSDL_DEF_TARGET_NS,
-					  $this->namespace);
-		 
-		 
- 		 $oper_obj = new WS_WsdlOperations($this->f_name);
- 		 $createdTypeArry = $oper_obj->createdTypes;
- 		 $operationsArry = $oper_obj->operations;
-
- 	         $type_obj = new WS_WsdlType($this->namespace, $createdTypeArry, $operationsArry);
-  		 $type_obj->createType($wsdl_dom, $wsdl_root_ele);
- 		 $simple_array = $type_obj->simpleTypes;
-		
-   		 $msg_obj = new WS_WsdlMessage($operationsArry, $simple_array);
-   		 $msg_obj->createMessage($wsdl_dom,$wsdl_root_ele);
+	      $wsdl_root_ele->setAttribute(WS_Wsdlconst::WS_WSDL_DEF_TARGET_NS,
+					   $this->namespace);
 
-   		 $port_obj = new WS_WsdlPort($this->service_name, $operationsArry);
-   		 $port_obj->createPortType($wsdl_dom, $wsdl_root_ele);
-		 
-   		 $bind_obj = new WS_WsdlBinding($this->service_name, $operationsArry);
-   		 $bind_obj->createBinding($wsdl_dom, $wsdl_root_ele);
- 		 
-  		 $svr_obj = new WS_WsdlService($this->service_name, $this->endpoint);
-   		 $svr_obj->createService($wsdl_dom, $wsdl_root_ele);
- 
+
+	      $oper_obj = new WS_WsdlOperations($this->f_name);
+	      $createdTypeArry = $oper_obj->createdTypes;
+	      $operationsArry = $oper_obj->operations;
+	      $xsdArry = $oper_obj->xsdTypes;
+		  
+	      // testing
+//	      print_r($xsdArry);
 		  
+	      if($this->Binding_style == "doc-lit")
+	      {
+		  $type_obj = new WS_WsdlType($this->namespace, $createdTypeArry, $xsdArry);
+		  $type_obj->createDocLitType($wsdl_dom, $wsdl_root_ele);
+		  $simple_array = $type_obj->simpleTypes;
+		
+		  $msg_obj = new WS_WsdlMessage($operationsArry, $simple_array);
+		  $msg_obj->createDocLitMessage($wsdl_dom,$wsdl_root_ele);
+	      }
+
+	      if ($this->Binding_style == "rpc")
+	      {
+		  $type_obj = new WS_WsdlType($this->namespace, $createdTypeArry, $operationsArry);
+		  $type_obj->createRPCType($wsdl_dom, $wsdl_root_ele);
+		  $simple_array = $type_obj->simpleTypes;
 
-		 $wsdl_dom->appendChild($wsdl_root_ele);
-		 $wsdl_dom->save("/tmp/newWsdl.wsdl");
-		 return $wsdl_dom->saveXML();
 		 
+		  $msg_obj = new WS_WsdlMessage($operationsArry, $simple_array);
+		  $msg_obj->createRPCMessage($wsdl_dom,$wsdl_root_ele);
+
+	      }
+
+
+
+	      $port_obj = new WS_WsdlPort($this->service_name, $operationsArry);
+	      $port_obj->createPortType($wsdl_dom, $wsdl_root_ele);
+
+	      if ($this->Binding_style == "doc-lit")
+	      {
+		  $bind_obj = new WS_WsdlBinding($this->service_name, $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->createRPCBinding($wsdl_dom, $wsdl_root_ele);
+	       
+	      }
+	      
+	      $svr_obj = new WS_WsdlService($this->service_name, $this->endpoint);
+	      $svr_obj->createService($wsdl_dom, $wsdl_root_ele);
+	      
+	      
+	      
+	      $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();
+	      
 	 }
 	 public function WS_WsdlOut()
 	     {

Modified: wsf/php/src/scripts/WS_WsdlMessage.php
==============================================================================
--- wsf/php/src/scripts/WS_WsdlMessage.php	(original)
+++ wsf/php/src/scripts/WS_WsdlMessage.php	Sun Jan  7 20:12:00 2007
@@ -1,7 +1,6 @@
 <?php
  class WS_WsdlMessage
  {
-//   Not implemented fot the default type case
 
      const WS_WSDL_MESSAGE_INPUT_TAG = 'input';
      const WS_WSDL_MESSAGE_OUT_TAG = 'output';
@@ -10,6 +9,7 @@
      const WS_WSDL_MESSAGE_TAG = 'message';
      const WS_WSDL_MESSAGE_PART_TAG = 'part';
      const WS_WSDL_MESSAGE_NS_TAG = 'tag';
+     const WS_WSDL_MESSAGE_ELEMENT_TAG = 'element';
 
 
      public $operations;
@@ -23,7 +23,7 @@
 
 
 
-     public function createMessage(DomDocument $msg_doc, DomElement $msg_root)
+     public function createDocLitMessage(DomDocument $msg_doc, DomElement $msg_root)
      {
 	 foreach(array(self::WS_WSDL_MESSAGE_INPUT_TAG,
 		       self::WS_WSDL_MESSAGE_OUT_TAG) as $type) 
@@ -35,25 +35,66 @@
 						 self::WS_WSDL_MESSAGE_TAG);
 		 $el->setAttribute(self::WS_WSDL_MESSAGE_NAME_TAG, 
 				   "$name".ucfirst($type));
-		 foreach($params[$type] as $param) 
+
+		 $part = $msg_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
+						   self::WS_WSDL_MESSAGE_PART_TAG);
+		 $part->setAttribute(self::WS_WSDL_MESSAGE_NAME_TAG,
+				     "parameters");
+		 if ("Input" == ucfirst($type))
 		 {
-		     $part = $msg_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE, 
-						       self::WS_WSDL_MESSAGE_PART_TAG);
-		     $part->setAttribute(self::WS_WSDL_MESSAGE_NAME_TAG, 
-					 $param[self::WS_WSDL_MESSAGE_NAME_TAG]);
-		     $prefix = $msg_root->lookupPrefix($this->simpleTypes[$param[self::WS_WSDL_MESSAGE_TYPE_TAG]]['ns']);
-		     $part->setAttribute(self::WS_WSDL_MESSAGE_TYPE_TAG, 
-					 "$prefix:".$this->simpleTypes[$param[self::WS_WSDL_MESSAGE_TYPE_TAG]][self::WS_WSDL_MESSAGE_NAME_TAG]);
-		     $el->appendChild($part);
-		    
-		 } 
+		     $part->setAttribute(self::WS_WSDL_MESSAGE_ELEMENT_TAG,
+				     $name);
+		 }
+		 if ("Output" == ucfirst($type))
+		 {
+		     $part->setAttribute(self::WS_WSDL_MESSAGE_ELEMENT_TAG,
+				     $name."Response");
+		 }
+		     
+		 $el->appendChild($part);
+		 
+		 
 		 $msg_root->appendChild($el);
 	     }
 	 }
-	 
+     } 
+     
+
+     public function createRPCMessage(DomDocument $msg_doc, DomElement $msg_root)
+     {
+	 foreach(array(self::WS_WSDL_MESSAGE_INPUT_TAG,
+                       self::WS_WSDL_MESSAGE_OUT_TAG) as $type)
+         {
+
+             foreach($this->operations as $name => $params)
+             {
+                 $el = $msg_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
+                                                 self::WS_WSDL_MESSAGE_TAG);
+                 $el->setAttribute(self::WS_WSDL_MESSAGE_NAME_TAG,
+                                   "$name".ucfirst($type));
+                 foreach($params[$type] as $param)
+                 {
+		     $part = $msg_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
+						       self::WS_WSDL_MESSAGE_PART_TAG);
+		     $part->setAttribute(self::WS_WSDL_MESSAGE_NAME_TAG,
+					 $param[self::WS_WSDL_MESSAGE_NAME_TAG]);
+                      $prefix = $msg_root->lookupPrefix($this->simpleTypes[$param[self::WS_WSDL_MESSAGE_TYPE_TAG]]['ns']);
+                      $part->setAttribute(self::WS_WSDL_MESSAGE_TYPE_TAG,
+                                          "$prefix:".$this->simpleTypes[$param[self::WS_WSDL_MESSAGE_TYPE_TAG]][self::WS_WSDL_MESSAGE_NAME_TAG]);
+		     $el->appendChild($part);
+
+		     //  print_r($param);
+                 }
+                 $msg_root->appendChild($el);
+             }
+         }
+
      }
+     
+
  }
 
 
 
+
 ?>
\ No newline at end of file

Modified: wsf/php/src/scripts/WS_WsdlOperations.php
==============================================================================
--- wsf/php/src/scripts/WS_WsdlOperations.php	(original)
+++ wsf/php/src/scripts/WS_WsdlOperations.php	Sun Jan  7 20:12:00 2007
@@ -62,11 +62,15 @@
     public $phpMapArry = array();
     public $operationName;
 
+    public $xsdTypes = array();
+    
+
     function __construct($operations)
     {
 	foreach($operations as $i=>$value)
 	{
 	    $this->operationName = $operations[$i];
+	    $this->xsdMapArry[$this->operationName] = array();
 	    $this->setOperations($this->operationName);
 	}
     }
@@ -80,10 +84,14 @@
 
 	if (!$doc_comment) 
 	{
+	    $this->xsdTypes[$operationName]["In"] = array();
+
  	    foreach($operation->getParameters() as $i => $param)
  	    {
 		$match[2] = $param->getName();
-		$match[1] = "Any";
+		$match[1] = "any";
+		$this->xsdTypes[$operationName]["In"][$match[2]] = "any";
+
 
 		$this->createdTypes[$match[1]] = 2;
 		$this->operations[$operationName][self::WS_OPERATION_INPUT_TAG][] = 
@@ -91,7 +99,9 @@
 			  self::WS_OPERATION_TYPE_TAG => $match[1]);
 	    }
 
-	    
+
+	    $this->xsdTypes[$operationName]["Out"]["returnVal"] = "any";
+
 	    $this->createdTypes[$match[1]] = 2;
 	    $this->operations[$operationName][self::WS_OPERATION_OUTPUT_TAG][] = 
 		array(self::WS_OPERATION_NAME_TAG => self::WS_OPERATION_RET_TAG,
@@ -110,10 +120,12 @@
 		    
 		}
 	    }
+	    $j = 0;
 	    if(preg_match_all('|@param\s+(?:object\s+)?(\w+)\s+\$(\w+)\s+(.*)|', $doc_comment, 
 			      $matches, PREG_SET_ORDER)) 
 	    {
-		$j = 0;
+		//$j = 0;
+		$this->xsdTypes[$operationName]["In"] = array();
 		foreach($matches as $match) 
 		{
 		    $j++;
@@ -121,6 +133,8 @@
 		    $this->phpMapArry[$j] = $match[1];
 
 		    $relavantType = $this->checkValidTypes($j);
+		    $this->xsdTypes[$operationName]["In"][$match[2]] = $relavantType;
+
 		    $this->operations[$operationName][self::WS_OPERATION_INPUT_TAG][] = 
 			array(self::WS_OPERATION_NAME_TAG => $match[2], 
 			      self::WS_OPERATION_TYPE_TAG => $relavantType);
@@ -129,13 +143,17 @@
 		
 	    }
 
-	    if(preg_match('|@return\s+(?:object\s+)?(\w+)|', $doc_comment, $match)) 
+	    if(preg_match('|@return\s+(?:object\s+)?(\w+)\s+\$(\w+)\s+(.*)|', $doc_comment, $match_r)) 
 	    {
+		$j++;
+		$this->phpMapArry[$j] = $match_r[1];
+		$returnType = $this->checkValidTypes($j);
+		$this->xsdTypes[$operationName]["Out"][$match_r[2]] = $returnType;
 
-		$this->createdTypes[$match[1]] = 1;
+		$this->createdTypes[$match_r[1]] = 1;
 		$this->operations[$operationName][self::WS_OPERATION_OUTPUT_TAG][] = 
 		    array(self::WS_OPERATION_NAME_TAG => self::WS_OPERATION_RET_TAG,
-			  self::WS_OPERATION_TYPE_TAG => $match[1]);
+			  self::WS_OPERATION_TYPE_TAG => $returnType);
 	    }	
 	}
     }
@@ -146,10 +164,11 @@
 	$PHPType = $this->phpMapArry[$keyIndex];
 	if ($PHPType == self::$mappingTable[$keyPHPArray])
         {
-	    return self::$mappingTable[$keyPHPArray];
+	    return $keyPHPArray;
 	}
 	else
 	{
+	    error_log("type missmatched", 0);
 	    return $PHPType;
 	}
 

Modified: wsf/php/src/scripts/WS_WsdlPort.php
==============================================================================
--- wsf/php/src/scripts/WS_WsdlPort.php	(original)
+++ wsf/php/src/scripts/WS_WsdlPort.php	Sun Jan  7 20:12:00 2007
@@ -7,7 +7,7 @@
      const WS_WSDL_PORT_TYPE_OPERATION_TAG = 'operation';
      const WS_WSDL_PORT_TYPE_INPUT_TAG = 'input';
      const WS_WSDL_PORT_TYPE_OUTPUT_TAG = 'output';
-     const WS_WSDL_PORT_TYPE_TNS_TAG = 'tns:';
+     const WS_WSDL_PORT_TYPE_TNS_TAG = 's0:';
      const WS_WSDL_PORT_TYPE_MESSAGE_TAG = 'message';
 
      private $service_name;

Modified: wsf/php/src/scripts/WS_WsdlScript.php
==============================================================================
--- wsf/php/src/scripts/WS_WsdlScript.php	(original)
+++ wsf/php/src/scripts/WS_WsdlScript.php	Sun Jan  7 20:12:00 2007
@@ -1,11 +1,27 @@
 <?php
 
-function ws_generate_wsdl($include_location, $service_name, $fn_arry)
+function ws_generate_wsdl($include_location, $service_name, $fn_arry, $binding_style)
 {
     include $include_location;
+    
+    $Binding_style = NULL;
+
+    if ($binding_style == "rpc")
+    {
+	$Binding_style = "rpc";
+    }
+    else if ($binding_style == "doc-lit")
+    {
+	$Binding_style = "doc-lit";
+    }
+    else
+    {
+	echo "Wrong binding style\n";
+	exit(0);
+    }
 
-    $tmp = NULL;
-    $wsdl = new WS_WsdlCreater($fn_arry ,$service_name, 'http://localhost/Wso2/Wsdl_gen.php', 'http://www.wso2.org/php/');
+    
+    $wsdl = new WS_WsdlCreater($fn_arry ,$service_name, 'http://localhost/Wso2/Wsdl_gen.php', $Binding_style, 'http://www.wso2.org/php/');
     $wsdl_out = $wsdl->WS_WsdlOut();
 
     echo $wsdl_out;

Modified: wsf/php/src/scripts/WS_WsdlType.php
==============================================================================
--- wsf/php/src/scripts/WS_WsdlType.php	(original)
+++ wsf/php/src/scripts/WS_WsdlType.php	Sun Jan  7 20:12:00 2007
@@ -18,14 +18,23 @@
      const WS_WSDL_TYPE_BASE_TAG = 'base';
      const WS_WSDL_TYPE_REF_TAG = 'ref';
      const WS_WSDL_TYPE_SOAPENC_ARRAY_TAG = 'soapenc:array';
-     const WS_WSDL_TYPE_SOAPENC_ARRAY_TYPE_TAG = 'soapenc:ayyayType';
+     const WS_WSDL_TYPE_SOAPENC_ARRAY_TYPE_TAG = 'soapenc:arrayType';
      const WS_WSDL_TYPE_ARRAY_TYPE_TAG = 'arrayType';
      const WS_WSDL_TYPE_TNS_TAG = 'tns:mixed[]';
      const WS_WSDL_TYPE_ALL_TAG = 'all';
      const WS_WSDL_TYPE_ELEMENT_TAG = 'element';
+     const WS_WSDL_TYPE_SEQUECE_TAG = 'sequence';
+     const WS_WSDL_TYPE_XSD_TAG = 'xsd:';
+     const WS_WSDL_TYPE_RESPONSE_TAG = 'response';
+     const WS_WSDL_TYPE_IN_TAG = 'In';
+     const WS_WSDL_TYPE_OUT_TAG = 'Out';
+     const WS_WSDL_TYPE_ELEMENTFROM_TAG = 'elementFromDefault';
+     const WS_WSDL_TYPE_QULIFIED_TAG = 'qualified';
+
 
      public $simpleTypes;
      public $cmplxTypes;
+     public $schemaTypes;
      private $ns;
 
      private $createdTypes;
@@ -34,6 +43,7 @@
 	 $this->ns = $ns;
 	 $this->simpleTypes = WS_WsdlConst::$defaultTypes;
 	 $this->createdTypes = $array1;
+	 $this->schemaTypes = $array2;
 	 $this->createPHPTypes();
 	
      }
@@ -90,16 +100,89 @@
 	 }
 	 
 	
-	 public function createType(DomDocument $type_doc, DomElement $type_root)
+	 public function createDocLitType(DomDocument $type_doc, DomElement $type_root)
 	 {
 	         $types = $type_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
 						     self::WS_WSDL_TYPE_TYPES_TAG);
 		 $type_root->appendChild($types);
 		 $el = $type_doc->createElementNS(WS_WsdlConst::WS_SOAP_XML_SCHEMA_NAMESPACE, 
 						  self::WS_WSDL_TYPE_SCHEMA_TAG);
+
+		 $el->setAttribute(self::WS_WSDL_TYPE_ELEMENTFROM_TAG,
+				   self::WS_WSDL_TYPE_QULIFIED_TAG);
 		 $types->appendChild($el);
 		 
 
+		 foreach ($this->schemaTypes as $function_name => $params)
+		 {
+		     foreach ($params as $requestType => $params2)
+		     {
+			 $ct = $type_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
+							  self::WS_WSDL_TYPE_ELEMENT_TAG);
+			 if ($requestType == self::WS_WSDL_TYPE_IN_TAG)
+			 {
+			     $ct->setAttribute(self::WS_WSDL_TYPE_NAME_TAG, $function_name);
+			     $el->appendChild($ct);
+			     $comtype = $type_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
+								   self::WS_WSDL_TYPE_COMPLXTYPE_TAG);
+			     $ct->appendChild($comtype);
+			     $seq = $type_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
+							       self::WS_WSDL_TYPE_SEQUECE_TAG);
+			     
+			     $comtype->appendChild($seq);
+			     foreach ($params2 as $paramName => $xsType)
+			     {
+				 $ele = $type_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
+							       self::WS_WSDL_TYPE_ELEMENT_TAG);
+				 $ele->setAttribute(self::WS_WSDL_TYPE_NAME_TAG, $paramName);
+				 $ele->setAttribute(self::WS_WSDL_TYPE_TYPE_TAG, self::WS_WSDL_TYPE_XSD_TAG.$xsType);
+				 $seq->appendChild($ele);
+			     }
+			 }
+			 if ($requestType == self::WS_WSDL_TYPE_OUT_TAG)
+			 {
+			     $ct->setAttribute(self::WS_WSDL_TYPE_NAME_TAG, $function_name.self::WS_WSDL_TYPE_RESPONSE_TAG);
+                             $el->appendChild($ct);
+                             $comtype = $type_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
+                                                                   self::WS_WSDL_TYPE_COMPLXTYPE_TAG);
+                             $ct->appendChild($comtype);
+                             $seq = $type_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
+                                                               self::WS_WSDL_TYPE_SEQUECE_TAG);
+
+                             $comtype->appendChild($seq);
+                        
+			     foreach ($params2 as $paramName => $xsType)
+			     {
+				 $ele = $type_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
+							       self::WS_WSDL_TYPE_ELEMENT_TAG);
+				 $ele->setAttribute(self::WS_WSDL_TYPE_NAME_TAG, $paramName);
+				 $ele->setAttribute(self::WS_WSDL_TYPE_TYPE_TAG, self::WS_WSDL_TYPE_XSD_TAG.$xsType);
+				 $seq->appendChild($ele);
+			     }
+			
+			
+			 }
+		     }
+
+		 }
+		 
+	 }
+
+
+	 public function createRPCType(DomDocument $type_doc, DomElement $type_root)
+	 {
+	         $types = $type_doc->createElementNS(WS_WsdlConst::WS_SCHEMA_WSDL_NAMESPACE,
+						     self::WS_WSDL_TYPE_TYPES_TAG);
+		 $type_root->appendChild($types);
+		 $el = $type_doc->createElementNS(WS_WsdlConst::WS_SOAP_XML_SCHEMA_NAMESPACE, 
+						  self::WS_WSDL_TYPE_SCHEMA_TAG);
+
+		 $el->setAttribute(self::WS_WSDL_TYPE_ELEMENTFROM_TAG,
+				   self::WS_WSDL_TYPE_QULIFIED_TAG);
+		 $types->appendChild($el);
+		 
+
+
 		 $ct = $type_doc->createElementNS(WS_WsdlConst::WS_SOAP_XML_SCHEMA_NAMESPACE,
 						  self::WS_WSDL_TYPE_COMPLXTYPE_TAG);
 		 $el->appendChild($ct);
@@ -142,10 +225,10 @@
 		     $ct->appendChild($all);
 		     $el->appendChild($ct);
 		 }
+
 		 
 	 }
-	 
-     }
+      }
      
 
 

Modified: wsf/php/src/wsf.c
==============================================================================
--- wsf/php/src/wsf.c	(original)
+++ wsf/php/src/wsf.c	Sun Jan  7 20:12:00 2007
@@ -3398,13 +3398,19 @@
                     svc_info->modules_to_engage = axis2_array_list_create(env, 3);
                 AXIS2_ARRAY_LIST_ADD(svc_info->modules_to_engage, env, "rampart");
             }
-			if(zend_hash_find(ht, "reliable", sizeof("reliable"), 
-				(void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_BOOL) {
-				if(!svc_info->modules_to_engage)
-					svc_info->modules_to_engage = axis2_array_list_create(env, 3);
-				AXIS2_ARRAY_LIST_ADD(svc_info->modules_to_engage, env, "sandesha2");					
-			}
-        }            
+	    if(zend_hash_find(ht, "reliable", sizeof("reliable"), 
+		 (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_BOOL) {
+		      if(!svc_info->modules_to_engage)
+			 svc_info->modules_to_engage = axis2_array_list_create(env, 3);
+		      AXIS2_ARRAY_LIST_ADD(svc_info->modules_to_engage, env, "sandesha2");					
+	     }
+
+	    if(zend_hash_find(ht, "bindingStyle", sizeof("bindingStyle"), (void **)&tmp) == SUCCESS &&
+                 Z_TYPE_PP(tmp) == IS_STRING)
+	    {
+		add_property_stringl(obj, "bindingStyle", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
+	    }
+	}
     }
     if(SG(request_info).request_uri)
 	{
@@ -3737,14 +3743,18 @@
 		char *str1, *token, saveptr1;
 		const char *del[2];
 		int j = 0;
-		zval func, retval, param1, param2, param3;
-		zval *params[3];
+		zval func, retval, param1, param2, param3, param4;
+		zval *params[4];
 		axis2_hash_index_t *hi = NULL;
 		zval *f_val;
 		zend_file_handle script;
 		php_stream *stream = NULL;
 		char *location = NULL;
 		char resolved_path[MAXPATHLEN];
+		char *val = NULL;
+		int len = 0;
+		zval **tmpval;
+		char *binding_name = NULL;
 
 		/** wsdl generation stuff */
 
@@ -3754,7 +3764,16 @@
 		params[0] = &param1;
 		params[1] = &param2;
 		params[2] = &param3;
+		params[3] = &param4;
 
+		/** getting the correct binding style */
+		if ((zend_hash_find(Z_OBJPROP_P(obj), "bindingStyle", sizeof("bindingStyle"),
+				    &tmpval)) == SUCCESS && Z_TYPE_PP(tmpval) == IS_STRING)
+		{
+		   binding_name = Z_STRVAL_PP(tmpval);
+	
+		}
+		
 		/** finding the the functions in the service.php file */
 		MAKE_STD_ZVAL(f_val);
 		array_init(f_val);
@@ -3783,7 +3802,8 @@
 		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);
+
 		script.type = ZEND_HANDLE_FP;
 		script.filename = "wsdlgen/WS_WsdlScript.php";
 		script.opened_path = NULL;
@@ -3798,11 +3818,13 @@
 		{
 			php_execute_script(&script TSRMLS_CC); 
 			if (call_user_function(CG(function_table), (zval**)NULL,
-	       				   &func, &retval, 3, params TSRMLS_CC ) == SUCCESS)
+	       				   &func, &retval, 4, params TSRMLS_CC ) == SUCCESS)
 			{
 			if (Z_TYPE_P(&retval) == IS_STRING && Z_TYPE_P(&retval) != IS_NULL)
-				{
-				php_printf("Wsdl is created in the location tmp/test.wsdl");
+			{
+			    val = estrdup(Z_STRVAL(retval));
+			    len = Z_STRLEN(retval);
+			   /*  php_printf("Wsdl is created in the location tmp/test.wsdl"); */
 			}
 				else
 				php_printf("A problem occured");
@@ -4189,4 +4211,4 @@
 PHP_METHOD(ws_header, __destruct) 
 {
 
-}
\ No newline at end of file
+}




More information about the Wsf-c-dev mailing list