public function classToWsdl() { $className = $this->getClassName(); // Get the Methods from the Class $wsdlMethods = $this->getMethods($className); // Find the Complex Types $complexTypes = WsdlType::getComplexTypes($wsdlMethods); foreach ($complexTypes as &$complexType) { $this->addComplexType($complexType); } // Add Methods to the WSDL File foreach ($wsdlMethods as $wsdlMethod) { if (!$wsdlMethod->getIsHeader()) { $this->addMethod($wsdlMethod); } } $this->doCreateWsdl(); return $this->saveXML(); }
public function createWsdl($classFileName, $nameSpaceUrl, $wsdlFile = null, $endPoint = null) { // Require the Class we are Parsing require_once $classFileName; $this->classDir = dirname($classFileName); // Strip Extension to get Class Name $this->className = $classFileName; $this->className = basename($this->className, ".inc"); $this->className = basename($this->className, ".php"); print "Creating Wsdl for Class: {$this->className}\n"; // Calculate the EndPoint for this service $this->endPoint = $nameSpaceUrl . $endPoint; if (!$endPoint) { $this->endPoint = $nameSpaceUrl . $this->className . ".php"; } // Get the WSDL File Name if (!$wsdlFile) { $wsdlFile = $this->className . ".wsdl"; } // Create a WSDL File $wsdl = new WsdlWriter($wsdlFile, $nameSpaceUrl, $this->endPoint); // Get the Methods from the Class $wsdlMethods = $this->getMethods(); // Find the Complex Types $complexTypes = WsdlType::getComplexTypes($wsdlMethods); foreach ($complexTypes as &$complexType) { $wsdl->addComplexType($complexType); } // Add Methods to the WSDL File foreach ($wsdlMethods as $wsdlMethod) { $wsdl->addMethod($wsdlMethod); } // Write it to Disk $wsdl->save(); return $wsdl->saveXML(); }