Example #1
0
 public function __construct($name, $controller, $soapAction, $soapRequiredAction, $version = \SOAP_1_1)
 {
     parent::__construct($name);
     $this->controller = $controller;
     $this->addOption('soapAction', $soapAction);
     $this->addOption('soapActionRequired', $soapRequiredAction);
     $this->version = $version;
 }
 public function addOperation(Method $method)
 {
     $operation = $this->document->createElement(Dumper::WSDL_NS . ':operation');
     $operation->setAttribute('name', $method->getName());
     $soapOperation = $this->document->createElement($this->soapNs . ':operation');
     $soapAction = $method->getOption('soapAction') ? $method->getOption('soapAction') : $this->namespace . '/#' . $method->getName();
     $soapActionRequired = $method->getOption('soapActionRequired') ? $method->getOption('soapActionRequired') : true;
     if (\SOAP_DOCUMENT == $this->style) {
         $soapOperation->setAttribute('style', 'document');
     }
     $soapOperation->setAttribute('soapAction', $soapAction);
     $soapOperation->setAttribute('soapActionRequired', $soapActionRequired ? 'true' : 'false');
     $operation->appendChild($soapOperation);
     $this->getBindingNode()->appendChild($operation);
     $use = \SOAP_LITERAL === $method->getUse() ? 'literal' : 'encoded';
     $input = $this->document->createElement(Dumper::WSDL_NS . ':input');
     $soapBody = $this->document->createElement($this->soapNs . ':body');
     $soapBody->setAttribute('use', $use);
     $soapBody->setAttribute('parts', 'req');
     $input->appendChild($soapBody);
     $operation->appendChild($input);
     $headers = $method->getHeaders();
     if (!$headers->isEmpty()) {
         foreach ($headers->all() as $part) {
             $soapHeader = $this->document->createElement($this->soapNs . ':header');
             $soapHeader->setAttribute('message', $this->typeNs . ':' . $headers->getName());
             $soapHeader->setAttribute('part', \SOAP_RPC === $this->style ? $part->getName() : 'parameters');
             $soapHeader->setAttribute('use', $use);
             $soapHeader->setAttribute('namespace', $this->namespace);
             $soapHeader->setAttribute('encodingStyle', $this->getEncodingStyle());
             $input->appendChild($soapHeader);
         }
     }
     $output = $this->document->createElement(Dumper::WSDL_NS . ':output');
     $soapOutputBody = $this->document->createElement($this->soapNs . ':body');
     $soapOutputBody->setAttribute('use', $use);
     $soapOutputBody->setAttribute('parts', 'resp');
     $output->appendChild($soapOutputBody);
     $operation->appendChild($output);
     $fault = $this->document->createElement(Dumper::WSDL_NS . ':fault');
     $fault->setAttribute('name', 'fault');
     $soapFaultBody = $this->document->createElement($this->soapNs . ':fault');
     $soapFaultBody->setAttribute('use', $use);
     $soapFaultBody->setAttribute('name', 'fault');
     $fault->appendChild($soapFaultBody);
     $operation->appendChild($fault);
 }
Example #3
0
 public function addOperation(Method $method)
 {
     $operation = $this->document->createElement('operation');
     $operation->setAttribute('name', $method->getName());
     $soapOperation = $this->document->createElement($this->soapNs . ':operation');
     $soapOperation->setAttribute('soapAction', $this->namespace . $method->getName());
     $operation->appendChild($soapOperation);
     $this->getBindingNode()->appendChild($operation);
     $use = \SOAP_LITERAL === $method->getUse() ? 'literal' : 'encoded';
     $input = $this->document->createElement('input');
     $operation->appendChild($input);
     $soapBody = $this->document->createElement($this->soapNs . ':body');
     $soapBody->setAttribute('use', $use);
     $soapBody->setAttribute('namespace', $this->namespace);
     $soapBody->setAttribute('encodingStyle', $this->getEncodingStyle());
     $input->appendChild($soapBody);
     $headers = $method->getHeaders();
     if (!$headers->isEmpty()) {
         foreach ($headers->all() as $part) {
             $soapHeader = $this->document->createElement($this->soapNs . ':header');
             $soapHeader->setAttribute('part', $part->getName());
             $soapHeader->setAttribute('message', $this->typeNs . ':' . $headers->getName());
             $soapHeader->setAttribute('use', $use);
             $soapHeader->setAttribute('namespace', $this->namespace);
             $soapHeader->setAttribute('encodingStyle', $this->getEncodingStyle());
             $input->appendChild($soapHeader);
         }
     }
     $output = $this->document->createElement('output');
     $soapBody = $this->document->createElement($this->soapNs . ':body');
     $soapBody->setAttribute('use', $use);
     $soapBody->setAttribute('namespace', $this->namespace);
     $soapBody->setAttribute('encodingStyle', $this->getEncodingStyle());
     $output->appendChild($soapBody);
     $operation->appendChild($output);
 }
Example #4
0
 protected function addPortOperation(Method $method)
 {
     $operation = $this->document->createElement('operation');
     $operation->setAttribute('name', $method->getName());
     foreach (array('input' => $method->getInput(), 'output' => $method->getOutput(), 'fault' => $method->getFault()) as $type => $message) {
         if ('fault' === $type && $message->isEmpty()) {
             continue;
         }
         $node = $this->document->createElement($type);
         $node->setAttribute('message', static::TYPES_NS . ':' . $message->getName());
         $operation->appendChild($node);
     }
     $this->domPortType->appendChild($operation);
     return $operation;
 }
Example #5
0
 public function __construct($name, $controller)
 {
     parent::__construct($name);
     $this->controller = $controller;
 }
 public function addMethod(Method $method)
 {
     $name = $method->getName();
     if (isset($this->methods[$name])) {
         throw new \Exception(sprintf('The method "%s" already exists', $name));
     }
     $this->methods[$name] = $method;
     return $method;
 }