Replaced QName->getNamespace() by ServiceDefinition->getNamespace() for headers

This commit is contained in:
Francis Besset 2011-09-01 19:40:44 +02:00
parent 57b35c5e62
commit 958efd3431
3 changed files with 8 additions and 8 deletions

View File

@ -22,6 +22,8 @@ Controller
public function helloAction(array $names)
{
$soapHeaders = $this->container->get('request')->getSoapHeaders();
// You can use '1234' !== (string) $soapHeaders->get('api_key')
if (!$soapHeaders->has('api_key') || '1234' !== $soapHeaders->get('api_key')->getData()) {
throw new \SoapFault("INVALID_API_KEY", "The api_key is invalid.");
}

View File

@ -67,7 +67,7 @@ class ServiceBinder
$this->requestHeaderMessageBinder->setHeader($header);
$data = $this->requestHeaderMessageBinder->processMessage($methodDefinition, $data, $this->definition->getDefinitionComplexTypes());
return $this->createSoapHeader($headerDefinition, $data);
return new SoapHeader($this->definition->getNamespace(), $headerDefinition->getName(), $data);
}
public function processServiceMethodArguments($method, $arguments)
@ -86,11 +86,4 @@ class ServiceBinder
return $this->responseMessageBinder->processMessage($methodDefinition, $return, $this->definition->getDefinitionComplexTypes());
}
protected function createSoapHeader(Header $headerDefinition, $data)
{
$qname = QName::fromPackedQName($headerDefinition->getType()->getXmlType());
return new SoapHeader($qname->getNamespace(), $headerDefinition->getName(), $data);
}
}

View File

@ -23,6 +23,11 @@ class SoapHeader
$this->data = $data;
}
public function __toString()
{
return $this->data;
}
public function getNamespace()
{
return $this->namespace;