From ffddeb5a6ff0284a086cbfa3e3f1281d73d0217c Mon Sep 17 00:00:00 2001 From: David de Boer Date: Fri, 2 Dec 2011 13:40:57 +0100 Subject: [PATCH 1/6] Always load client configuration --- DependencyInjection/BeSimpleSoapExtension.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/DependencyInjection/BeSimpleSoapExtension.php b/DependencyInjection/BeSimpleSoapExtension.php index 941cbf0..053aa42 100644 --- a/DependencyInjection/BeSimpleSoapExtension.php +++ b/DependencyInjection/BeSimpleSoapExtension.php @@ -51,9 +51,7 @@ public function load(array $configs, ContainerBuilder $container) $this->registerCacheConfiguration($config['cache'], $container, $loader); - if (!empty($config['clients'])) { - $this->registerClientConfiguration($config['clients'], $container, $loader); - } + $this->registerClientConfiguration($config['clients'], $container, $loader); $container->setParameter('besimple.soap.definition.dumper.options.stylesheet', $config['wsdl_dumper']['stylesheet']); From de6ad70aff1bd3d7a8e60d44f263b84d9daf7900 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Sun, 4 Dec 2011 14:38:53 +0100 Subject: [PATCH 2/6] Add composer.json --- composer.json | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 composer.json diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..f449ca8 --- /dev/null +++ b/composer.json @@ -0,0 +1,28 @@ +{ + "name": "besimple/soap-bundle", + "type": "symfony-bundle", + "description": "Build and consume SOAP and WSDL based web services with Symfony2", + "keywords": [ "soap" ], + "homepage": "http://besim.pl/SoapBundle/", + "authors": [ + { + "name": "Christian Kerl" + }, + { + "name": "Francis Besset", + "email": "francis.besset@gmail.com" + } + ], + "require": { + "php": ">=5.3.0", + "besimple/soap-common": "*" + }, + "suggest": { + "besimple/soap-client": "*", + "besimple/soap-server": "*" + }, + "autoload": { + "psr-0": { "BeSimple\\SoapBundle": "" } + }, + "target-dir": "BeSimple/SoapBundle" +} \ No newline at end of file From 129897574c7d91fce97fce4af1b56f1ef13f8f24 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 20 Dec 2011 20:46:52 +0100 Subject: [PATCH 3/6] Add minOccurs option to complexType --- ServiceDefinition/Annotation/ComplexType.php | 11 +++++++++++ ServiceDefinition/ComplexType.php | 13 +++++++++++++ .../Loader/AnnotationComplexTypeLoader.php | 1 + ServiceDefinition/Strategy/ComplexType.php | 4 ++++ 4 files changed, 29 insertions(+) diff --git a/ServiceDefinition/Annotation/ComplexType.php b/ServiceDefinition/Annotation/ComplexType.php index 85072d4..a2eeff7 100644 --- a/ServiceDefinition/Annotation/ComplexType.php +++ b/ServiceDefinition/Annotation/ComplexType.php @@ -18,6 +18,7 @@ class ComplexType extends Configuration private $name; private $value; private $isNillable = false; + private $minOccurs = 1; public function getName() { @@ -53,4 +54,14 @@ public function getAliasName() { return 'complextype'; } + + public function getMinOccurs() + { + return $this->minOccurs; + } + + public function setMinOccurs($minOccurs) + { + $this->minOccurs = (int) $minOccurs; + } } \ No newline at end of file diff --git a/ServiceDefinition/ComplexType.php b/ServiceDefinition/ComplexType.php index 2d78bbe..e36dbd2 100644 --- a/ServiceDefinition/ComplexType.php +++ b/ServiceDefinition/ComplexType.php @@ -18,6 +18,7 @@ class ComplexType private $name; private $value; private $isNillable = false; + private $minOccurs = 1; public function getName() { @@ -48,4 +49,16 @@ public function setNillable($isNillable) { $this->isNillable = (bool) $isNillable; } + + public function getMinOccurs() + { + return $this->minOccurs; + } + + public function setMinOccurs($minOccurs) + { + if (null !== $minOccurs) { + $this->minOccurs = (int) $minOccurs; + } + } } \ No newline at end of file diff --git a/ServiceDefinition/Loader/AnnotationComplexTypeLoader.php b/ServiceDefinition/Loader/AnnotationComplexTypeLoader.php index 0cc7579..9230906 100644 --- a/ServiceDefinition/Loader/AnnotationComplexTypeLoader.php +++ b/ServiceDefinition/Loader/AnnotationComplexTypeLoader.php @@ -50,6 +50,7 @@ public function load($class, $type = null) $propertyComplexType = new ComplexType(); $propertyComplexType->setValue($complexType->getValue()); $propertyComplexType->setNillable($complexType->isNillable()); + $propertyComplexType->setMinOccurs($complexType->getMinOccurs()); $propertyComplexType->setName($property->getName()); $collection->add($propertyComplexType); } diff --git a/ServiceDefinition/Strategy/ComplexType.php b/ServiceDefinition/Strategy/ComplexType.php index b608902..060aed0 100644 --- a/ServiceDefinition/Strategy/ComplexType.php +++ b/ServiceDefinition/Strategy/ComplexType.php @@ -75,6 +75,10 @@ public function addComplexType($type) $element->setAttribute('nillable', 'true'); } + if (1 !== $annotationComplexType->getMinOccurs()) { + $element->setAttribute('minOccurs', $annotationComplexType->getMinOccurs()); + } + $all->appendChild($element); } From ea1f62a72d0aec7be57fca6e927a93c589e96845 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 20 Dec 2011 21:44:29 +0100 Subject: [PATCH 4/6] Make nillable properties be accepted --- ServiceBinding/RpcLiteralRequestMessageBinder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ServiceBinding/RpcLiteralRequestMessageBinder.php b/ServiceBinding/RpcLiteralRequestMessageBinder.php index edef394..e7a91a6 100644 --- a/ServiceBinding/RpcLiteralRequestMessageBinder.php +++ b/ServiceBinding/RpcLiteralRequestMessageBinder.php @@ -54,7 +54,7 @@ protected function processType($phpType, $message) } // @TODO Fix array reference - if (isset($this->definitionComplexTypes[$phpType])) { + if (isset($this->definitionComplexTypes[$phpType]) && $message) { if ($isArray) { if (isset($message->item)) { foreach ($message->item as $complexType) { From a524b9110183102cd7641d88d5714665b8ff92b4 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Tue, 27 Mar 2012 17:01:11 +0200 Subject: [PATCH 5/6] Make AnnotationClassLoader compatible with Symfony interface --- ServiceDefinition/Loader/AnnotationClassLoader.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ServiceDefinition/Loader/AnnotationClassLoader.php b/ServiceDefinition/Loader/AnnotationClassLoader.php index d76ec56..7427f20 100644 --- a/ServiceDefinition/Loader/AnnotationClassLoader.php +++ b/ServiceDefinition/Loader/AnnotationClassLoader.php @@ -16,7 +16,7 @@ use Doctrine\Common\Annotations\Reader; use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\Loader\LoaderResolver; +use Symfony\Component\Config\Loader\LoaderResolverInterface; /** * AnnotationClassLoader loads ServiceDefinition from a PHP class and its methods. @@ -185,7 +185,7 @@ public function supports($resource, $type = null) * * @param LoaderResolver $resolver A LoaderResolver instance */ - public function setResolver(LoaderResolver $resolver) + public function setResolver(LoaderResolverInterface $resolver) { } From af985d8bd3970d513c9862883ec25b19815cdc79 Mon Sep 17 00:00:00 2001 From: David de Boer Date: Thu, 29 Mar 2012 13:22:41 +0200 Subject: [PATCH 6/6] Add documentation support for operations --- ServiceDefinition/Dumper/WsdlDumper.php | 6 +++++- ServiceDefinition/Loader/AnnotationClassLoader.php | 2 ++ ServiceDefinition/Method.php | 11 +++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ServiceDefinition/Dumper/WsdlDumper.php b/ServiceDefinition/Dumper/WsdlDumper.php index abe64c3..588caec 100644 --- a/ServiceDefinition/Dumper/WsdlDumper.php +++ b/ServiceDefinition/Dumper/WsdlDumper.php @@ -38,7 +38,7 @@ public function __construct(AnnotationComplexTypeLoader $loader, TypeRepository } public function dumpServiceDefinition(ServiceDefinition $definition, $endpoint) - { + { Assert::thatArgumentNotNull('definition', $definition); $this->definition = $definition; @@ -79,6 +79,10 @@ public function dumpServiceDefinition(ServiceDefinition $definition, $endpoint) $this->qualify($this->getResponseMessageName($method)) ); + if ($method->getDocumentation()) { + $this->wsdl->addDocumentation($portOperation, $method->getDocumentation()); + } + $baseBinding = $inputBinding = $outputBinding = array( diff --git a/ServiceDefinition/Loader/AnnotationClassLoader.php b/ServiceDefinition/Loader/AnnotationClassLoader.php index 7427f20..57bb6a9 100644 --- a/ServiceDefinition/Loader/AnnotationClassLoader.php +++ b/ServiceDefinition/Loader/AnnotationClassLoader.php @@ -104,6 +104,8 @@ public function load($class, $type = null) } $serviceReturn = new Definition\Type($annotation->getPhpType(), $annotation->getXmlType()); + } elseif ($annotation instanceof Annotation\Documentation) { + $serviceMethod->setDocumentation($annotation->getValue()); } } diff --git a/ServiceDefinition/Method.php b/ServiceDefinition/Method.php index a03053f..61e6023 100644 --- a/ServiceDefinition/Method.php +++ b/ServiceDefinition/Method.php @@ -19,6 +19,7 @@ class Method private $arguments; private $headers; private $return; + private $documentation; public function __construct($name = null, $controller = null, array $headers = array(), array $arguments = array(), Type $return = null) { @@ -83,4 +84,14 @@ public function setReturn(Type $return) { $this->return = $return; } + + public function getDocumentation() + { + return $this->documentation; + } + + public function setDocumentation($documentation) + { + $this->documentation = $documentation; + } } \ No newline at end of file