Cleaned files

This commit is contained in:
Francis Besset 2011-07-14 17:45:03 +02:00
parent 7ddf05cec1
commit 51d1d28830
31 changed files with 428 additions and 499 deletions

View File

@ -104,15 +104,12 @@ class SoapWebServiceController extends ContainerAware
$webServiceContext = $this->container->get('webservice.context.' . $webservice); $webServiceContext = $this->container->get('webservice.context.' . $webservice);
$request = $this->container->get('request'); $request = $this->container->get('request');
if($request->query->has('WSDL')) if($request->query->has('WSDL')) {
{
$endpoint = $this->container->get('router')->generate('_webservice_call', array('webservice' => $webservice), true); $endpoint = $this->container->get('router')->generate('_webservice_call', array('webservice' => $webservice), true);
$response = new Response($webServiceContext->getWsdlFileContent($endpoint)); $response = new Response($webServiceContext->getWsdlFileContent($endpoint));
$response->headers->set('Content-Type', 'application/wsdl+xml'); $response->headers->set('Content-Type', 'application/wsdl+xml');
} } else {
else
{
// TODO: replace with better represantation // TODO: replace with better represantation
$response = new Response($webServiceContext->getWsdlFileContent()); $response = new Response($webServiceContext->getWsdlFileContent());
$response->headers->set('Content-Type', 'text/xml'); $response->headers->set('Content-Type', 'text/xml');
@ -132,8 +129,7 @@ class SoapWebServiceController extends ContainerAware
*/ */
public function __call($method, $arguments) public function __call($method, $arguments)
{ {
if($this->serviceBinder->isServiceHeader($method)) if($this->serviceBinder->isServiceHeader($method)) {
{
// collect request soap headers // collect request soap headers
$this->soapRequest->getSoapHeaders()->add( $this->soapRequest->getSoapHeaders()->add(
$this->serviceBinder->processServiceHeader($method, $arguments[0]) $this->serviceBinder->processServiceHeader($method, $arguments[0])
@ -142,8 +138,7 @@ class SoapWebServiceController extends ContainerAware
return; return;
} }
if($this->serviceBinder->isServiceMethod($method)) if($this->serviceBinder->isServiceMethod($method)) {
{
$this->soapRequest->attributes->add( $this->soapRequest->attributes->add(
$this->serviceBinder->processServiceMethodArguments($method, $arguments) $this->serviceBinder->processServiceMethodArguments($method, $arguments)
); );
@ -154,8 +149,7 @@ class SoapWebServiceController extends ContainerAware
$this->soapResponse = $this->checkResponse($response); $this->soapResponse = $this->checkResponse($response);
// add response soap headers to soap server // add response soap headers to soap server
foreach($this->soapResponse->getSoapHeaders() as $header) foreach($this->soapResponse->getSoapHeaders() as $header) {
{
$this->soapServer->addSoapHeader($header->toNativeSoapHeader()); $this->soapServer->addSoapHeader($header->toNativeSoapHeader());
} }
@ -178,8 +172,7 @@ class SoapWebServiceController extends ContainerAware
*/ */
protected function checkResponse(Response $response) protected function checkResponse(Response $response)
{ {
if($response == null || !$response instanceof SoapResponse) if($response == null || !$response instanceof SoapResponse) {
{
throw new \InvalidArgumentException(); throw new \InvalidArgumentException();
} }

View File

@ -38,11 +38,5 @@ class ConverterRepository
public function registerTypeConverterServices(ContainerInterface $container) public function registerTypeConverterServices(ContainerInterface $container)
{ {
/*
foreach($container->findTaggedServiceIds('webservice.converter') as $id => $attributes)
{
$this->addTypeConverter($container->get($id));
}
*/
} }
} }

View File

@ -42,8 +42,7 @@ class XopIncludeTypeConverter implements TypeConverterInterface
$ref = $include->getAttribute('href'); $ref = $include->getAttribute('href');
if(String::startsWith($ref, 'cid:')) if(String::startsWith($ref, 'cid:')) {
{
$cid = urldecode(substr($ref, 4)); $cid = urldecode(substr($ref, 4));
return $request->getSoapAttachments()->get($cid)->getContent(); return $request->getSoapAttachments()->get($cid)->getContent();

View File

@ -44,8 +44,7 @@ class WebServiceExtension extends Extension
$config = $processor->process($configuration->getConfigTree(), $configs); $config = $processor->process($configuration->getConfigTree(), $configs);
foreach($config['services'] as $serviceContextConfig) foreach($config['services'] as $serviceContextConfig) {
{
$this->createWebServiceContext($serviceContextConfig, $container); $this->createWebServiceContext($serviceContextConfig, $container);
} }
} }
@ -62,8 +61,7 @@ class WebServiceExtension extends Extension
$contextId = 'webservice.context.' . $config['name']; $contextId = 'webservice.context.' . $config['name'];
$context = $container->setDefinition($contextId, new DefinitionDecorator('webservice.context')); $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($idx, new Reference($contextPrototypeArguments[$idx] . $bindingSuffix));
} }
$context->setArgument(5, array_merge($contextPrototypeArguments[5], $config)); $context->setArgument(5, array_merge($contextPrototypeArguments[5], $config));

View File

@ -4,12 +4,13 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="_webservice_call" pattern="/{webservice}"> <route id="_webservice_call" pattern="/{webservice}">
<default key="_controller">webservice.controller:call</default> <default key="_controller">webservice.controller:call</default>
<requirement key="_method">POST</requirement> <requirement key="_method">POST</requirement>
</route> </route>
<route id="_webservice_definition" pattern="/{webservice}">
<default key="_controller">webservice.controller:definition</default> <route id="_webservice_definition" pattern="/{webservice}">
<requirement key="_method">GET</requirement> <default key="_controller">webservice.controller:definition</default>
</route> <requirement key="_method">GET</requirement>
</route>
</routes> </routes>

View File

@ -3,55 +3,46 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters> <parameters>
<parameter key="webservice.file_locator.class">Symfony\Component\HttpKernel\Config\FileLocator</parameter> <parameter key="webservice.file_locator.class">Symfony\Component\HttpKernel\Config\FileLocator</parameter>
<parameter key="webservice.cache_dir">%kernel.cache_dir%/webservice</parameter> <parameter key="webservice.cache_dir">%kernel.cache_dir%/webservice</parameter>
</parameters> </parameters>
<services> <services>
<service id="webservice.controller" class="Bundle\WebServiceBundle\Controller\SoapWebServiceController"> <service id="webservice.controller" class="Bundle\WebServiceBundle\Controller\SoapWebServiceController">
<argument type="service" id="service_container" /> <argument type="service" id="service_container" />
<argument type="service" id="http_kernel" /> <argument type="service" id="http_kernel" />
</service> </service>
<service id="webservice.context" class="Bundle\WebServiceBundle\WebServiceContext" abstract="true"> <service id="webservice.context" class="Bundle\WebServiceBundle\WebServiceContext" abstract="true">
<argument type="service" id="webservice.definition.loader"/>
<argument type="service" id="webservice.definition.loader"/> <argument type="service" id="webservice.definition.dumper.wsdl"/>
<argument type="service" id="webservice.definition.dumper.wsdl"/>
<argument type="service" id="webservice.converter.repository"/> <argument type="service" id="webservice.converter.repository"/>
<argument type="service" id="webservice.binder.request"/> <argument type="service" id="webservice.binder.request"/>
<argument type="service" id="webservice.binder.response"/> <argument type="service" id="webservice.binder.response"/>
<argument type="collection"> <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 key="cache_dir">%webservice.cache_dir%</argument>
</argument> </argument>
</service>
</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.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.request.documentwrapped" class="Bundle\WebServiceBundle\ServiceBinding\DocumentLiteralWrappedRequestMessageBinder" />
<service id="webservice.binder.response.documentwrapped" class="Bundle\WebServiceBundle\ServiceBinding\DocumentLiteralWrappedResponseMessageBinder" /> <service id="webservice.binder.response.documentwrapped" class="Bundle\WebServiceBundle\ServiceBinding\DocumentLiteralWrappedResponseMessageBinder" />
<service id="webservice.converter.repository" class="Bundle\WebServiceBundle\Converter\ConverterRepository"> <service id="webservice.converter.repository" class="Bundle\WebServiceBundle\Converter\ConverterRepository">
<call method="registerTypeConverterServices"> <call method="registerTypeConverterServices">
<argument type="service" id="service_container" /> <argument type="service" id="service_container" />
</call> </call>
</service> </service>
<service id="webservice.file_locator" class="%webservice.file_locator.class%" public="false"> <service id="webservice.file_locator" class="%webservice.file_locator.class%" public="false">
<argument type="service" id="kernel" /> <argument type="service" id="kernel" />
</service> </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" alias="webservice.definition.loader.annot_file" />
<service id="webservice.definition.loader.annot_file" class="Bundle\WebServiceBundle\ServiceDefinition\Loader\AnnotationFileLoader"> <service id="webservice.definition.loader.annot_file" class="Bundle\WebServiceBundle\ServiceDefinition\Loader\AnnotationFileLoader">
@ -66,13 +57,8 @@
<argument type="service" id="annotations.configuration_reader" /> <argument type="service" id="annotations.configuration_reader" />
</service> </service>
<service id="webservice.definition.dumper.wsdl.rpcliteral" class="Bundle\WebServiceBundle\ServiceDefinition\Dumper\WsdlDumper"> <service id="webservice.definition.dumper.wsdl.rpcliteral" class="Bundle\WebServiceBundle\ServiceDefinition\Dumper\WsdlDumper">
</service>
<!--
<service id="webservice.definition.dumper.wsdl.documentwrapped" class="">
</service> </service>
--> </services>
</services>
</container> </container>

View File

@ -16,16 +16,14 @@ class DocumentLiteralWrappedRequestMessageBinder implements MessageBinderInterfa
{ {
public function processMessage(Method $messageDefinition, $message) public function processMessage(Method $messageDefinition, $message)
{ {
if(count($message) > 1) if(count($message) > 1) {
{
throw new \InvalidArgumentException(); throw new \InvalidArgumentException();
} }
$result = array(); $result = array();
$message = $message[0]; $message = $message[0];
foreach($messageDefinition->getArguments() as $argument) foreach($messageDefinition->getArguments() as $argument) {
{
$result[$argument->getName()] = $message->{$argument->getName()}; $result[$argument->getName()] = $message->{$argument->getName()};
} }

View File

@ -15,8 +15,6 @@ use Bundle\WebServiceBundle\ServiceDefinition\Method;
interface MessageBinderInterface interface MessageBinderInterface
{ {
/** /**
*
*
* @param Method $messageDefinition * @param Method $messageDefinition
* @param mixed $message * @param mixed $message
* *

View File

@ -19,9 +19,9 @@ class RpcLiteralRequestMessageBinder implements MessageBinderInterface
$result = array(); $result = array();
$i = 0; $i = 0;
foreach($messageDefinition->getArguments() as $argument) foreach($messageDefinition->getArguments() as $argument) {
{
$result[$argument->getName()] = $message[$i]; $result[$argument->getName()] = $message[$i];
$i++; $i++;
} }

View File

@ -42,18 +42,15 @@ class WsdlDumper implements DumperInterface
$wsdl->addSoapBinding($binding, 'rpc'); $wsdl->addSoapBinding($binding, 'rpc');
$wsdl->addService($this->getServiceName(), $this->getPortName(), 'tns:' . $this->getBindingName(), $options['endpoint']); $wsdl->addService($this->getServiceName(), $this->getPortName(), 'tns:' . $this->getBindingName(), $options['endpoint']);
foreach($definition->getMethods() as $method) foreach($definition->getMethods() as $method) {
{
$requestParts = array(); $requestParts = array();
$responseParts = array(); $responseParts = array();
foreach($method->getArguments() as $argument) foreach($method->getArguments() as $argument) {
{
$requestParts[$argument->getName()] = $wsdl->getType($argument->getType()->getPhpType()); $requestParts[$argument->getName()] = $wsdl->getType($argument->getType()->getPhpType());
} }
if($method->getReturn() !== null) if($method->getReturn() !== null) {
{
$responseParts['return'] = $wsdl->getType($method->getReturn()->getPhpType()); $responseParts['return'] = $wsdl->getType($method->getReturn()->getPhpType());
} }

View File

@ -60,8 +60,7 @@ class AnnotationClassLoader implements LoaderInterface
*/ */
public function load($class, $type = null) public function load($class, $type = null)
{ {
if (!class_exists($class)) if (!class_exists($class)) {
{
throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class)); throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
} }
@ -69,12 +68,10 @@ class AnnotationClassLoader implements LoaderInterface
$definition = new ServiceDefinition(); $definition = new ServiceDefinition();
foreach ($class->getMethods() as $method) foreach ($class->getMethods() as $method) {
{
$wsMethodAnnot = $this->reader->getMethodAnnotation($method, $this->wsMethodAnnotationClass); $wsMethodAnnot = $this->reader->getMethodAnnotation($method, $this->wsMethodAnnotationClass);
if($wsMethodAnnot !== null) if($wsMethodAnnot !== null) {
{
$wsParamAnnots = $this->reader->getMethodAnnotations($method, $this->wsParamAnnotationClass); $wsParamAnnots = $this->reader->getMethodAnnotations($method, $this->wsParamAnnotationClass);
$wsResultAnnot = $this->reader->getMethodAnnotation($method, $this->wsResultAnnotationClass); $wsResultAnnot = $this->reader->getMethodAnnotation($method, $this->wsResultAnnotationClass);
@ -82,8 +79,7 @@ class AnnotationClassLoader implements LoaderInterface
$serviceMethod->setName($wsMethodAnnot->getName($method->getName())); $serviceMethod->setName($wsMethodAnnot->getName($method->getName()));
$serviceMethod->setController($this->getController($method, $wsMethodAnnot)); $serviceMethod->setController($this->getController($method, $wsMethodAnnot));
foreach($wsParamAnnots as $wsParamAnnot) foreach($wsParamAnnots as $wsParamAnnot) {
{
$serviceArgument = new Argument(); $serviceArgument = new Argument();
$serviceArgument->setName($wsParamAnnot->getName()); $serviceArgument->setName($wsParamAnnot->getName());
$serviceArgument->setType(new Type($wsParamAnnot->getPhpType(), $wsParamAnnot->getXmlType())); $serviceArgument->setType(new Type($wsParamAnnot->getPhpType(), $wsParamAnnot->getXmlType()));
@ -91,8 +87,7 @@ class AnnotationClassLoader implements LoaderInterface
$serviceMethod->getArguments()->add($serviceArgument); $serviceMethod->getArguments()->add($serviceArgument);
} }
if($wsResultAnnot !== null) if($wsResultAnnot !== null) {
{
$serviceMethod->setReturn(new Type($wsResultAnnot->getPhpType(), $wsResultAnnot->getXmlType())); $serviceMethod->setReturn(new Type($wsResultAnnot->getPhpType(), $wsResultAnnot->getXmlType()));
} }
@ -105,12 +100,9 @@ class AnnotationClassLoader implements LoaderInterface
private function getController(\ReflectionMethod $method, MethodAnnotation $annotation) private function getController(\ReflectionMethod $method, MethodAnnotation $annotation)
{ {
if($annotation->getService() !== null) if($annotation->getService() !== null) {
{
return $annotation->getService() . ':' . $method->name; return $annotation->getService() . ':' . $method->name;
} } else {
else
{
return $method->class . '::' . $method->name; return $method->class . '::' . $method->name;
} }
} }

View File

@ -23,8 +23,7 @@ class AnnotationReader extends BaseAnnotationReader
{ {
$annotation = parent::getMethodAnnotation($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)); throw new \LogicException(sprintf("There is more than one annotation of type '%s'!", $type));
} }

View File

@ -35,13 +35,11 @@ class XmlFileLoader extends FileLoader
$definition->setName((string) $xml['name']); $definition->setName((string) $xml['name']);
$definition->setNamespace((string) $xml['namespace']); $definition->setNamespace((string) $xml['namespace']);
foreach($xml->header as $header) foreach($xml->header as $header) {
{
$definition->getHeaders()->add($this->parseHeader($header)); $definition->getHeaders()->add($this->parseHeader($header));
} }
foreach($xml->method as $method) foreach($xml->method as $method) {
{
$definition->getMethods()->add($this->parseMethod($method)); $definition->getMethods()->add($this->parseMethod($method));
} }
@ -69,8 +67,7 @@ class XmlFileLoader extends FileLoader
{ {
$method = new Method((string)$node['name'], (string)$node['controller']); $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)); $method->getArguments()->add($this->parseArgument($argument));
} }

View File

@ -1,81 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <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" /> <element name="webservice" type="tns:WebserviceType" />
<complexType name="WebserviceType"> <complexType name="WebserviceType">
<sequence> <sequence>
<element name="header" type="tns:HeaderType" minOccurs="0" maxOccurs="unbounded" /> <element name="header" type="tns:HeaderType" minOccurs="0" maxOccurs="unbounded" />
<element name="method" type="tns:MethodType" maxOccurs="unbounded" /> <element name="method" type="tns:MethodType" maxOccurs="unbounded" />
</sequence> </sequence>
<attribute name="name" type="string" use="required" /> <attribute name="name" type="string" use="required" />
</complexType> </complexType>
<complexType name="HeaderType"> <complexType name="HeaderType">
<complexContent> <complexContent>
<extension base="tns:TransferObjectType"> <extension base="tns:TransferObjectType">
<sequence> <sequence>
<element name="exception" type="tns:ExceptionType" minOccurs="0" maxOccurs="unbounded" /> <element name="exception" type="tns:ExceptionType" minOccurs="0" maxOccurs="unbounded" />
</sequence> </sequence>
<attribute name="name" type="ID" use="required" /> <attribute name="name" type="ID" use="required" />
</extension> </extension>
</complexContent> </complexContent>
</complexType> </complexType>
<complexType name="HeaderRefType"> <complexType name="HeaderRefType">
<attribute name="name" type="IDREF" /> <attribute name="name" type="IDREF" />
<attribute name="direction"> <attribute name="direction">
<simpleType> <simpleType>
<restriction base="string"> <restriction base="string">
<enumeration value="in" /> <enumeration value="in" />
<enumeration value="out" /> <enumeration value="out" />
<enumeration value="inout" /> <enumeration value="inout" />
</restriction> </restriction>
</simpleType> </simpleType>
</attribute> </attribute>
</complexType> </complexType>
<complexType name="MethodType"> <complexType name="MethodType">
<sequence> <sequence>
<element name="exception" type="tns:ExceptionType" minOccurs="0" maxOccurs="unbounded" /> <element name="exception" type="tns:ExceptionType" minOccurs="0" maxOccurs="unbounded" />
<element name="header" type="tns:HeaderRefType" 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="argument" type="tns:ArgumentType" minOccurs="0" maxOccurs="unbounded" />
<element name="return" type="tns:ReturnType" minOccurs="0" maxOccurs="1" /> <element name="return" type="tns:ReturnType" minOccurs="0" maxOccurs="1" />
</sequence> </sequence>
<attribute name="name" type="string" use="required" /> <attribute name="name" type="string" use="required" />
<attribute name="controller" type="string" use="required" /> <attribute name="controller" type="string" use="required" />
</complexType> </complexType>
<complexType name="TransferObjectType" abstract="true"> <complexType name="TransferObjectType" abstract="true">
<sequence> <sequence>
<element name="type" type="tns:TypeConversionType" /> <element name="type" type="tns:TypeConversionType" />
</sequence> </sequence>
</complexType> </complexType>
<complexType name="ExceptionType"> <complexType name="ExceptionType">
<complexContent> <complexContent>
<extension base="tns:TransferObjectType"> <extension base="tns:TransferObjectType">
<attribute name="name" type="string" use="required" /> <attribute name="name" type="string" use="required" />
</extension> </extension>
</complexContent> </complexContent>
</complexType> </complexType>
<complexType name="ArgumentType"> <complexType name="ArgumentType">
<complexContent> <complexContent>
<extension base="tns:TransferObjectType"> <extension base="tns:TransferObjectType">
<attribute name="name" type="string" use="required" /> <attribute name="name" type="string" use="required" />
</extension> </extension>
</complexContent> </complexContent>
</complexType> </complexType>
<complexType name="ReturnType"> <complexType name="ReturnType">
<complexContent> <complexContent>
<extension base="tns:TransferObjectType" /> <extension base="tns:TransferObjectType" />
</complexContent> </complexContent>
</complexType> </complexType>
<complexType name="TypeConversionType"> <complexType name="TypeConversionType">
<attribute name="php-type" type="string" use="required" /> <attribute name="php-type" type="string" use="required" />
<attribute name="xml-type" type="QName" use="required" /> <attribute name="xml-type" type="QName" use="required" />
<attribute name="converter" type="string" use="optional" /> <attribute name="converter" type="string" use="optional" />
</complexType> </complexType>
</schema> </schema>

View File

@ -67,8 +67,7 @@ class SoapRequest extends Request
*/ */
public function getSoapMessage() public function getSoapMessage()
{ {
if($this->soapMessage === null) if($this->soapMessage === null) {
{
$this->soapMessage = $this->initializeSoapMessage(); $this->soapMessage = $this->initializeSoapMessage();
} }
@ -87,19 +86,14 @@ class SoapRequest extends Request
protected function initializeSoapMessage() protected function initializeSoapMessage()
{ {
if($this->server->has('CONTENT_TYPE')) if($this->server->has('CONTENT_TYPE')) {
{
$type = $this->splitContentTypeHeader($this->server->get('CONTENT_TYPE')); $type = $this->splitContentTypeHeader($this->server->get('CONTENT_TYPE'));
switch($type['_type']) switch($type['_type']) {
{
case 'multipart/related': case 'multipart/related':
if($type['type'] == 'application/xop+xml') if($type['type'] == 'application/xop+xml') {
{
return $this->initializeMtomSoapMessage($type, $this->getContent()); return $this->initializeMtomSoapMessage($type, $this->getContent());
} } else {
else
{
//log error //log error
} }
break; break;
@ -118,8 +112,7 @@ class SoapRequest extends Request
protected function initializeMtomSoapMessage(array $contentTypeHeader, $content) 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(); throw new \InvalidArgumentException();
} }
@ -134,13 +127,11 @@ class SoapRequest extends Request
// TODO: add more checks to achieve full compatibility to MTOM spec // TODO: add more checks to achieve full compatibility to MTOM spec
// http://www.w3.org/TR/soap12-mtom/ // 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(); throw new \InvalidArgumentException();
} }
foreach($mimeParts as $mimePart) foreach($mimeParts as $mimePart) {
{
$this->soapAttachments->add(new SoapAttachment( $this->soapAttachments->add(new SoapAttachment(
$mimePart->id, $mimePart->id,
$mimePart->type, $mimePart->type,
@ -160,8 +151,7 @@ class SoapRequest extends Request
$result['_type'] = array_shift($parts); $result['_type'] = array_shift($parts);
foreach($parts as $part) foreach($parts as $part) {
{
list($key, $value) = explode('=', trim($part), 2); list($key, $value) = explode('=', trim($part), 2);
$result[$key] = trim($value, '"'); $result[$key] = trim($value, '"');

View File

@ -57,8 +57,7 @@ class SoapServerFactory
{ {
$result = array(); $result = array();
foreach($this->converters->getTypeConverters() as $typeConverter) foreach($this->converters->getTypeConverters() as $typeConverter) {
{
$result[] = array( $result[] = array(
'type_name' => $typeConverter->getTypeName(), 'type_name' => $typeConverter->getTypeName(),
'type_ns' => $typeConverter->getTypeNamespace(), 'type_ns' => $typeConverter->getTypeNamespace(),
@ -78,15 +77,12 @@ class SoapServerFactory
{ {
$result = array(); $result = array();
foreach($this->definition->getHeaders() as $header) foreach($this->definition->getHeaders() as $header) {
{
$this->addSoapServerClassmapEntry($result, $header->getType()); $this->addSoapServerClassmapEntry($result, $header->getType());
} }
foreach($this->definition->getMethods() as $method) foreach($this->definition->getMethods() as $method) {
{ foreach($method->getArguments() as $arg) {
foreach($method->getArguments() as $arg)
{
$this->addSoapServerClassmapEntry($result, $arg->getType()); $this->addSoapServerClassmapEntry($result, $arg->getType());
} }
} }
@ -102,8 +98,7 @@ class SoapServerFactory
$xmlType = QName::fromPackedQName($type->getXmlType())->getName(); $xmlType = QName::fromPackedQName($type->getXmlType())->getName();
$phpType = $type->getPhpType(); $phpType = $type->getPhpType();
if(isset($classmap[$xmlType]) && $classmap[$xmlType] != $phpType) if(isset($classmap[$xmlType]) && $classmap[$xmlType] != $phpType) {
{
// log warning // log warning
} }

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?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 "> <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=""> <method name="math_multiply" controller="">
<argument name="a"> <argument name="a">
<type xml-type="xs:double" php-type="float"/> <type xml-type="xs:double" php-type="float"/>
</argument> </argument>
<argument name="b"> <argument name="b">
<type xml-type="xs:double" php-type="float"/> <type xml-type="xs:double" php-type="float"/>
</argument> </argument>
<return> <return>
<type xml-type="xs:double" php-type="float"/> <type xml-type="xs:double" php-type="float"/>
</return> </return>
</method> </method>
</webservice> </webservice>

View File

@ -1,145 +1,145 @@
<?xml version="1.0" encoding="utf-8"?> <?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: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"> <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:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://localhost/">
<xsd:complexType name="AuthHeader"> <xsd:complexType name="AuthHeader">
<xsd:sequence> <xsd:sequence>
<xsd:element name="username" type="xsd:string"/> <xsd:element name="username" type="xsd:string"/>
<xsd:element name="password" type="xsd:string"/> <xsd:element name="password" type="xsd:string"/>
</xsd:sequence> </xsd:sequence>
</xsd:complexType> </xsd:complexType>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="AuthHeaderElement" type="tns:AuthHeader"/> <xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="AuthHeaderElement" type="tns:AuthHeader"/>
<xsd:complexType name="DoubleArray"> <xsd:complexType name="DoubleArray">
<xsd:sequence> <xsd:sequence>
<xsd:element name="item" type="xsd:double" minOccurs="0" maxOccurs="unbounded"/> <xsd:element name="item" type="xsd:double" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence> </xsd:sequence>
</xsd:complexType> </xsd:complexType>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="DoubleArrayElement" type="tns:DoubleArray"/> <xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="DoubleArrayElement" type="tns:DoubleArray"/>
<xsd:complexType name="ComplexNumber"> <xsd:complexType name="ComplexNumber">
<xsd:sequence> <xsd:sequence>
<xsd:element name="realPart" type="xsd:double"/> <xsd:element name="realPart" type="xsd:double"/>
<xsd:element name="imaginaryPart" type="xsd:double"/> <xsd:element name="imaginaryPart" type="xsd:double"/>
</xsd:sequence> </xsd:sequence>
</xsd:complexType> </xsd:complexType>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ComplexNumberElement" type="tns:ComplexNumber"/> <xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ComplexNumberElement" type="tns:ComplexNumber"/>
<xsd:complexType name="ComplexNumberArray"> <xsd:complexType name="ComplexNumberArray">
<xsd:sequence> <xsd:sequence>
<xsd:element name="item" type="tns:ComplexNumber" minOccurs="0" maxOccurs="unbounded"/> <xsd:element name="item" type="tns:ComplexNumber" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence> </xsd:sequence>
</xsd:complexType> </xsd:complexType>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ComplexNumberArrayElement" type="tns:ComplexNumberArray"/> <xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ComplexNumberArrayElement" type="tns:ComplexNumberArray"/>
</xsd:schema> </xsd:schema>
</wsdl:types> </wsdl:types>
<wsdl:portType name="MathApiPortType"> <wsdl:portType name="MathApiPortType">
<wsdl:operation name="math_multiply" parameterOrder="a b"> <wsdl:operation name="math_multiply" parameterOrder="a b">
<wsdl:input message="tns:math_multiplyRequest"/> <wsdl:input message="tns:math_multiplyRequest"/>
<wsdl:output message="tns:math_multiplyResponse"/> <wsdl:output message="tns:math_multiplyResponse"/>
</wsdl:operation> </wsdl:operation>
<wsdl:operation name="SimpleMultiply" parameterOrder="a b"> <wsdl:operation name="SimpleMultiply" parameterOrder="a b">
<wsdl:input message="tns:SimpleMultiplyRequest"/> <wsdl:input message="tns:SimpleMultiplyRequest"/>
<wsdl:output message="tns:SimpleMultiplyResponse"/> <wsdl:output message="tns:SimpleMultiplyResponse"/>
</wsdl:operation> </wsdl:operation>
<wsdl:operation name="SimpleMultiplyWithHeader" parameterOrder="AuthHeader a b"> <wsdl:operation name="SimpleMultiplyWithHeader" parameterOrder="AuthHeader a b">
<wsdl:input message="tns:SimpleMultiplyWithHeaderRequest"/> <wsdl:input message="tns:SimpleMultiplyWithHeaderRequest"/>
<wsdl:output message="tns:SimpleMultiplyWithHeaderResponse"/> <wsdl:output message="tns:SimpleMultiplyWithHeaderResponse"/>
</wsdl:operation> </wsdl:operation>
<wsdl:operation name="ArrayMultiply" parameterOrder="factors"> <wsdl:operation name="ArrayMultiply" parameterOrder="factors">
<wsdl:input message="tns:ArrayMultiplyRequest"/> <wsdl:input message="tns:ArrayMultiplyRequest"/>
<wsdl:output message="tns:ArrayMultiplyResponse"/> <wsdl:output message="tns:ArrayMultiplyResponse"/>
</wsdl:operation> </wsdl:operation>
<wsdl:operation name="ComplexMultiply" parameterOrder="input"> <wsdl:operation name="ComplexMultiply" parameterOrder="input">
<wsdl:input message="tns:ComplexMultiplyRequest"/> <wsdl:input message="tns:ComplexMultiplyRequest"/>
<wsdl:output message="tns:ComplexMultiplyResponse"/> <wsdl:output message="tns:ComplexMultiplyResponse"/>
</wsdl:operation> </wsdl:operation>
</wsdl:portType> </wsdl:portType>
<wsdl:binding xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="MathApiBinding" type="tns:MathApiPortType"> <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"/> <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"> <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"/> <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/"> <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: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:input>
<wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <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: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:output>
</wsdl:operation> </wsdl:operation>
<wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="SimpleMultiply"> <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"/> <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/"> <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: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:input>
<wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <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: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:output>
</wsdl:operation> </wsdl:operation>
<wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="SimpleMultiplyWithHeader"> <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"/> <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/"> <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: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/"/> <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:input>
<wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <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: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/"/> <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:output>
</wsdl:operation> </wsdl:operation>
<wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="ArrayMultiply"> <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"/> <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/"> <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/"/> <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:input>
<wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <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: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:output>
</wsdl:operation> </wsdl:operation>
<wsdl:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="ComplexMultiply"> <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"/> <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/"> <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/"/> <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:input>
<wsdl:output xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <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: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:output>
</wsdl:operation> </wsdl:operation>
</wsdl:binding> </wsdl:binding>
<wsdl:message name="math_multiplyRequest"> <wsdl:message name="math_multiplyRequest">
<wsdl:part name="a" type="xsd:double"/> <wsdl:part name="a" type="xsd:double"/>
<wsdl:part name="b" type="xsd:double"/> <wsdl:part name="b" type="xsd:double"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="math_multiplyResponse"> <wsdl:message name="math_multiplyResponse">
<wsdl:part name="result" type="xsd:double"/> <wsdl:part name="result" type="xsd:double"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="SimpleMultiplyRequest"> <wsdl:message name="SimpleMultiplyRequest">
<wsdl:part name="a" type="xsd:double"/> <wsdl:part name="a" type="xsd:double"/>
<wsdl:part name="b" type="xsd:double"/> <wsdl:part name="b" type="xsd:double"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="SimpleMultiplyResponse"> <wsdl:message name="SimpleMultiplyResponse">
<wsdl:part name="result" type="xsd:double"/> <wsdl:part name="result" type="xsd:double"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="SimpleMultiplyWithHeaderRequest"> <wsdl:message name="SimpleMultiplyWithHeaderRequest">
<wsdl:part name="AuthHeader" element="tns:AuthHeaderElement"/> <wsdl:part name="AuthHeader" element="tns:AuthHeaderElement"/>
<wsdl:part name="a" type="xsd:double"/> <wsdl:part name="a" type="xsd:double"/>
<wsdl:part name="b" type="xsd:double"/> <wsdl:part name="b" type="xsd:double"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="SimpleMultiplyWithHeaderResponse"> <wsdl:message name="SimpleMultiplyWithHeaderResponse">
<wsdl:part name="AuthHeader" element="tns:AuthHeaderElement"/> <wsdl:part name="AuthHeader" element="tns:AuthHeaderElement"/>
<wsdl:part name="result" type="xsd:double"/> <wsdl:part name="result" type="xsd:double"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="ArrayMultiplyRequest"> <wsdl:message name="ArrayMultiplyRequest">
<wsdl:part name="factors" type="tns:DoubleArray"/> <wsdl:part name="factors" type="tns:DoubleArray"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="ArrayMultiplyResponse"> <wsdl:message name="ArrayMultiplyResponse">
<wsdl:part name="result" type="xsd:double"/> <wsdl:part name="result" type="xsd:double"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="ComplexMultiplyRequest"> <wsdl:message name="ComplexMultiplyRequest">
<wsdl:part name="input" type="tns:ComplexNumberArray"/> <wsdl:part name="input" type="tns:ComplexNumberArray"/>
</wsdl:message> </wsdl:message>
<wsdl:message name="ComplexMultiplyResponse"> <wsdl:message name="ComplexMultiplyResponse">
<wsdl:part name="result" type="tns:ComplexNumber"/> <wsdl:part name="result" type="tns:ComplexNumber"/>
</wsdl:message> </wsdl:message>
<wsdl:service xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="MathApiService"> <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"> <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"/> <soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="http://localhost/MathApi.php"/>
</wsdl:port> </wsdl:port>
</wsdl:service> </wsdl:service>
</wsdl:definitions> </wsdl:definitions>

View File

@ -21,8 +21,7 @@ class Assert
public static function thatArgument($name, $condition, $message = self::ARGUMENT_INVALID) public static function thatArgument($name, $condition, $message = self::ARGUMENT_INVALID)
{ {
if(!$condition) if(!$condition) {
{
throw new \InvalidArgumentException(sprintf($message, $name)); throw new \InvalidArgumentException(sprintf($message, $name));
} }
} }

View File

@ -27,8 +27,7 @@ class Collection implements \IteratorAggregate, \Countable
public function addAll($elements) public function addAll($elements)
{ {
foreach ($elements as $element) foreach ($elements as $element) {
{
$this->add($element); $this->add($element);
} }
} }

View File

@ -17,35 +17,34 @@ namespace Bundle\WebServiceBundle\Util;
*/ */
class String class String
{ {
/** /**
* Checks if a string starts with a given string. * Checks if a string starts with a given string.
* *
* @param string $str A string * @param string $str A string
* @param string $substr A string to check against * @param string $substr A string to check against
* *
* @return bool True if str starts with substr * @return bool True if str starts with substr
*/ */
public static function startsWith($str, $substr) public static function startsWith($str, $substr)
{
if(is_string($str) && is_string($substr) && strlen($str) >= strlen($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. * Checks if a string ends with a given string.
* *
* @param string $str A string * @param string $str A string
* @param string $substr A string to check against * @param string $substr A string to check against
* *
* @return bool True if str ends with substr * @return bool True if str ends with substr
*/ */
public static function endsWith($str, $substr) public static function endsWith($str, $substr)
{
if(is_string($str) && is_string($substr) && strlen($str) >= strlen($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));
}
} }
}
} }

View File

@ -54,10 +54,8 @@ class WebServiceContext
public function getServiceDefinition() public function getServiceDefinition()
{ {
if($this->serviceDefinition === null) if($this->serviceDefinition === null) {
{ if(!$this->serviceDefinitionLoader->supports($this->options['resource'], $this->options['resource_type'])) {
if(!$this->serviceDefinitionLoader->supports($this->options['resource'], $this->options['resource_type']))
{
throw new \LogicException(); throw new \LogicException();
} }
@ -75,8 +73,7 @@ class WebServiceContext
$file = sprintf('%s/%s.wsdl', $this->options['cache_dir'], $this->options['name'] . $id); $file = sprintf('%s/%s.wsdl', $this->options['cache_dir'], $this->options['name'] . $id);
$cache = new ConfigCache($file, true); $cache = new ConfigCache($file, true);
if(!$cache->isFresh()) if(!$cache->isFresh()) {
{
$cache->write($this->wsdlFileDumper->dumpServiceDefinition($this->getServiceDefinition(), array('endpoint' => $endpoint))); $cache->write($this->wsdlFileDumper->dumpServiceDefinition($this->getServiceDefinition(), array('endpoint' => $endpoint)));
} }
@ -90,8 +87,7 @@ class WebServiceContext
public function getServiceBinder() public function getServiceBinder()
{ {
if($this->serviceBinder === null) if($this->serviceBinder === null) {
{
$this->serviceBinder = new ServiceBinder($this->getServiceDefinition(), $this->requestMessageBinder, $this->responseMessageBinder); $this->serviceBinder = new ServiceBinder($this->getServiceDefinition(), $this->requestMessageBinder, $this->responseMessageBinder);
} }
@ -100,8 +96,7 @@ class WebServiceContext
public function getServerFactory() public function getServerFactory()
{ {
if($this->serverFactory === null) if($this->serverFactory === null) {
{
$this->serverFactory = new SoapServerFactory($this->getServiceDefinition(), $this->getWsdlFile(), $this->converterRepository); $this->serverFactory = new SoapServerFactory($this->getServiceDefinition(), $this->getWsdlFile(), $this->converterRepository);
} }