예제 #1
0
 /**
  * Add a Single or Multiple Functions to the WSDL
  *
  * @param string $function Function Name
  * @param string $namespace Function namespace - Not Used
  * @return Zend_Soap_AutoDiscover
  */
 public function addFunction($function, $namespace = '')
 {
     static $port;
     static $operation;
     static $binding;
     if (!is_array($function)) {
         $function = (array) $function;
     }
     $uri = $this->getUri();
     if (!$this->_wsdl instanceof Zend_Soap_Wsdl) {
         $parts = explode('.', basename($_SERVER['SCRIPT_NAME']));
         $name = $parts[0];
         $wsdl = new Zend_Soap_Wsdl($name, $uri, $this->_strategy);
         // The wsdl:types element must precede all other elements (WS-I Basic Profile 1.1 R2023)
         $wsdl->addSchemaTypeSection();
         $port = $wsdl->addPortType($name . 'Port');
         $binding = $wsdl->addBinding($name . 'Binding', 'tns:' . $name . 'Port');
         $wsdl->addSoapBinding($binding, $this->_bindingStyle['style'], $this->_bindingStyle['transport']);
         $wsdl->addService($name . 'Service', $name . 'Port', 'tns:' . $name . 'Binding', $uri);
     } else {
         $wsdl = $this->_wsdl;
     }
     foreach ($function as $func) {
         $method = $this->_reflection->reflectFunction($func);
         $this->_addFunctionToWsdl($method, $wsdl, $port, $binding);
     }
     $this->_wsdl = $wsdl;
     return $this;
 }