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); }
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); }