Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide abstract Soap client builder and client even if no clients are configured and add composer.json #21

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions DependencyInjection/BeSimpleSoapExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand Down
2 changes: 1 addition & 1 deletion ServiceBinding/RpcLiteralRequestMessageBinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
11 changes: 11 additions & 0 deletions ServiceDefinition/Annotation/ComplexType.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ComplexType extends Configuration
private $name;
private $value;
private $isNillable = false;
private $minOccurs = 1;

public function getName()
{
Expand Down Expand Up @@ -53,4 +54,14 @@ public function getAliasName()
{
return 'complextype';
}

public function getMinOccurs()
{
return $this->minOccurs;
}

public function setMinOccurs($minOccurs)
{
$this->minOccurs = (int) $minOccurs;
}
}
13 changes: 13 additions & 0 deletions ServiceDefinition/ComplexType.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ComplexType
private $name;
private $value;
private $isNillable = false;
private $minOccurs = 1;

public function getName()
{
Expand Down Expand Up @@ -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;
}
}
}
6 changes: 5 additions & 1 deletion ServiceDefinition/Dumper/WsdlDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(AnnotationComplexTypeLoader $loader, TypeRepository
}

public function dumpServiceDefinition(ServiceDefinition $definition, $endpoint)
{
{
Assert::thatArgumentNotNull('definition', $definition);

$this->definition = $definition;
Expand Down Expand Up @@ -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(
Expand Down
6 changes: 4 additions & 2 deletions ServiceDefinition/Loader/AnnotationClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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());
}
}

Expand Down Expand Up @@ -185,7 +187,7 @@ public function supports($resource, $type = null)
*
* @param LoaderResolver $resolver A LoaderResolver instance
*/
public function setResolver(LoaderResolver $resolver)
public function setResolver(LoaderResolverInterface $resolver)
{
}

Expand Down
1 change: 1 addition & 0 deletions ServiceDefinition/Loader/AnnotationComplexTypeLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
11 changes: 11 additions & 0 deletions ServiceDefinition/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}
}
4 changes: 4 additions & 0 deletions ServiceDefinition/Strategy/ComplexType.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public function addComplexType($type)
$element->setAttribute('nillable', 'true');
}

if (1 !== $annotationComplexType->getMinOccurs()) {
$element->setAttribute('minOccurs', $annotationComplexType->getMinOccurs());
}

$all->appendChild($element);
}

Expand Down
28 changes: 28 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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": "[email protected]"
}
],
"require": {
"php": ">=5.3.0",
"besimple/soap-common": "*"
},
"suggest": {
"besimple/soap-client": "*",
"besimple/soap-server": "*"
},
"autoload": {
"psr-0": { "BeSimple\\SoapBundle": "" }
},
"target-dir": "BeSimple/SoapBundle"
}