The bundle is back!

The definition of service has changed, read the README.
This commit is contained in:
Francis Besset
2011-07-17 10:46:54 +02:00
parent 81118f8d47
commit 1c608ccf20
48 changed files with 641 additions and 535 deletions

View File

@ -12,14 +12,11 @@ namespace Bundle\WebServiceBundle\ServiceDefinition\Dumper;
use Bundle\WebServiceBundle\ServiceDefinition\Method;
use Bundle\WebServiceBundle\ServiceDefinition\ServiceDefinition;
use Bundle\WebServiceBundle\Util\Assert;
use Zend\Soap\Wsdl;
/**
*
* @author Christian Kerl <christian-kerl@web.de>
*/
class WsdlDumper implements DumperInterface
@ -28,22 +25,20 @@ class WsdlDumper implements DumperInterface
public function dumpServiceDefinition(ServiceDefinition $definition, array $options = array())
{
Assert::thatArgumentNotNull('definition', $definition);
$options = array_merge(array('endpoint' => ''), $options);
Assert::thatArgumentNotNull('definition', $definition);
$this->definition = $definition;
$wsdl = new Wsdl($definition->getName(), $definition->getNamespace());
$port = $wsdl->addPortType($this->getPortTypeName());
$binding = $wsdl->addBinding($this->getBindingName(), 'tns:' . $this->getPortTypeName());
$wsdl = new Wsdl($definition->getName(), $definition->getNamespace());
$port = $wsdl->addPortType($this->getPortTypeName());
$binding = $wsdl->addBinding($this->getBindingName(), 'tns:' . $this->getPortTypeName());
$wsdl->addSoapBinding($binding, 'rpc');
$wsdl->addService($this->getServiceName(), $this->getPortName(), 'tns:' . $this->getBindingName(), $options['endpoint']);
foreach($definition->getMethods() as $method) {
$requestParts = array();
$requestParts = array();
$responseParts = array();
foreach($method->getArguments() as $argument) {
@ -61,15 +56,15 @@ class WsdlDumper implements DumperInterface
$portOperation->setAttribute('parameterOrder', implode(' ', array_keys($requestParts)));
$bindingInput = array(
'parts' => implode(' ', array_keys($requestParts)),
'use' => 'literal',
'namespace' => $definition->getNamespace(),
'parts' => implode(' ', array_keys($requestParts)),
'use' => 'literal',
'namespace' => $definition->getNamespace(),
'encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/',
);
$bindingOutput = array(
'parts' => implode(' ', array_keys($responseParts)),
'use' => 'literal',
'namespace' => $definition->getNamespace(),
'parts' => implode(' ', array_keys($responseParts)),
'use' => 'literal',
'namespace' => $definition->getNamespace(),
'encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/',
);
@ -86,36 +81,36 @@ class WsdlDumper implements DumperInterface
protected function getPortName()
{
return $this->definition->getName() . 'Port';
return $this->definition->getName().'Port';
}
protected function getPortTypeName()
{
return $this->definition->getName() . 'PortType';
return $this->definition->getName().'PortType';
}
protected function getBindingName()
{
return $this->definition->getName() . 'Binding';
return $this->definition->getName().'Binding';
}
protected function getServiceName()
{
return $this->definition->getName() . 'Service';
return $this->definition->getName().'Service';
}
protected function getRequestMessageName(Method $method)
{
return $method->getName() . 'Request';
return $method->getName().'Request';
}
protected function getResponseMessageName(Method $method)
{
return $method->getName() . 'Response';
return $method->getName().'Response';
}
protected function getSoapOperationName(Method $method)
{
return $this->definition->getNamespace() . $method->getName();
return $this->definition->getNamespace().$method->getName();
}
}