Added soap client
This commit is contained in:
parent
e9864b1d02
commit
17fdd64489
@ -44,6 +44,10 @@ class BeSimpleSoapExtension extends Extension
|
||||
|
||||
$config = $processor->process($configuration->getConfigTree(), $configs);
|
||||
|
||||
if (isset($config['clients'])) {
|
||||
$this->registerClientConfiguration($config['clients'], $container, $loader);
|
||||
}
|
||||
|
||||
$container->setParameter('besimple.soap.definition.dumper.options.stylesheet', $config['wsdl_dumper']['stylesheet']);
|
||||
|
||||
foreach($config['services'] as $name => $serviceConfig) {
|
||||
@ -52,6 +56,18 @@ class BeSimpleSoapExtension extends Extension
|
||||
}
|
||||
}
|
||||
|
||||
private function registerClientConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
|
||||
{
|
||||
$loader->load('client.xml');
|
||||
|
||||
foreach ($config as $client => $options) {
|
||||
$definition = new DefinitionDecorator('besimple.soap.client');
|
||||
$context = $container->setDefinition(sprintf('besimple.soap.client.%s', $client), $definition);
|
||||
|
||||
$definition->replaceArgument(0, $options['wsdl']);
|
||||
}
|
||||
}
|
||||
|
||||
private function createWebServiceContext(array $config, ContainerBuilder $container)
|
||||
{
|
||||
$bindingSuffix = $this->bindingConfigToServiceSuffixMap[$config['binding']];
|
||||
|
@ -30,12 +30,30 @@ class Configuration
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$rootNode = $treeBuilder->root('be_simple_soap');
|
||||
|
||||
$this->addClientSection($rootNode);
|
||||
$this->addServicesSection($rootNode);
|
||||
$this->addWsdlDumperSection($rootNode);
|
||||
|
||||
return $treeBuilder->buildTree();
|
||||
}
|
||||
|
||||
private function addClientSection(ArrayNodeDefinition $rootNode)
|
||||
{
|
||||
$rootNode
|
||||
->children()
|
||||
->arrayNode('clients')
|
||||
->useAttributeAsKey('name')
|
||||
->prototype('array')
|
||||
->children()
|
||||
->scalarNode('wsdl')
|
||||
->isRequired()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
}
|
||||
|
||||
private function addServicesSection(ArrayNodeDefinition $rootNode)
|
||||
{
|
||||
$rootNode
|
||||
|
19
Resources/config/client.xml
Normal file
19
Resources/config/client.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<parameters>
|
||||
<parameter key="besimple.soap.client.class">BeSimple\SoapClient\Soap\SoapClient</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
<service id="besimple.soap.client" class="%besimple.soap.client.class%" abstract="true">
|
||||
<argument>wsdl</argument>
|
||||
<argument type="collection">
|
||||
<argument key="debug">%kernel.debug%</argument>
|
||||
</argument>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
</container>
|
Loading…
Reference in New Issue
Block a user