loadServiceDefinition($definition); $this->definition = $definition; $this->definitionDumper = $dumper; $this->requestMessageBinder = $requestMessageBinder; $this->responseMessageBinder = $responseMessageBinder; } public function getSerializedServiceDefinition() { // TODO: add caching return $this->definitionDumper->dumpServiceDefinition($this->definition); } public function isServiceHeader($name) { return $this->definition->getHeaders()->has($name); } public function isServiceMethod($name) { return $this->definition->getMethods()->has($name); } public function processServiceHeader($name, $data) { $headerDefinition = $this->definition->getHeaders()->get($name); return $this->createSoapHeader($headerDefinition, $data); } public function processServiceMethodArguments($name, $arguments) { $methodDefinition = $this->definition->getMethods()->get($name); $result = array(); $result['_controller'] = $methodDefinition->getController(); $result = array_merge($result, $this->requestMessageBinder->processMessage($methodDefinition, $arguments)); return $result; } public function processServiceMethodReturnValue($name, $return) { $methodDefinition = $this->definition->getMethods()->get($name); return $this->responseMessageBinder->processMessage($methodDefinition, $return); } protected function createSoapHeader(Header $headerDefinition, $data) { if(!preg_match('/^\{(.+)\}(.+)$/', $headerDefinition->getType()->getXmlType(), $matches)) { throw new \InvalidArgumentException(); } return new SoapHeader($matches[1], $matches[2], $data); } }