Cleaned files
This commit is contained in:
parent
7ddf05cec1
commit
51d1d28830
@ -30,7 +30,7 @@ use Bundle\WebServiceBundle\Converter\ConverterRepository;
|
||||
use Bundle\WebServiceBundle\Util\String;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author Christian Kerl <christian-kerl@web.de>
|
||||
*/
|
||||
@ -84,7 +84,7 @@ class SoapWebServiceController extends ContainerAware
|
||||
$this->soapRequest = SoapRequest::createFromHttpRequest($this->container->get('request'));
|
||||
|
||||
$this->serviceBinder = $webServiceContext->getServiceBinder();
|
||||
|
||||
|
||||
$this->soapServer = $webServiceContext->getServerFactory()->create($this->soapRequest, $this->soapResponse);
|
||||
$this->soapServer->setObject($this);
|
||||
|
||||
@ -93,31 +93,28 @@ class SoapWebServiceController extends ContainerAware
|
||||
$this->soapServer->handle($this->soapRequest->getSoapMessage());
|
||||
}
|
||||
$soapResponseContent = ob_get_clean();
|
||||
|
||||
|
||||
$this->soapResponse->setContent($soapResponseContent);
|
||||
|
||||
return $this->soapResponse;
|
||||
}
|
||||
|
||||
public function definition($webservice)
|
||||
{
|
||||
{
|
||||
$webServiceContext = $this->container->get('webservice.context.' . $webservice);
|
||||
$request = $this->container->get('request');
|
||||
|
||||
if($request->query->has('WSDL'))
|
||||
{
|
||||
$request = $this->container->get('request');
|
||||
|
||||
if($request->query->has('WSDL')) {
|
||||
$endpoint = $this->container->get('router')->generate('_webservice_call', array('webservice' => $webservice), true);
|
||||
|
||||
|
||||
$response = new Response($webServiceContext->getWsdlFileContent($endpoint));
|
||||
$response->headers->set('Content-Type', 'application/wsdl+xml');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// TODO: replace with better represantation
|
||||
$response = new Response($webServiceContext->getWsdlFileContent());
|
||||
$response->headers->set('Content-Type', 'text/xml');
|
||||
}
|
||||
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -132,8 +129,7 @@ class SoapWebServiceController extends ContainerAware
|
||||
*/
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
if($this->serviceBinder->isServiceHeader($method))
|
||||
{
|
||||
if($this->serviceBinder->isServiceHeader($method)) {
|
||||
// collect request soap headers
|
||||
$this->soapRequest->getSoapHeaders()->add(
|
||||
$this->serviceBinder->processServiceHeader($method, $arguments[0])
|
||||
@ -142,8 +138,7 @@ class SoapWebServiceController extends ContainerAware
|
||||
return;
|
||||
}
|
||||
|
||||
if($this->serviceBinder->isServiceMethod($method))
|
||||
{
|
||||
if($this->serviceBinder->isServiceMethod($method)) {
|
||||
$this->soapRequest->attributes->add(
|
||||
$this->serviceBinder->processServiceMethodArguments($method, $arguments)
|
||||
);
|
||||
@ -154,8 +149,7 @@ class SoapWebServiceController extends ContainerAware
|
||||
$this->soapResponse = $this->checkResponse($response);
|
||||
|
||||
// add response soap headers to soap server
|
||||
foreach($this->soapResponse->getSoapHeaders() as $header)
|
||||
{
|
||||
foreach($this->soapResponse->getSoapHeaders() as $header) {
|
||||
$this->soapServer->addSoapHeader($header->toNativeSoapHeader());
|
||||
}
|
||||
|
||||
@ -178,11 +172,10 @@ class SoapWebServiceController extends ContainerAware
|
||||
*/
|
||||
protected function checkResponse(Response $response)
|
||||
{
|
||||
if($response == null || !$response instanceof SoapResponse)
|
||||
{
|
||||
if($response == null || !$response instanceof SoapResponse) {
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
}
|
@ -38,11 +38,5 @@ class ConverterRepository
|
||||
|
||||
public function registerTypeConverterServices(ContainerInterface $container)
|
||||
{
|
||||
/*
|
||||
foreach($container->findTaggedServiceIds('webservice.converter') as $id => $attributes)
|
||||
{
|
||||
$this->addTypeConverter($container->get($id));
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
@ -27,4 +27,4 @@ interface TypeConverterInterface
|
||||
function convertXmlToPhp(SoapRequest $request, $data);
|
||||
|
||||
function convertPhpToXml(SoapResponse $response, $data);
|
||||
}
|
||||
}
|
@ -42,8 +42,7 @@ class XopIncludeTypeConverter implements TypeConverterInterface
|
||||
|
||||
$ref = $include->getAttribute('href');
|
||||
|
||||
if(String::startsWith($ref, 'cid:'))
|
||||
{
|
||||
if(String::startsWith($ref, 'cid:')) {
|
||||
$cid = urldecode(substr($ref, 4));
|
||||
|
||||
return $request->getSoapAttachments()->get($cid)->getContent();
|
||||
@ -56,4 +55,4 @@ class XopIncludeTypeConverter implements TypeConverterInterface
|
||||
{
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
@ -61,4 +61,4 @@ class Configuration
|
||||
|
||||
return $treeBuilder->buildTree();
|
||||
}
|
||||
}
|
||||
}
|
@ -31,21 +31,20 @@ class WebServiceExtension extends Extension
|
||||
{
|
||||
// maps config options to service suffix'
|
||||
private $bindingConfigToServiceSuffixMap = array('rpc-literal' => '.rpcliteral', 'document-wrapped' => '.documentwrapped');
|
||||
|
||||
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
|
||||
$loader->load('annotations.xml');
|
||||
$loader->load('webservice.xml');
|
||||
|
||||
|
||||
$processor = new Processor();
|
||||
$configuration = new Configuration();
|
||||
|
||||
$config = $processor->process($configuration->getConfigTree(), $configs);
|
||||
|
||||
foreach($config['services'] as $serviceContextConfig)
|
||||
{
|
||||
|
||||
foreach($config['services'] as $serviceContextConfig) {
|
||||
$this->createWebServiceContext($serviceContextConfig, $container);
|
||||
}
|
||||
}
|
||||
@ -55,20 +54,19 @@ class WebServiceExtension extends Extension
|
||||
$bindingDependentArguments = array(1, 3, 4);
|
||||
$bindingSuffix = $this->bindingConfigToServiceSuffixMap[$config['binding']];
|
||||
unset($config['binding']);
|
||||
|
||||
|
||||
$contextPrototype = $container->getDefinition('webservice.context');
|
||||
$contextPrototypeArguments = $contextPrototype->getArguments();
|
||||
|
||||
|
||||
$contextId = 'webservice.context.' . $config['name'];
|
||||
$context = $container->setDefinition($contextId, new DefinitionDecorator('webservice.context'));
|
||||
|
||||
foreach($bindingDependentArguments as $idx)
|
||||
{
|
||||
|
||||
foreach($bindingDependentArguments as $idx) {
|
||||
$context->setArgument($idx, new Reference($contextPrototypeArguments[$idx] . $bindingSuffix));
|
||||
}
|
||||
$context->setArgument(5, array_merge($contextPrototypeArguments[5], $config));
|
||||
}
|
||||
|
||||
|
||||
public function getNamespace()
|
||||
{
|
||||
return null;
|
||||
|
@ -15,15 +15,15 @@ QuickStart
|
||||
|
||||
* Put WebServiceBundle in your `src/Bundle` dir
|
||||
* Enable WebServiceBundle in your `app/AppKernel.php`
|
||||
|
||||
|
||||
* Include the WebServiceBundle's routing configuration in `app/config/routing.yml` (you can choose the prefix arbitrarily)
|
||||
|
||||
|
||||
_ws:
|
||||
resource: "@WebServiceBundle/Resources/config/routing/webservicecontroller.xml"
|
||||
prefix: /ws
|
||||
|
||||
|
||||
* Configure your first web service in `app/config/config.yml`
|
||||
|
||||
|
||||
web_service:
|
||||
services:
|
||||
demoapi:
|
||||
|
@ -4,12 +4,13 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
|
||||
|
||||
<route id="_webservice_call" pattern="/{webservice}">
|
||||
<default key="_controller">webservice.controller:call</default>
|
||||
<requirement key="_method">POST</requirement>
|
||||
</route>
|
||||
<route id="_webservice_definition" pattern="/{webservice}">
|
||||
<default key="_controller">webservice.controller:definition</default>
|
||||
<requirement key="_method">GET</requirement>
|
||||
</route>
|
||||
<route id="_webservice_call" pattern="/{webservice}">
|
||||
<default key="_controller">webservice.controller:call</default>
|
||||
<requirement key="_method">POST</requirement>
|
||||
</route>
|
||||
|
||||
<route id="_webservice_definition" pattern="/{webservice}">
|
||||
<default key="_controller">webservice.controller:definition</default>
|
||||
<requirement key="_method">GET</requirement>
|
||||
</route>
|
||||
</routes>
|
||||
|
@ -3,57 +3,48 @@
|
||||
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="webservice.file_locator.class">Symfony\Component\HttpKernel\Config\FileLocator</parameter>
|
||||
|
||||
<parameters>
|
||||
<parameter key="webservice.file_locator.class">Symfony\Component\HttpKernel\Config\FileLocator</parameter>
|
||||
|
||||
<parameter key="webservice.cache_dir">%kernel.cache_dir%/webservice</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
<service id="webservice.controller" class="Bundle\WebServiceBundle\Controller\SoapWebServiceController">
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
<service id="webservice.controller" class="Bundle\WebServiceBundle\Controller\SoapWebServiceController">
|
||||
<argument type="service" id="service_container" />
|
||||
<argument type="service" id="http_kernel" />
|
||||
</service>
|
||||
|
||||
<service id="webservice.context" class="Bundle\WebServiceBundle\WebServiceContext" abstract="true">
|
||||
|
||||
<argument type="service" id="webservice.definition.loader"/>
|
||||
<argument type="service" id="webservice.definition.dumper.wsdl"/>
|
||||
</service>
|
||||
|
||||
<service id="webservice.context" class="Bundle\WebServiceBundle\WebServiceContext" abstract="true">
|
||||
<argument type="service" id="webservice.definition.loader"/>
|
||||
<argument type="service" id="webservice.definition.dumper.wsdl"/>
|
||||
<argument type="service" id="webservice.converter.repository"/>
|
||||
<argument type="service" id="webservice.binder.request"/>
|
||||
<argument type="service" id="webservice.binder.response"/>
|
||||
|
||||
|
||||
<argument type="collection">
|
||||
<!--
|
||||
<argument key="name">%webservice.name%</argument>
|
||||
<argument key="namespace">%webservice.namespace%</argument>
|
||||
|
||||
<argument key="resource">%webservice.resource%</argument>
|
||||
<argument key="resource_type">%webservice.resource_type%</argument>
|
||||
-->
|
||||
<argument key="cache_dir">%webservice.cache_dir%</argument>
|
||||
</argument>
|
||||
|
||||
</service>
|
||||
|
||||
<service id="webservice.binder.request.rpcliteral" class="Bundle\WebServiceBundle\ServiceBinding\RpcLiteralRequestMessageBinder" />
|
||||
<service id="webservice.binder.response.rpcliteral" class="Bundle\WebServiceBundle\ServiceBinding\RpcLiteralResponseMessageBinder" />
|
||||
</service>
|
||||
|
||||
<service id="webservice.binder.request.rpcliteral" class="Bundle\WebServiceBundle\ServiceBinding\RpcLiteralRequestMessageBinder" />
|
||||
<service id="webservice.binder.response.rpcliteral" class="Bundle\WebServiceBundle\ServiceBinding\RpcLiteralResponseMessageBinder" />
|
||||
<service id="webservice.binder.request.documentwrapped" class="Bundle\WebServiceBundle\ServiceBinding\DocumentLiteralWrappedRequestMessageBinder" />
|
||||
<service id="webservice.binder.response.documentwrapped" class="Bundle\WebServiceBundle\ServiceBinding\DocumentLiteralWrappedResponseMessageBinder" />
|
||||
|
||||
<service id="webservice.converter.repository" class="Bundle\WebServiceBundle\Converter\ConverterRepository">
|
||||
<call method="registerTypeConverterServices">
|
||||
<argument type="service" id="service_container" />
|
||||
</call>
|
||||
</service>
|
||||
|
||||
|
||||
<service id="webservice.converter.repository" class="Bundle\WebServiceBundle\Converter\ConverterRepository">
|
||||
<call method="registerTypeConverterServices">
|
||||
<argument type="service" id="service_container" />
|
||||
</call>
|
||||
</service>
|
||||
|
||||
<service id="webservice.file_locator" class="%webservice.file_locator.class%" public="false">
|
||||
<argument type="service" id="kernel" />
|
||||
</service>
|
||||
|
||||
<!-- TODO: replace with delegating loader -->
|
||||
|
||||
<!-- TODO: replace with delegating loader -->
|
||||
<service id="webservice.definition.loader" alias="webservice.definition.loader.annot_file" />
|
||||
|
||||
|
||||
<service id="webservice.definition.loader.annot_file" class="Bundle\WebServiceBundle\ServiceDefinition\Loader\AnnotationFileLoader">
|
||||
<tag name="webservice.definition.loader" />
|
||||
<argument type="service" id="webservice.file_locator" />
|
||||
@ -65,14 +56,9 @@
|
||||
<argument type="service" id="webservice.annotations.reader" />
|
||||
<argument type="service" id="annotations.configuration_reader" />
|
||||
</service>
|
||||
|
||||
<service id="webservice.definition.dumper.wsdl.rpcliteral" class="Bundle\WebServiceBundle\ServiceDefinition\Dumper\WsdlDumper">
|
||||
|
||||
</service>
|
||||
<!--
|
||||
<service id="webservice.definition.dumper.wsdl.documentwrapped" class="">
|
||||
<service id="webservice.definition.dumper.wsdl.rpcliteral" class="Bundle\WebServiceBundle\ServiceDefinition\Dumper\WsdlDumper">
|
||||
|
||||
</service>
|
||||
-->
|
||||
</services>
|
||||
</container>
|
||||
</services>
|
||||
</container>
|
@ -16,16 +16,14 @@ class DocumentLiteralWrappedRequestMessageBinder implements MessageBinderInterfa
|
||||
{
|
||||
public function processMessage(Method $messageDefinition, $message)
|
||||
{
|
||||
if(count($message) > 1)
|
||||
{
|
||||
if(count($message) > 1) {
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$message = $message[0];
|
||||
|
||||
foreach($messageDefinition->getArguments() as $argument)
|
||||
{
|
||||
foreach($messageDefinition->getArguments() as $argument) {
|
||||
$result[$argument->getName()] = $message->{$argument->getName()};
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,6 @@ use Bundle\WebServiceBundle\ServiceDefinition\Method;
|
||||
interface MessageBinderInterface
|
||||
{
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param Method $messageDefinition
|
||||
* @param mixed $message
|
||||
*
|
||||
|
@ -19,9 +19,9 @@ class RpcLiteralRequestMessageBinder implements MessageBinderInterface
|
||||
$result = array();
|
||||
$i = 0;
|
||||
|
||||
foreach($messageDefinition->getArguments() as $argument)
|
||||
{
|
||||
foreach($messageDefinition->getArguments() as $argument) {
|
||||
$result[$argument->getName()] = $message[$i];
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
@ -14,18 +14,18 @@ class Method
|
||||
{
|
||||
private $name;
|
||||
private $service;
|
||||
|
||||
|
||||
public function __construct($values)
|
||||
{
|
||||
$this->name = isset($values['value']) ? $values['value'] : null;
|
||||
$this->service = isset($values['service']) ? $values['service'] : null;
|
||||
}
|
||||
|
||||
|
||||
public function getName($default = null)
|
||||
{
|
||||
return $this->name !== null ? $this->name : $default;
|
||||
}
|
||||
|
||||
|
||||
public function getService()
|
||||
{
|
||||
return $this->service;
|
||||
|
@ -13,14 +13,14 @@ namespace Bundle\WebServiceBundle\ServiceDefinition\Annotation;
|
||||
class Param extends TypedElement
|
||||
{
|
||||
private $name;
|
||||
|
||||
|
||||
public function __construct($values)
|
||||
{
|
||||
parent::__construct($values);
|
||||
|
||||
|
||||
$this->name = $values['value'];
|
||||
}
|
||||
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
|
@ -11,7 +11,7 @@
|
||||
namespace Bundle\WebServiceBundle\ServiceDefinition\Annotation;
|
||||
|
||||
class Result extends TypedElement
|
||||
{
|
||||
{
|
||||
public function __construct($values)
|
||||
{
|
||||
parent::__construct($values);
|
||||
|
@ -14,7 +14,7 @@ abstract class TypedElement
|
||||
{
|
||||
private $phpType;
|
||||
private $xmlType;
|
||||
|
||||
|
||||
public function __construct($values)
|
||||
{
|
||||
foreach(array('type', 'phpType') as $key)
|
||||
@ -24,15 +24,15 @@ abstract class TypedElement
|
||||
$this->phpType = $values[$key];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->xmlType = isset($values['xmlType']) ? $values['xmlType'] : null;
|
||||
}
|
||||
|
||||
|
||||
public function getPhpType()
|
||||
{
|
||||
return $this->phpType;
|
||||
}
|
||||
|
||||
|
||||
public function getXmlType()
|
||||
{
|
||||
return $this->xmlType;
|
||||
|
@ -25,35 +25,32 @@ use Zend\Soap\Wsdl;
|
||||
class WsdlDumper implements DumperInterface
|
||||
{
|
||||
private $definition;
|
||||
|
||||
|
||||
public function dumpServiceDefinition(ServiceDefinition $definition, array $options = array())
|
||||
{
|
||||
Assert::thatArgumentNotNull('definition', $definition);
|
||||
|
||||
$options = array_merge(array('endpoint' => ''), $options);
|
||||
|
||||
|
||||
$this->definition = $definition;
|
||||
|
||||
$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)
|
||||
{
|
||||
foreach($definition->getMethods() as $method) {
|
||||
$requestParts = array();
|
||||
$responseParts = array();
|
||||
|
||||
foreach($method->getArguments() as $argument)
|
||||
{
|
||||
foreach($method->getArguments() as $argument) {
|
||||
$requestParts[$argument->getName()] = $wsdl->getType($argument->getType()->getPhpType());
|
||||
}
|
||||
|
||||
if($method->getReturn() !== null)
|
||||
{
|
||||
if($method->getReturn() !== null) {
|
||||
$responseParts['return'] = $wsdl->getType($method->getReturn()->getPhpType());
|
||||
}
|
||||
|
||||
@ -83,7 +80,7 @@ class WsdlDumper implements DumperInterface
|
||||
$this->definition = null;
|
||||
|
||||
$wsdl->toDomDocument()->formatOutput = true;
|
||||
|
||||
|
||||
return $wsdl->toXml();
|
||||
}
|
||||
|
||||
@ -91,7 +88,7 @@ class WsdlDumper implements DumperInterface
|
||||
{
|
||||
return $this->definition->getName() . 'Port';
|
||||
}
|
||||
|
||||
|
||||
protected function getPortTypeName()
|
||||
{
|
||||
return $this->definition->getName() . 'PortType';
|
||||
@ -121,4 +118,4 @@ class WsdlDumper implements DumperInterface
|
||||
{
|
||||
return $this->definition->getNamespace() . $method->getName();
|
||||
}
|
||||
}
|
||||
}
|
@ -35,9 +35,9 @@ class AnnotationClassLoader implements LoaderInterface
|
||||
private $wsMethodAnnotationClass = 'Bundle\\WebServiceBundle\\ServiceDefinition\\Annotation\\Method';
|
||||
private $wsParamAnnotationClass = 'Bundle\\WebServiceBundle\\ServiceDefinition\\Annotation\\Param';
|
||||
private $wsResultAnnotationClass = 'Bundle\\WebServiceBundle\\ServiceDefinition\\Annotation\\Result';
|
||||
|
||||
|
||||
protected $reader;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@ -60,42 +60,37 @@ class AnnotationClassLoader implements LoaderInterface
|
||||
*/
|
||||
public function load($class, $type = null)
|
||||
{
|
||||
if (!class_exists($class))
|
||||
{
|
||||
if (!class_exists($class)) {
|
||||
throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
|
||||
}
|
||||
|
||||
$class = new \ReflectionClass($class);
|
||||
|
||||
$definition = new ServiceDefinition();
|
||||
|
||||
foreach ($class->getMethods() as $method)
|
||||
{
|
||||
|
||||
foreach ($class->getMethods() as $method) {
|
||||
$wsMethodAnnot = $this->reader->getMethodAnnotation($method, $this->wsMethodAnnotationClass);
|
||||
|
||||
if($wsMethodAnnot !== null)
|
||||
{
|
||||
|
||||
if($wsMethodAnnot !== null) {
|
||||
$wsParamAnnots = $this->reader->getMethodAnnotations($method, $this->wsParamAnnotationClass);
|
||||
$wsResultAnnot = $this->reader->getMethodAnnotation($method, $this->wsResultAnnotationClass);
|
||||
|
||||
|
||||
$serviceMethod = new Method();
|
||||
$serviceMethod->setName($wsMethodAnnot->getName($method->getName()));
|
||||
$serviceMethod->setController($this->getController($method, $wsMethodAnnot));
|
||||
|
||||
foreach($wsParamAnnots as $wsParamAnnot)
|
||||
{
|
||||
|
||||
foreach($wsParamAnnots as $wsParamAnnot) {
|
||||
$serviceArgument = new Argument();
|
||||
$serviceArgument->setName($wsParamAnnot->getName());
|
||||
$serviceArgument->setType(new Type($wsParamAnnot->getPhpType(), $wsParamAnnot->getXmlType()));
|
||||
|
||||
|
||||
$serviceMethod->getArguments()->add($serviceArgument);
|
||||
}
|
||||
|
||||
if($wsResultAnnot !== null)
|
||||
{
|
||||
|
||||
if($wsResultAnnot !== null) {
|
||||
$serviceMethod->setReturn(new Type($wsResultAnnot->getPhpType(), $wsResultAnnot->getXmlType()));
|
||||
}
|
||||
|
||||
|
||||
$definition->getMethods()->add($serviceMethod);
|
||||
}
|
||||
}
|
||||
@ -105,16 +100,13 @@ class AnnotationClassLoader implements LoaderInterface
|
||||
|
||||
private function getController(\ReflectionMethod $method, MethodAnnotation $annotation)
|
||||
{
|
||||
if($annotation->getService() !== null)
|
||||
{
|
||||
if($annotation->getService() !== null) {
|
||||
return $annotation->getService() . ':' . $method->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return $method->class . '::' . $method->name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns true if this class supports the given resource.
|
||||
*
|
||||
@ -145,4 +137,4 @@ class AnnotationClassLoader implements LoaderInterface
|
||||
public function getResolver()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -61,11 +61,11 @@ class AnnotationFileLoader extends FileLoader
|
||||
$path = $this->locator->locate($file);
|
||||
|
||||
$definition = new ServiceDefinition();
|
||||
|
||||
|
||||
if ($class = $this->findClass($path)) {
|
||||
$definition = $this->loader->load($class, $type);
|
||||
}
|
||||
|
||||
|
||||
return $definition;
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ class AnnotationFileLoader extends FileLoader
|
||||
*
|
||||
* @param string $file A PHP file path
|
||||
*
|
||||
* @return string|false Full class name if found, false otherwise
|
||||
* @return string|false Full class name if found, false otherwise
|
||||
*/
|
||||
protected function findClass($file)
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ use Doctrine\Common\Annotations\Parser;
|
||||
|
||||
/**
|
||||
* AnnotationParser allows multiple annotations of the same class to be present.
|
||||
*
|
||||
*
|
||||
* @author Christian Kerl <christian-kerl@web.de>
|
||||
*/
|
||||
class AnnotationParser extends Parser
|
||||
|
@ -22,19 +22,18 @@ class AnnotationReader extends BaseAnnotationReader
|
||||
public function getMethodAnnotation(\ReflectionMethod $method, $type)
|
||||
{
|
||||
$annotation = parent::getMethodAnnotation($method, $type);
|
||||
|
||||
if($annotation !== null && count($annotation) > 1)
|
||||
{
|
||||
|
||||
if($annotation !== null && count($annotation) > 1) {
|
||||
throw new \LogicException(sprintf("There is more than one annotation of type '%s'!", $type));
|
||||
}
|
||||
|
||||
|
||||
return $annotation !== null ? $annotation[0] : null;
|
||||
}
|
||||
|
||||
|
||||
public function getMethodAnnotations(\ReflectionMethod $method, $type = null)
|
||||
{
|
||||
$annotations = parent::getMethodAnnotations($method);
|
||||
|
||||
|
||||
return $type !== null && isset($annotations[$type]) ? $annotations[$type] : $annotations;
|
||||
}
|
||||
}
|
@ -24,27 +24,25 @@ class XmlFileLoader extends FileLoader
|
||||
{
|
||||
return is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION);
|
||||
}
|
||||
|
||||
|
||||
public function load($file, $type = null)
|
||||
{
|
||||
$path = $this->locator->locate($file);
|
||||
|
||||
|
||||
$xml = $this->parseFile($path);
|
||||
|
||||
$definition = new ServiceDefinition();
|
||||
$definition->setName((string) $xml['name']);
|
||||
$definition->setNamespace((string) $xml['namespace']);
|
||||
|
||||
foreach($xml->header as $header)
|
||||
{
|
||||
foreach($xml->header as $header) {
|
||||
$definition->getHeaders()->add($this->parseHeader($header));
|
||||
}
|
||||
|
||||
foreach($xml->method as $method)
|
||||
{
|
||||
foreach($xml->method as $method) {
|
||||
$definition->getMethods()->add($this->parseMethod($method));
|
||||
}
|
||||
|
||||
|
||||
return $definition;
|
||||
}
|
||||
|
||||
@ -69,8 +67,7 @@ class XmlFileLoader extends FileLoader
|
||||
{
|
||||
$method = new Method((string)$node['name'], (string)$node['controller']);
|
||||
|
||||
foreach($node->argument as $argument)
|
||||
{
|
||||
foreach($node->argument as $argument) {
|
||||
$method->getArguments()->add($this->parseArgument($argument));
|
||||
}
|
||||
|
||||
|
@ -1,81 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://christiankerl.github.com/WebServiceBundle/servicedefinition/1.0/" xmlns:tns="http://christiankerl.github.com/WebServiceBundle/servicedefinition/1.0/" elementFormDefault="qualified">
|
||||
<element name="webservice" type="tns:WebserviceType" />
|
||||
<complexType name="WebserviceType">
|
||||
<sequence>
|
||||
<element name="header" type="tns:HeaderType" minOccurs="0" maxOccurs="unbounded" />
|
||||
<element name="method" type="tns:MethodType" maxOccurs="unbounded" />
|
||||
</sequence>
|
||||
<attribute name="name" type="string" use="required" />
|
||||
</complexType>
|
||||
|
||||
<complexType name="HeaderType">
|
||||
<complexContent>
|
||||
<extension base="tns:TransferObjectType">
|
||||
<sequence>
|
||||
<element name="exception" type="tns:ExceptionType" minOccurs="0" maxOccurs="unbounded" />
|
||||
</sequence>
|
||||
<attribute name="name" type="ID" use="required" />
|
||||
</extension>
|
||||
</complexContent>
|
||||
</complexType>
|
||||
|
||||
<complexType name="HeaderRefType">
|
||||
<attribute name="name" type="IDREF" />
|
||||
<attribute name="direction">
|
||||
<simpleType>
|
||||
<restriction base="string">
|
||||
<enumeration value="in" />
|
||||
<enumeration value="out" />
|
||||
<enumeration value="inout" />
|
||||
</restriction>
|
||||
</simpleType>
|
||||
</attribute>
|
||||
</complexType>
|
||||
|
||||
<complexType name="MethodType">
|
||||
<sequence>
|
||||
<element name="exception" type="tns:ExceptionType" minOccurs="0" maxOccurs="unbounded" />
|
||||
<element name="header" type="tns:HeaderRefType" minOccurs="0" maxOccurs="unbounded" />
|
||||
|
||||
<element name="argument" type="tns:ArgumentType" minOccurs="0" maxOccurs="unbounded" />
|
||||
<element name="return" type="tns:ReturnType" minOccurs="0" maxOccurs="1" />
|
||||
</sequence>
|
||||
<attribute name="name" type="string" use="required" />
|
||||
<attribute name="controller" type="string" use="required" />
|
||||
</complexType>
|
||||
|
||||
<complexType name="TransferObjectType" abstract="true">
|
||||
<sequence>
|
||||
<element name="type" type="tns:TypeConversionType" />
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="ExceptionType">
|
||||
<complexContent>
|
||||
<extension base="tns:TransferObjectType">
|
||||
<attribute name="name" type="string" use="required" />
|
||||
</extension>
|
||||
</complexContent>
|
||||
</complexType>
|
||||
|
||||
<complexType name="ArgumentType">
|
||||
<complexContent>
|
||||
<extension base="tns:TransferObjectType">
|
||||
<attribute name="name" type="string" use="required" />
|
||||
</extension>
|
||||
</complexContent>
|
||||
</complexType>
|
||||
|
||||
<complexType name="ReturnType">
|
||||
<complexContent>
|
||||
<extension base="tns:TransferObjectType" />
|
||||
</complexContent>
|
||||
</complexType>
|
||||
|
||||
<complexType name="TypeConversionType">
|
||||
<attribute name="php-type" type="string" use="required" />
|
||||
<attribute name="xml-type" type="QName" use="required" />
|
||||
<attribute name="converter" type="string" use="optional" />
|
||||
</complexType>
|
||||
<element name="webservice" type="tns:WebserviceType" />
|
||||
<complexType name="WebserviceType">
|
||||
<sequence>
|
||||
<element name="header" type="tns:HeaderType" minOccurs="0" maxOccurs="unbounded" />
|
||||
<element name="method" type="tns:MethodType" maxOccurs="unbounded" />
|
||||
</sequence>
|
||||
<attribute name="name" type="string" use="required" />
|
||||
</complexType>
|
||||
|
||||
<complexType name="HeaderType">
|
||||
<complexContent>
|
||||
<extension base="tns:TransferObjectType">
|
||||
<sequence>
|
||||
<element name="exception" type="tns:ExceptionType" minOccurs="0" maxOccurs="unbounded" />
|
||||
</sequence>
|
||||
<attribute name="name" type="ID" use="required" />
|
||||
</extension>
|
||||
</complexContent>
|
||||
</complexType>
|
||||
|
||||
<complexType name="HeaderRefType">
|
||||
<attribute name="name" type="IDREF" />
|
||||
<attribute name="direction">
|
||||
<simpleType>
|
||||
<restriction base="string">
|
||||
<enumeration value="in" />
|
||||
<enumeration value="out" />
|
||||
<enumeration value="inout" />
|
||||
</restriction>
|
||||
</simpleType>
|
||||
</attribute>
|
||||
</complexType>
|
||||
|
||||
<complexType name="MethodType">
|
||||
<sequence>
|
||||
<element name="exception" type="tns:ExceptionType" minOccurs="0" maxOccurs="unbounded" />
|
||||
<element name="header" type="tns:HeaderRefType" minOccurs="0" maxOccurs="unbounded" />
|
||||
|
||||
<element name="argument" type="tns:ArgumentType" minOccurs="0" maxOccurs="unbounded" />
|
||||
<element name="return" type="tns:ReturnType" minOccurs="0" maxOccurs="1" />
|
||||
</sequence>
|
||||
<attribute name="name" type="string" use="required" />
|
||||
<attribute name="controller" type="string" use="required" />
|
||||
</complexType>
|
||||
|
||||
<complexType name="TransferObjectType" abstract="true">
|
||||
<sequence>
|
||||
<element name="type" type="tns:TypeConversionType" />
|
||||
</sequence>
|
||||
</complexType>
|
||||
|
||||
<complexType name="ExceptionType">
|
||||
<complexContent>
|
||||
<extension base="tns:TransferObjectType">
|
||||
<attribute name="name" type="string" use="required" />
|
||||
</extension>
|
||||
</complexContent>
|
||||
</complexType>
|
||||
|
||||
<complexType name="ArgumentType">
|
||||
<complexContent>
|
||||
<extension base="tns:TransferObjectType">
|
||||
<attribute name="name" type="string" use="required" />
|
||||
</extension>
|
||||
</complexContent>
|
||||
</complexType>
|
||||
|
||||
<complexType name="ReturnType">
|
||||
<complexContent>
|
||||
<extension base="tns:TransferObjectType" />
|
||||
</complexContent>
|
||||
</complexType>
|
||||
|
||||
<complexType name="TypeConversionType">
|
||||
<attribute name="php-type" type="string" use="required" />
|
||||
<attribute name="xml-type" type="QName" use="required" />
|
||||
<attribute name="converter" type="string" use="optional" />
|
||||
</complexType>
|
||||
</schema>
|
@ -28,7 +28,7 @@ class SoapRequest extends Request
|
||||
{
|
||||
return new static($request->query->all(), $request->request->all(), $request->attributes->all(), $request->cookies->all(), $request->files->all(), $request->server->all(), $request->content);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@ -67,8 +67,7 @@ class SoapRequest extends Request
|
||||
*/
|
||||
public function getSoapMessage()
|
||||
{
|
||||
if($this->soapMessage === null)
|
||||
{
|
||||
if($this->soapMessage === null) {
|
||||
$this->soapMessage = $this->initializeSoapMessage();
|
||||
}
|
||||
|
||||
@ -87,19 +86,14 @@ class SoapRequest extends Request
|
||||
|
||||
protected function initializeSoapMessage()
|
||||
{
|
||||
if($this->server->has('CONTENT_TYPE'))
|
||||
{
|
||||
if($this->server->has('CONTENT_TYPE')) {
|
||||
$type = $this->splitContentTypeHeader($this->server->get('CONTENT_TYPE'));
|
||||
|
||||
switch($type['_type'])
|
||||
{
|
||||
switch($type['_type']) {
|
||||
case 'multipart/related':
|
||||
if($type['type'] == 'application/xop+xml')
|
||||
{
|
||||
if($type['type'] == 'application/xop+xml') {
|
||||
return $this->initializeMtomSoapMessage($type, $this->getContent());
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
//log error
|
||||
}
|
||||
break;
|
||||
@ -118,8 +112,7 @@ class SoapRequest extends Request
|
||||
|
||||
protected function initializeMtomSoapMessage(array $contentTypeHeader, $content)
|
||||
{
|
||||
if(!isset($contentTypeHeader['start']) || !isset($contentTypeHeader['start-info']) || !isset($contentTypeHeader['boundary']))
|
||||
{
|
||||
if(!isset($contentTypeHeader['start']) || !isset($contentTypeHeader['start-info']) || !isset($contentTypeHeader['boundary'])) {
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
|
||||
@ -134,13 +127,11 @@ class SoapRequest extends Request
|
||||
|
||||
// TODO: add more checks to achieve full compatibility to MTOM spec
|
||||
// http://www.w3.org/TR/soap12-mtom/
|
||||
if($rootPart->id != $soapMimePartId || $rootPartType['_type'] != 'application/xop+xml' || $rootPartType['type'] != $soapMimePartType)
|
||||
{
|
||||
if($rootPart->id != $soapMimePartId || $rootPartType['_type'] != 'application/xop+xml' || $rootPartType['type'] != $soapMimePartType) {
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
|
||||
foreach($mimeParts as $mimePart)
|
||||
{
|
||||
foreach($mimeParts as $mimePart) {
|
||||
$this->soapAttachments->add(new SoapAttachment(
|
||||
$mimePart->id,
|
||||
$mimePart->type,
|
||||
@ -160,8 +151,7 @@ class SoapRequest extends Request
|
||||
|
||||
$result['_type'] = array_shift($parts);
|
||||
|
||||
foreach($parts as $part)
|
||||
{
|
||||
foreach($parts as $part) {
|
||||
list($key, $value) = explode('=', trim($part), 2);
|
||||
|
||||
$result[$key] = trim($value, '"');
|
||||
@ -169,4 +159,4 @@ class SoapRequest extends Request
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
@ -57,8 +57,7 @@ class SoapServerFactory
|
||||
{
|
||||
$result = array();
|
||||
|
||||
foreach($this->converters->getTypeConverters() as $typeConverter)
|
||||
{
|
||||
foreach($this->converters->getTypeConverters() as $typeConverter) {
|
||||
$result[] = array(
|
||||
'type_name' => $typeConverter->getTypeName(),
|
||||
'type_ns' => $typeConverter->getTypeNamespace(),
|
||||
@ -78,15 +77,12 @@ class SoapServerFactory
|
||||
{
|
||||
$result = array();
|
||||
|
||||
foreach($this->definition->getHeaders() as $header)
|
||||
{
|
||||
foreach($this->definition->getHeaders() as $header) {
|
||||
$this->addSoapServerClassmapEntry($result, $header->getType());
|
||||
}
|
||||
|
||||
foreach($this->definition->getMethods() as $method)
|
||||
{
|
||||
foreach($method->getArguments() as $arg)
|
||||
{
|
||||
foreach($this->definition->getMethods() as $method) {
|
||||
foreach($method->getArguments() as $arg) {
|
||||
$this->addSoapServerClassmapEntry($result, $arg->getType());
|
||||
}
|
||||
}
|
||||
@ -98,15 +94,14 @@ class SoapServerFactory
|
||||
{
|
||||
// TODO: fix this hack
|
||||
if($type->getXmlType() === null) return;
|
||||
|
||||
|
||||
$xmlType = QName::fromPackedQName($type->getXmlType())->getName();
|
||||
$phpType = $type->getPhpType();
|
||||
|
||||
if(isset($classmap[$xmlType]) && $classmap[$xmlType] != $phpType)
|
||||
{
|
||||
if(isset($classmap[$xmlType]) && $classmap[$xmlType] != $phpType) {
|
||||
// log warning
|
||||
}
|
||||
|
||||
$classmap[$xmlType] = $phpType;
|
||||
}
|
||||
}
|
||||
}
|
18
Tests/fixtures/api-servicedefinition.xml
vendored
18
Tests/fixtures/api-servicedefinition.xml
vendored
@ -1,14 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<webservice name="api" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns="http://christiankerl.github.com/WebServiceBundle/servicedefinition/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://christiankerl.github.com/WebServiceBundle/servicedefinition/1.0/ ./../../ServiceDefinition/Loader/schema/servicedefinition-1.0.xsd ">
|
||||
<method name="math_multiply" controller="">
|
||||
<argument name="a">
|
||||
<type xml-type="xs:double" php-type="float"/>
|
||||
</argument>
|
||||
<argument name="b">
|
||||
<type xml-type="xs:double" php-type="float"/>
|
||||
</argument>
|
||||
<return>
|
||||
<type xml-type="xs:double" php-type="float"/>
|
||||
</return>
|
||||
<argument name="a">
|
||||
<type xml-type="xs:double" php-type="float"/>
|
||||
</argument>
|
||||
<argument name="b">
|
||||
<type xml-type="xs:double" php-type="float"/>
|
||||
</argument>
|
||||
<return>
|
||||
<type xml-type="xs:double" php-type="float"/>
|
||||
</return>
|
||||
</method>
|
||||
</webservice>
|
284
Tests/fixtures/api.wsdl
vendored
284
Tests/fixtures/api.wsdl
vendored
@ -1,145 +1,145 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="MathApi" targetNamespace="http://localhost/" xmlns:tns="http://localhost/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
|
||||
<wsdl:types xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://localhost/">
|
||||
<xsd:complexType name="AuthHeader">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="username" type="xsd:string"/>
|
||||
<xsd:element name="password" type="xsd:string"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="AuthHeaderElement" type="tns:AuthHeader"/>
|
||||
<xsd:complexType name="DoubleArray">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="item" type="xsd:double" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="DoubleArrayElement" type="tns:DoubleArray"/>
|
||||
<xsd:complexType name="ComplexNumber">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="realPart" type="xsd:double"/>
|
||||
<xsd:element name="imaginaryPart" type="xsd:double"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ComplexNumberElement" type="tns:ComplexNumber"/>
|
||||
<xsd:complexType name="ComplexNumberArray">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="item" type="tns:ComplexNumber" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ComplexNumberArrayElement" type="tns:ComplexNumberArray"/>
|
||||
</xsd:schema>
|
||||
</wsdl:types>
|
||||
<wsdl:portType name="MathApiPortType">
|
||||
<wsdl:operation name="math_multiply" parameterOrder="a b">
|
||||
<wsdl:input message="tns:math_multiplyRequest"/>
|
||||
<wsdl:output message="tns:math_multiplyResponse"/>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="SimpleMultiply" parameterOrder="a b">
|
||||
<wsdl:input message="tns:SimpleMultiplyRequest"/>
|
||||
<wsdl:output message="tns:SimpleMultiplyResponse"/>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="SimpleMultiplyWithHeader" parameterOrder="AuthHeader a b">
|
||||
<wsdl:input message="tns:SimpleMultiplyWithHeaderRequest"/>
|
||||
<wsdl:output message="tns:SimpleMultiplyWithHeaderResponse"/>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="ArrayMultiply" parameterOrder="factors">
|
||||
<wsdl:input message="tns:ArrayMultiplyRequest"/>
|
||||
<wsdl:output message="tns:ArrayMultiplyResponse"/>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="ComplexMultiply" parameterOrder="input">
|
||||
<wsdl:input message="tns:ComplexMultiplyRequest"/>
|
||||
<wsdl:output message="tns:ComplexMultiplyResponse"/>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
<wsdl:binding xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="MathApiBinding" type="tns:MathApiPortType">
|
||||
<soap:binding xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="math_multiply">
|
||||
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="http://localhost/math_multiply" style="rpc"/>
|
||||
<wsdl:input xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="a b" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="result" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="SimpleMultiply">
|
||||
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="http://localhost/SimpleMultiply" style="rpc"/>
|
||||
<wsdl:input xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="a b" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="result" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="SimpleMultiplyWithHeader">
|
||||
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="http://localhost/SimpleMultiplyWithHeader" style="rpc"/>
|
||||
<wsdl:input xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="a b" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
<soap:header xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" message="tns:SimpleMultiplyWithHeaderRequest" part="AuthHeader" use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="result" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
<soap:header xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" message="tns:SimpleMultiplyWithHeaderResponse" part="AuthHeader" use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="ArrayMultiply">
|
||||
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="http://localhost/ArrayMultiply" style="rpc"/>
|
||||
<wsdl:input xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="factors" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="result" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="ComplexMultiply">
|
||||
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="http://localhost/ComplexMultiply" style="rpc"/>
|
||||
<wsdl:input xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="input" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="result" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
<wsdl:message name="math_multiplyRequest">
|
||||
<wsdl:part name="a" type="xsd:double"/>
|
||||
<wsdl:part name="b" type="xsd:double"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="math_multiplyResponse">
|
||||
<wsdl:part name="result" type="xsd:double"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="SimpleMultiplyRequest">
|
||||
<wsdl:part name="a" type="xsd:double"/>
|
||||
<wsdl:part name="b" type="xsd:double"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="SimpleMultiplyResponse">
|
||||
<wsdl:part name="result" type="xsd:double"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="SimpleMultiplyWithHeaderRequest">
|
||||
<wsdl:part name="AuthHeader" element="tns:AuthHeaderElement"/>
|
||||
<wsdl:part name="a" type="xsd:double"/>
|
||||
<wsdl:part name="b" type="xsd:double"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="SimpleMultiplyWithHeaderResponse">
|
||||
<wsdl:part name="AuthHeader" element="tns:AuthHeaderElement"/>
|
||||
<wsdl:part name="result" type="xsd:double"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ArrayMultiplyRequest">
|
||||
<wsdl:part name="factors" type="tns:DoubleArray"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ArrayMultiplyResponse">
|
||||
<wsdl:part name="result" type="xsd:double"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ComplexMultiplyRequest">
|
||||
<wsdl:part name="input" type="tns:ComplexNumberArray"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ComplexMultiplyResponse">
|
||||
<wsdl:part name="result" type="tns:ComplexNumber"/>
|
||||
</wsdl:message>
|
||||
<wsdl:service xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="MathApiService">
|
||||
<wsdl:port xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="MathApiPort" binding="tns:MathApiBinding">
|
||||
<soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="http://localhost/MathApi.php"/>
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
<wsdl:types xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://localhost/">
|
||||
<xsd:complexType name="AuthHeader">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="username" type="xsd:string"/>
|
||||
<xsd:element name="password" type="xsd:string"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="AuthHeaderElement" type="tns:AuthHeader"/>
|
||||
<xsd:complexType name="DoubleArray">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="item" type="xsd:double" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="DoubleArrayElement" type="tns:DoubleArray"/>
|
||||
<xsd:complexType name="ComplexNumber">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="realPart" type="xsd:double"/>
|
||||
<xsd:element name="imaginaryPart" type="xsd:double"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ComplexNumberElement" type="tns:ComplexNumber"/>
|
||||
<xsd:complexType name="ComplexNumberArray">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="item" type="tns:ComplexNumber" minOccurs="0" maxOccurs="unbounded"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ComplexNumberArrayElement" type="tns:ComplexNumberArray"/>
|
||||
</xsd:schema>
|
||||
</wsdl:types>
|
||||
<wsdl:portType name="MathApiPortType">
|
||||
<wsdl:operation name="math_multiply" parameterOrder="a b">
|
||||
<wsdl:input message="tns:math_multiplyRequest"/>
|
||||
<wsdl:output message="tns:math_multiplyResponse"/>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="SimpleMultiply" parameterOrder="a b">
|
||||
<wsdl:input message="tns:SimpleMultiplyRequest"/>
|
||||
<wsdl:output message="tns:SimpleMultiplyResponse"/>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="SimpleMultiplyWithHeader" parameterOrder="AuthHeader a b">
|
||||
<wsdl:input message="tns:SimpleMultiplyWithHeaderRequest"/>
|
||||
<wsdl:output message="tns:SimpleMultiplyWithHeaderResponse"/>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="ArrayMultiply" parameterOrder="factors">
|
||||
<wsdl:input message="tns:ArrayMultiplyRequest"/>
|
||||
<wsdl:output message="tns:ArrayMultiplyResponse"/>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="ComplexMultiply" parameterOrder="input">
|
||||
<wsdl:input message="tns:ComplexMultiplyRequest"/>
|
||||
<wsdl:output message="tns:ComplexMultiplyResponse"/>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
<wsdl:binding xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="MathApiBinding" type="tns:MathApiPortType">
|
||||
<soap:binding xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="math_multiply">
|
||||
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="http://localhost/math_multiply" style="rpc"/>
|
||||
<wsdl:input xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="a b" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="result" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="SimpleMultiply">
|
||||
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="http://localhost/SimpleMultiply" style="rpc"/>
|
||||
<wsdl:input xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="a b" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="result" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="SimpleMultiplyWithHeader">
|
||||
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="http://localhost/SimpleMultiplyWithHeader" style="rpc"/>
|
||||
<wsdl:input xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="a b" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
<soap:header xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" message="tns:SimpleMultiplyWithHeaderRequest" part="AuthHeader" use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="result" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
<soap:header xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" message="tns:SimpleMultiplyWithHeaderResponse" part="AuthHeader" use="literal" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="ArrayMultiply">
|
||||
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="http://localhost/ArrayMultiply" style="rpc"/>
|
||||
<wsdl:input xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="factors" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="result" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="ComplexMultiply">
|
||||
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="http://localhost/ComplexMultiply" style="rpc"/>
|
||||
<wsdl:input xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="input" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" parts="result" use="literal" namespace="http://localhost/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
<wsdl:message name="math_multiplyRequest">
|
||||
<wsdl:part name="a" type="xsd:double"/>
|
||||
<wsdl:part name="b" type="xsd:double"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="math_multiplyResponse">
|
||||
<wsdl:part name="result" type="xsd:double"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="SimpleMultiplyRequest">
|
||||
<wsdl:part name="a" type="xsd:double"/>
|
||||
<wsdl:part name="b" type="xsd:double"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="SimpleMultiplyResponse">
|
||||
<wsdl:part name="result" type="xsd:double"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="SimpleMultiplyWithHeaderRequest">
|
||||
<wsdl:part name="AuthHeader" element="tns:AuthHeaderElement"/>
|
||||
<wsdl:part name="a" type="xsd:double"/>
|
||||
<wsdl:part name="b" type="xsd:double"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="SimpleMultiplyWithHeaderResponse">
|
||||
<wsdl:part name="AuthHeader" element="tns:AuthHeaderElement"/>
|
||||
<wsdl:part name="result" type="xsd:double"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ArrayMultiplyRequest">
|
||||
<wsdl:part name="factors" type="tns:DoubleArray"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ArrayMultiplyResponse">
|
||||
<wsdl:part name="result" type="xsd:double"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ComplexMultiplyRequest">
|
||||
<wsdl:part name="input" type="tns:ComplexNumberArray"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ComplexMultiplyResponse">
|
||||
<wsdl:part name="result" type="tns:ComplexNumber"/>
|
||||
</wsdl:message>
|
||||
<wsdl:service xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="MathApiService">
|
||||
<wsdl:port xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="MathApiPort" binding="tns:MathApiBinding">
|
||||
<soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="http://localhost/MathApi.php"/>
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>
|
||||
|
@ -21,8 +21,7 @@ class Assert
|
||||
|
||||
public static function thatArgument($name, $condition, $message = self::ARGUMENT_INVALID)
|
||||
{
|
||||
if(!$condition)
|
||||
{
|
||||
if(!$condition) {
|
||||
throw new \InvalidArgumentException(sprintf($message, $name));
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,7 @@ class Collection implements \IteratorAggregate, \Countable
|
||||
|
||||
public function addAll($elements)
|
||||
{
|
||||
foreach ($elements as $element)
|
||||
{
|
||||
foreach ($elements as $element) {
|
||||
$this->add($element);
|
||||
}
|
||||
}
|
||||
|
@ -17,35 +17,34 @@ namespace Bundle\WebServiceBundle\Util;
|
||||
*/
|
||||
class String
|
||||
{
|
||||
/**
|
||||
* Checks if a string starts with a given string.
|
||||
*
|
||||
* @param string $str A string
|
||||
* @param string $substr A string to check against
|
||||
*
|
||||
* @return bool True if str starts with substr
|
||||
*/
|
||||
public static function startsWith($str, $substr)
|
||||
{
|
||||
if(is_string($str) && is_string($substr) && strlen($str) >= strlen($substr))
|
||||
/**
|
||||
* Checks if a string starts with a given string.
|
||||
*
|
||||
* @param string $str A string
|
||||
* @param string $substr A string to check against
|
||||
*
|
||||
* @return bool True if str starts with substr
|
||||
*/
|
||||
public static function startsWith($str, $substr)
|
||||
{
|
||||
return $substr == substr($str, 0, strlen($substr));
|
||||
if(is_string($str) && is_string($substr) && strlen($str) >= strlen($substr)) {
|
||||
return $substr == substr($str, 0, strlen($substr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a string ends with a given string.
|
||||
*
|
||||
* @param string $str A string
|
||||
* @param string $substr A string to check against
|
||||
*
|
||||
* @return bool True if str ends with substr
|
||||
*/
|
||||
public static function endsWith($str, $substr)
|
||||
{
|
||||
if(is_string($str) && is_string($substr) && strlen($str) >= strlen($substr))
|
||||
/**
|
||||
* Checks if a string ends with a given string.
|
||||
*
|
||||
* @param string $str A string
|
||||
* @param string $substr A string to check against
|
||||
*
|
||||
* @return bool True if str ends with substr
|
||||
*/
|
||||
public static function endsWith($str, $substr)
|
||||
{
|
||||
return $substr == substr($str, strlen($str) - strlen($substr));
|
||||
if(is_string($str) && is_string($substr) && strlen($str) >= strlen($substr))
|
||||
{
|
||||
return $substr == substr($str, strlen($str) - strlen($substr));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -30,81 +30,76 @@ class WebServiceContext
|
||||
private $converterRepository;
|
||||
private $requestMessageBinder;
|
||||
private $responseMessageBinder;
|
||||
|
||||
|
||||
private $serviceDefinitionLoader;
|
||||
private $wsdlFileDumper;
|
||||
|
||||
|
||||
private $options;
|
||||
|
||||
|
||||
private $serviceDefinition;
|
||||
private $serviceBinder;
|
||||
private $serverFactory;
|
||||
|
||||
|
||||
public function __construct(LoaderInterface $loader, DumperInterface $dumper, ConverterRepository $converterRepository, MessageBinderInterface $requestMessageBinder, MessageBinderInterface $responseMessageBinder, array $options)
|
||||
{
|
||||
$this->serviceDefinitionLoader = $loader;
|
||||
$this->wsdlFileDumper = $dumper;
|
||||
|
||||
|
||||
$this->converterRepository = $converterRepository;
|
||||
$this->requestMessageBinder = $requestMessageBinder;
|
||||
$this->responseMessageBinder = $responseMessageBinder;
|
||||
|
||||
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
public function getServiceDefinition()
|
||||
|
||||
public function getServiceDefinition()
|
||||
{
|
||||
if($this->serviceDefinition === null)
|
||||
{
|
||||
if(!$this->serviceDefinitionLoader->supports($this->options['resource'], $this->options['resource_type']))
|
||||
{
|
||||
if($this->serviceDefinition === null) {
|
||||
if(!$this->serviceDefinitionLoader->supports($this->options['resource'], $this->options['resource_type'])) {
|
||||
throw new \LogicException();
|
||||
}
|
||||
|
||||
|
||||
$this->serviceDefinition = $this->serviceDefinitionLoader->load($this->options['resource'], $this->options['resource_type']);
|
||||
$this->serviceDefinition->setName($this->options['name']);
|
||||
$this->serviceDefinition->setNamespace($this->options['namespace']);
|
||||
}
|
||||
|
||||
|
||||
return $this->serviceDefinition;
|
||||
}
|
||||
|
||||
|
||||
public function getWsdlFile($endpoint = null)
|
||||
{
|
||||
$id = $endpoint !== null ? '.' . md5($endpoint) : '';
|
||||
$file = sprintf('%s/%s.wsdl', $this->options['cache_dir'], $this->options['name'] . $id);
|
||||
$cache = new ConfigCache($file, true);
|
||||
|
||||
if(!$cache->isFresh())
|
||||
{
|
||||
|
||||
if(!$cache->isFresh()) {
|
||||
$cache->write($this->wsdlFileDumper->dumpServiceDefinition($this->getServiceDefinition(), array('endpoint' => $endpoint)));
|
||||
}
|
||||
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
|
||||
public function getWsdlFileContent($endpoint = null)
|
||||
{
|
||||
return file_get_contents($this->getWsdlFile($endpoint));
|
||||
}
|
||||
|
||||
public function getServiceBinder()
|
||||
|
||||
public function getServiceBinder()
|
||||
{
|
||||
if($this->serviceBinder === null)
|
||||
{
|
||||
if($this->serviceBinder === null) {
|
||||
$this->serviceBinder = new ServiceBinder($this->getServiceDefinition(), $this->requestMessageBinder, $this->responseMessageBinder);
|
||||
}
|
||||
|
||||
|
||||
return $this->serviceBinder;
|
||||
}
|
||||
|
||||
public function getServerFactory()
|
||||
|
||||
public function getServerFactory()
|
||||
{
|
||||
if($this->serverFactory === null)
|
||||
{
|
||||
if($this->serverFactory === null) {
|
||||
$this->serverFactory = new SoapServerFactory($this->getServiceDefinition(), $this->getWsdlFile(), $this->converterRepository);
|
||||
}
|
||||
|
||||
|
||||
return $this->serverFactory;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user