25 Commits
5.1.0 ... 5.2.1

Author SHA1 Message Date
5d335f2ca9 Correction de l'écriture du xml 2020-07-15 12:35:40 -04:00
9d6468d0a6 Update composer.json 2020-07-15 11:25:49 -04:00
9786f291b0 Update composer.json 2020-07-15 11:25:04 -04:00
750db6692b Update composer.json 2020-07-15 11:24:05 -04:00
9f7b7f40b8 Merge pull request #4 from Cadoles/develop
Add minOccurs annotation support on complexType
2020-07-15 16:29:05 +02:00
87947a1e7b Merge branch 'mse' into develop 2020-07-15 16:26:24 +02:00
e024833d48 Add minOccurs annotation support on complexType 2020-07-15 16:16:25 +02:00
fc44014790 Définition timeout curl a 10 secondes 2019-10-24 16:34:14 -04:00
7ba9c4048c Nouvelle méthode de validation des WSDL 2019-10-10 15:20:59 -04:00
f0733bd671 Nouvelle méthode de validation des WSDL 2019-10-10 15:17:16 -04:00
f5e1be09de Merge branch 'mse' of github.com:Cadoles/BeSimpleSoap into mse 2019-10-10 15:16:24 -04:00
df3d75047f Nouvelle méthode de validation des WSDL 2019-10-10 15:16:10 -04:00
87350704d3 Merge pull request #2 from Cadoles/issue#1
vérification fichier de cache vide ou xml erronné
2019-09-24 09:19:38 -04:00
85f86469ab Merge OK 2019-09-24 09:17:28 -04:00
e1a35d1e1e Vérification fichier de cache vide ou xml erronné 2019-09-24 08:54:47 -04:00
30850d7a01 Merge pull request #3 from Cadoles/php-cs-fixer
Passe générale php-cs-fixer
2019-09-24 08:50:42 -04:00
77403fcfbb Suppression fichier de cache cs-fixer 2019-09-24 08:45:47 -04:00
dc63ba20e4 ajouter fichier de cache cs-fixer au gitignore 2019-09-24 08:43:49 -04:00
dad2b76165 Passe générale php-cs-fixer 2019-09-24 08:23:19 -04:00
a1695680ae Signature de Response iso PROD 2019-09-20 12:10:09 -04:00
95706abbd7 Retour à une signature iso PROD 2019-09-19 15:29:04 -04:00
6d5f9ff9e5 Show null attributes in response
Partially revert changes from d1f5c1f674 and fea1093bed
2019-09-16 16:41:21 +02:00
914acccf1d Ignore .php_cs.cache files 2019-09-12 11:45:48 +02:00
0c94185907 Revert "Fix Dumper. Each complext type is now wrapped inside container element tag"
This reverts commit 7802a0d19f.
2019-09-12 11:44:47 +02:00
aa0b750f47 Revert "Array support change"
This reverts commit 3f2a99adf6.
2019-09-12 11:43:53 +02:00
83 changed files with 240 additions and 337 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ composer.lock
composer.phar composer.phar
phpunit.xml phpunit.xml
.idea .idea
.php_cs.cache

View File

@ -47,7 +47,7 @@
}, },
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "master-dev" "dev-master": "5.2.0-dev"
} }
} }
} }

View File

@ -19,7 +19,6 @@ use BeSimple\SoapBundle\WebServiceContext;
use BeSimple\SoapServer\SoapServerBuilder; use BeSimple\SoapServer\SoapServerBuilder;
use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait; use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Debug\Exception\FlattenException; use Symfony\Component\Debug\Exception\FlattenException;
@ -59,7 +58,7 @@ class SoapWebServiceController implements ContainerAwareInterface
/** /**
* @var array * @var array
*/ */
private $headers = array(); private $headers = [];
/** /**
* @return \BeSimple\SoapBundle\Soap\SoapResponse * @return \BeSimple\SoapBundle\Soap\SoapResponse
@ -67,12 +66,12 @@ class SoapWebServiceController implements ContainerAwareInterface
public function callAction($webservice) public function callAction($webservice)
{ {
/** @var WebServiceContext $webServiceContext */ /** @var WebServiceContext $webServiceContext */
$webServiceContext = $this->getWebServiceContext($webservice); $webServiceContext = $this->getWebServiceContext($webservice);
$this->serviceBinder = $webServiceContext->getServiceBinder(); $this->serviceBinder = $webServiceContext->getServiceBinder();
$this->soapRequest = SoapRequest::createFromHttpRequest($this->container->get('request_stack')->getCurrentRequest()); $this->soapRequest = SoapRequest::createFromHttpRequest($this->container->get('request_stack')->getCurrentRequest());
$this->soapServer = $webServiceContext $this->soapServer = $webServiceContext
->getServerBuilder() ->getServerBuilder()
->withSoapVersion11() ->withSoapVersion11()
->withHandler($this) ->withHandler($this)
@ -94,16 +93,16 @@ class SoapWebServiceController implements ContainerAwareInterface
*/ */
public function definitionAction($webservice) public function definitionAction($webservice)
{ {
$routeName = $webservice . '_webservice_call'; $routeName = $webservice.'_webservice_call';
$result = $this->container->get('router')->getRouteCollection()->get($routeName); $result = $this->container->get('router')->getRouteCollection()->get($routeName);
if ($result === null) { if (null === $result) {
$routeName = '_webservice_call'; $routeName = '_webservice_call';
} }
$response = new Response($this->getWebServiceContext($webservice)->getWsdlFileContent( $response = new Response($this->getWebServiceContext($webservice)->getWsdlFileContent(
$this->container->get('router')->generate( $this->container->get('router')->generate(
$routeName, $routeName,
array('webservice' => $webservice), ['webservice' => $webservice],
UrlGeneratorInterface::ABSOLUTE_URL UrlGeneratorInterface::ABSOLUTE_URL
) )
)); ));
@ -137,12 +136,12 @@ class SoapWebServiceController implements ContainerAwareInterface
$view = '@Twig/Exception/'.($this->container->get('kernel')->isDebug() ? 'exception' : 'error').'.txt.twig'; $view = '@Twig/Exception/'.($this->container->get('kernel')->isDebug() ? 'exception' : 'error').'.txt.twig';
$code = $exception->getStatusCode(); $code = $exception->getStatusCode();
$details = $this->container->get('twig')->render($view, array( $details = $this->container->get('twig')->render($view, [
'status_code' => $code, 'status_code' => $code,
'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '', 'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '',
'exception' => $exception, 'exception' => $exception,
'logger' => $logger, 'logger' => $logger,
)); ]);
$handler = new ExceptionHandler($exception, $details); $handler = new ExceptionHandler($exception, $details);
if ($soapFault = $request->query->get('_besimple_soap_fault')) { if ($soapFault = $request->query->get('_besimple_soap_fault')) {
@ -176,8 +175,8 @@ class SoapWebServiceController implements ContainerAwareInterface
* This method gets called once for every SOAP header the \SoapServer received * This method gets called once for every SOAP header the \SoapServer received
* and afterwards once for the called SOAP operation. * and afterwards once for the called SOAP operation.
* *
* @param string $method The SOAP header or SOAP operation name * @param string $method The SOAP header or SOAP operation name
* @param array $arguments * @param array $arguments
* *
* @return mixed * @return mixed
*/ */
@ -234,7 +233,7 @@ class SoapWebServiceController implements ContainerAwareInterface
} }
/** /**
* Set the SoapResponse * Set the SoapResponse.
* *
* @param Response $response A response to check and set * @param Response $response A response to check and set
* *

View File

@ -48,7 +48,7 @@ class TypeRepository
public function fixTypeInformation(ServiceDefinition $definition) public function fixTypeInformation(ServiceDefinition $definition)
{ {
foreach($definition->getAllTypes() as $type) { foreach ($definition->getAllTypes() as $type) {
$phpType = $type->getPhpType(); $phpType = $type->getPhpType();
$xmlType = $type->getXmlType(); $xmlType = $type->getXmlType();

View File

@ -60,7 +60,7 @@ class BeSimpleSoapExtension extends Extension
$container->setParameter('besimple.soap.definition.dumper.options.stylesheet', $config['wsdl_dumper']['stylesheet']); $container->setParameter('besimple.soap.definition.dumper.options.stylesheet', $config['wsdl_dumper']['stylesheet']);
foreach($config['services'] as $name => $serviceConfig) { foreach ($config['services'] as $name => $serviceConfig) {
$serviceConfig['name'] = $name; $serviceConfig['name'] = $name;
$this->createWebServiceContext($serviceConfig, $container); $this->createWebServiceContext($serviceConfig, $container);
} }

View File

@ -96,8 +96,12 @@ class Configuration
->info('proxy configuration') ->info('proxy configuration')
->addDefaultsIfNotSet() ->addDefaultsIfNotSet()
->beforeNormalization() ->beforeNormalization()
->ifTrue(function ($v) { return !is_array($v); }) ->ifTrue(function ($v) {
->then(function ($v) { return array('host' => null === $v ? false : $v); }) return !is_array($v);
})
->then(function ($v) {
return array('host' => null === $v ? false : $v);
})
->end() ->end()
->children() ->children()
->scalarNode('host')->defaultFalse()->end() ->scalarNode('host')->defaultFalse()->end()

View File

@ -20,14 +20,14 @@ class DocumentLiteralWrappedRequestMessageBinder implements MessageBinderInterfa
{ {
public function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository) public function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository)
{ {
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->getInput()->all() as $argument) { foreach ($messageDefinition->getInput()->all() as $argument) {
$result[$argument->getName()] = $message; $result[$argument->getName()] = $message;
} }

View File

@ -24,5 +24,5 @@ interface MessageBinderInterface
* *
* @return mixed * @return mixed
*/ */
function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository); public function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository);
} }

View File

@ -55,8 +55,7 @@ class RpcLiteralRequestMessageBinder implements MessageBinderInterface
$isArray = true; $isArray = true;
$array = array(); $array = array();
$phpType = substr($type->getPhpType(), 0, strlen($type->getPhpType()) - 2); $type = $this->typeRepository->getType($type->get('item')->getType());
$type = $this->typeRepository->getType($phpType);
} }
// @TODO Fix array reference // @TODO Fix array reference
@ -79,21 +78,6 @@ class RpcLiteralRequestMessageBinder implements MessageBinderInterface
$array = $assocArray; $array = $assocArray;
} }
} }
if (is_array($message)) {
foreach ($message as $complexType) {
$array[] = $this->checkComplexType($phpType, $complexType);
}
// See https://github.com/BeSimple/BeSimpleSoapBundle/issues/29
if (in_array('BeSimple\SoapCommon\Type\AbstractKeyValue', class_parents($phpType))) {
$assocArray = array();
foreach ($array as $keyValue) {
$assocArray[$keyValue->getKey()] = $keyValue->getValue();
}
$array = $assocArray;
}
}
$message = $array; $message = $array;
} else { } else {

View File

@ -44,7 +44,8 @@ class ServiceBinder
* @param MessageBinderInterface $requestMessageBinder * @param MessageBinderInterface $requestMessageBinder
* @param MessageBinderInterface $responseMessageBinder * @param MessageBinderInterface $responseMessageBinder
*/ */
public function __construct(Definition $definition, MessageBinderInterface $requestHeaderMessageBinder, MessageBinderInterface $requestMessageBinder, MessageBinderInterface $responseMessageBinder) { public function __construct(Definition $definition, MessageBinderInterface $requestHeaderMessageBinder, MessageBinderInterface $requestMessageBinder, MessageBinderInterface $responseMessageBinder)
{
$this->definition = $definition; $this->definition = $definition;
$this->requestHeaderMessageBinder = $requestHeaderMessageBinder; $this->requestHeaderMessageBinder = $requestHeaderMessageBinder;

View File

@ -18,7 +18,7 @@ class ComplexType extends Configuration
private $name; private $name;
private $value; private $value;
private $isNillable = false; private $isNillable = false;
private $isAttribute = false; private $minOccurs = 1;
public function getName() public function getName()
{ {
@ -60,24 +60,14 @@ class ComplexType extends Configuration
$this->isNillable = (bool) $isNillable; $this->isNillable = (bool) $isNillable;
} }
/** public function setMinOccurs($minOccurs)
* @return bool
*/
public function isAttribute()
{ {
return $this->isAttribute; $this->minOccurs = $minOccurs;
} }
/** public function getMinOccurs()
* @param bool $isAttribute
*
* @return $this
*/
public function setIsAttribute($isAttribute)
{ {
$this->isAttribute = $isAttribute; return $this->minOccurs;
return $this;
} }
public function getAliasName() public function getAliasName()

View File

@ -22,5 +22,5 @@ interface ConfigurationInterface
* *
* @return string * @return string
*/ */
function getAliasName(); public function getAliasName();
} }

View File

@ -19,4 +19,4 @@ class Header extends Param
{ {
return 'header'; return 'header';
} }
} }

View File

@ -42,4 +42,4 @@ class Method extends Configuration
{ {
return 'method'; return 'method';
} }
} }

View File

@ -53,4 +53,4 @@ class Param extends Configuration implements TypedElementInterface
{ {
return 'param'; return 'param';
} }
} }

View File

@ -42,4 +42,4 @@ class Result extends Configuration implements TypedElementInterface
{ {
return 'result'; return 'result';
} }
} }

View File

@ -12,8 +12,8 @@ namespace BeSimple\SoapBundle\ServiceDefinition\Annotation;
interface TypedElementInterface interface TypedElementInterface
{ {
function getPhpType(); public function getPhpType();
function getXmlType(); public function getXmlType();
function setPhpType($phpType); public function setPhpType($phpType);
function setXmlType($xmlType); public function setXmlType($xmlType);
} }

View File

@ -20,7 +20,7 @@ class ComplexType
private $name; private $name;
private $value; private $value;
private $isNillable = false; private $isNillable = false;
private $isAttribute = false; private $minOccurs = 1;
public function getName() public function getName()
{ {
@ -47,28 +47,18 @@ class ComplexType
$this->value = $value; $this->value = $value;
} }
/**
* @return bool
*/
public function isAttribute()
{
return $this->isAttribute;
}
/**
* @param bool $isAttribute
*
* @return $this
*/
public function setIsAttribute($isAttribute)
{
$this->isAttribute = $isAttribute;
return $this;
}
public function setNillable($isNillable) public function setNillable($isNillable)
{ {
$this->isNillable = (bool) $isNillable; $this->isNillable = (bool) $isNillable;
} }
public function setMinOccurs($minOccurs)
{
$this->minOccurs = $minOccurs;
}
public function getMinOccurs()
{
return $this->minOccurs;
}
} }

View File

@ -138,7 +138,7 @@ class AnnotationClassLoader extends Loader
*/ */
private function getController(\ReflectionClass $class, \ReflectionMethod $method, Annotation\Method $annotation) private function getController(\ReflectionClass $class, \ReflectionMethod $method, Annotation\Method $annotation)
{ {
if(null !== $annotation->getService()) { if (null !== $annotation->getService()) {
return $annotation->getService() . ':' . $method->name; return $annotation->getService() . ':' . $method->name;
} else { } else {
return $class->name . '::' . $method->name; return $class->name . '::' . $method->name;
@ -160,7 +160,7 @@ class AnnotationClassLoader extends Loader
$loaded = $complexTypeResolver->load($phpType); $loaded = $complexTypeResolver->load($phpType);
$complexType = new ComplexType($phpType, isset($loaded['alias']) ? $loaded['alias'] : $phpType); $complexType = new ComplexType($phpType, isset($loaded['alias']) ? $loaded['alias'] : $phpType);
foreach ($loaded['properties'] as $name => $property) { foreach ($loaded['properties'] as $name => $property) {
$complexType->add($name, $this->loadType($property->getValue()), $property->isNillable(), $property->isAttribute()); $complexType->add($name, $this->loadType($property->getValue()), $property->isNillable(), $property->getMinOccurs());
} }
$this->typeRepository->addComplexType($complexType); $this->typeRepository->addComplexType($complexType);

View File

@ -24,7 +24,7 @@ use BeSimple\SoapBundle\Util\Collection;
*/ */
class AnnotationComplexTypeLoader extends AnnotationClassLoader class AnnotationComplexTypeLoader extends AnnotationClassLoader
{ {
private $aliasClass = 'BeSimple\SoapBundle\ServiceDefinition\Annotation\Alias'; private $aliasClass = 'BeSimple\SoapBundle\ServiceDefinition\Annotation\Alias';
private $complexTypeClass = 'BeSimple\SoapBundle\ServiceDefinition\Annotation\ComplexType'; private $complexTypeClass = 'BeSimple\SoapBundle\ServiceDefinition\Annotation\ComplexType';
/** /**
@ -43,7 +43,7 @@ class AnnotationComplexTypeLoader extends AnnotationClassLoader
throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class)); throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
} }
$annotations = array(); $annotations = [];
$class = new \ReflectionClass($class); $class = new \ReflectionClass($class);
if ($alias = $this->reader->getClassAnnotation($class, $this->aliasClass)) { if ($alias = $this->reader->getClassAnnotation($class, $this->aliasClass)) {
@ -58,8 +58,8 @@ class AnnotationComplexTypeLoader extends AnnotationClassLoader
$propertyComplexType = new ComplexType(); $propertyComplexType = new ComplexType();
$propertyComplexType->setValue($complexType->getValue()); $propertyComplexType->setValue($complexType->getValue());
$propertyComplexType->setNillable($complexType->isNillable()); $propertyComplexType->setNillable($complexType->isNillable());
$propertyComplexType->setIsAttribute($complexType->isAttribute());
$propertyComplexType->setName($property->getName()); $propertyComplexType->setName($property->getName());
$propertyComplexType->setMinOccurs($complexType->getMinOccurs());
$annotations['properties']->add($propertyComplexType); $annotations['properties']->add($propertyComplexType);
} }
} }
@ -73,7 +73,7 @@ class AnnotationComplexTypeLoader extends AnnotationClassLoader
* @param mixed $resource A resource * @param mixed $resource A resource
* @param string $type The resource type * @param string $type The resource type
* *
* @return Boolean True if this class supports the given resource, false otherwise * @return bool True if this class supports the given resource, false otherwise
*/ */
public function supports($resource, $type = null) public function supports($resource, $type = null)
{ {

View File

@ -69,7 +69,7 @@ class SoapRequest extends Request
*/ */
public function getSoapMessage() public function getSoapMessage()
{ {
if(null === $this->soapMessage) { if (null === $this->soapMessage) {
$this->soapMessage = $this->initializeSoapMessage(); $this->soapMessage = $this->initializeSoapMessage();
} }
@ -88,12 +88,12 @@ 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
@ -114,7 +114,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();
} }
@ -129,11 +129,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,
@ -153,7 +153,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

@ -21,7 +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,7 +27,7 @@ class BsString
*/ */
public static function startsWith($str, $substr) public static function startsWith($str, $substr)
{ {
if(is_string($str) && is_string($substr) && strlen($str) >= strlen($substr)) { if (is_string($str) && is_string($substr) && strlen($str) >= strlen($substr)) {
return $substr == substr($str, 0, strlen($substr)); return $substr == substr($str, 0, strlen($substr));
} }
} }
@ -42,8 +42,8 @@ class BsString
*/ */
public static function endsWith($str, $substr) public static function endsWith($str, $substr)
{ {
if(is_string($str) && is_string($substr) && strlen($str) >= strlen($substr)) { if (is_string($str) && is_string($substr) && strlen($str) >= strlen($substr)) {
return $substr == substr($str, strlen($str) - strlen($substr)); return $substr == substr($str, strlen($str) - strlen($substr));
} }
} }
} }

View File

@ -62,4 +62,4 @@ class Collection implements \IteratorAggregate, \Countable
{ {
return new \ArrayIterator($this->elements); return new \ArrayIterator($this->elements);
} }
} }

View File

@ -68,10 +68,10 @@ class WebServiceContext
public function getWsdlFile($endpoint = null) public function getWsdlFile($endpoint = null)
{ {
$file = sprintf ('%s/%s.%s.wsdl', $this->options['cache_dir'], $this->options['name'], md5($endpoint)); $file = sprintf('%s/%s.%s.wsdl', $this->options['cache_dir'], $this->options['name'], md5($endpoint));
$cache = new ConfigCache($file, $this->options['debug']); $cache = new ConfigCache($file, $this->options['debug']);
if(!$cache->isFresh()) { if (!$cache->isFresh()) {
$definition = $this->getServiceDefinition(); $definition = $this->getServiceDefinition();
if ($endpoint) { if ($endpoint) {
@ -79,10 +79,7 @@ class WebServiceContext
} }
$dumper = new Dumper($definition, array('stylesheet' => $this->options['wsdl_stylesheet'])); $dumper = new Dumper($definition, array('stylesheet' => $this->options['wsdl_stylesheet']));
$cache->write($dumper->dump());
$wsdl = $dumper->dump();
$cache->write($wsdl);
} }
return $cache->getPath(); return $cache->getPath();

View File

@ -77,9 +77,8 @@ class Curl
if (isset($options['compression']) && !($options['compression'] & SOAP_COMPRESSION_ACCEPT)) { if (isset($options['compression']) && !($options['compression'] & SOAP_COMPRESSION_ACCEPT)) {
curl_setopt($this->ch, CURLOPT_ENCODING, 'identity'); curl_setopt($this->ch, CURLOPT_ENCODING, 'identity');
} }
if (isset($options['connection_timeout'])) {
curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, $options['connection_timeout']); curl_setopt($this->ch, CURLOPT_CONNECTTIMEOUT, 10);
}
if (isset($options['proxy_host'])) { if (isset($options['proxy_host'])) {
if (false !== $options['proxy_host']) { if (false !== $options['proxy_host']) {
@ -167,7 +166,6 @@ class Curl
private function execManualRedirect($redirects = 0) private function execManualRedirect($redirects = 0)
{ {
if ($redirects > $this->followLocationMaxRedirects) { if ($redirects > $this->followLocationMaxRedirects) {
// TODO Redirection limit reached, aborting // TODO Redirection limit reached, aborting
return false; return false;
} }
@ -193,7 +191,7 @@ class Curl
if (!isset($url['path'])) { if (!isset($url['path'])) {
$url['path'] = $lastUrl['path']; $url['path'] = $lastUrl['path'];
} }
$newUrl = $url['scheme'] . '://' . $url['host'] . $url['path'] . ($url['query'] ? '?' . $url['query'] : ''); $newUrl = $url['scheme'].'://'.$url['host'].$url['path'].($url['query'] ? '?'.$url['query'] : '');
curl_setopt($this->ch, CURLOPT_URL, $newUrl); curl_setopt($this->ch, CURLOPT_URL, $newUrl);
return $this->execManualRedirect($redirects++); return $this->execManualRedirect($redirects++);
@ -205,7 +203,7 @@ class Curl
/** /**
* Error code mapping from cURL error codes to PHP ext/soap error messages * Error code mapping from cURL error codes to PHP ext/soap error messages
* (where applicable) * (where applicable).
* *
* http://curl.haxx.se/libcurl/c/libcurl-errors.html * http://curl.haxx.se/libcurl/c/libcurl-errors.html
* *
@ -251,7 +249,6 @@ class Curl
$errorCodeMapping = $this->getErrorCodeMapping(); $errorCodeMapping = $this->getErrorCodeMapping();
$errorNumber = curl_errno($this->ch); $errorNumber = curl_errno($this->ch);
if (isset($errorCodeMapping[$errorNumber])) { if (isset($errorCodeMapping[$errorNumber])) {
return $errorCodeMapping[$errorNumber]; return $errorCodeMapping[$errorNumber];
} }

View File

@ -338,10 +338,10 @@ class SoapClient extends \SoapClient
$options['typemap'][] = array( $options['typemap'][] = array(
'type_name' => $converter->getTypeName(), 'type_name' => $converter->getTypeName(),
'type_ns' => $converter->getTypeNamespace(), 'type_ns' => $converter->getTypeNamespace(),
'from_xml' => function($input) use ($converter) { 'from_xml' => function ($input) use ($converter) {
return $converter->convertXmlToPhp($input); return $converter->convertXmlToPhp($input);
}, },
'to_xml' => function($input) use ($converter) { 'to_xml' => function ($input) use ($converter) {
return $converter->convertPhpToXml($input); return $converter->convertPhpToXml($input);
}, },
); );
@ -380,4 +380,4 @@ class SoapClient extends \SoapClient
return $cacheFileName; return $cacheFileName;
} }
} }

View File

@ -45,4 +45,4 @@ class SoapRequest extends CommonSoapRequest
return $request; return $request;
} }
} }

View File

@ -23,7 +23,7 @@ abstract class AbstractWebServerTest extends \PHPUnit_Framework_TestCase
/** /**
* @var ProcessBuilder * @var ProcessBuilder
*/ */
static protected $webserver; protected static $webserver;
public static function setUpBeforeClass() public static function setUpBeforeClass()
{ {

View File

@ -4,4 +4,4 @@ namespace BeSimple\SoapClient\Tests\AxisInterop\Fixtures;
class AttachmentRequest extends AttachmentType class AttachmentRequest extends AttachmentType
{ {
} }

View File

@ -6,4 +6,4 @@ class AttachmentType
{ {
public $fileName; public $fileName;
public $binaryData; public $binaryData;
} }

View File

@ -20,4 +20,4 @@ class TestCase extends \PHPUnit_Framework_TestCase
curl_close($ch); curl_close($ch);
} }
} }

View File

@ -74,7 +74,7 @@ class WsSecurityUserPassAxisInteropTest extends TestCase
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $this->options); $sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $this->options);
$wssFilter = new BeSimpleWsSecurityFilter(true, 600); $wssFilter = new BeSimpleWsSecurityFilter(true, 600);
$wssFilter->addUserData( 'libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_DIGEST ); $wssFilter->addUserData('libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_DIGEST);
$soapKernel = $sc->getSoapKernel(); $soapKernel = $sc->getSoapKernel();
$soapKernel->registerFilter($wssFilter); $soapKernel->registerFilter($wssFilter);

View File

@ -4,4 +4,4 @@ namespace BeSimple\SoapClient\Tests\ServerInterop\Fixtures;
class AttachmentRequest extends AttachmentType class AttachmentRequest extends AttachmentType
{ {
} }

View File

@ -6,4 +6,4 @@ class AttachmentType
{ {
public $fileName; public $fileName;
public $binaryData; public $binaryData;
} }

View File

@ -36,7 +36,6 @@ try {
$attachment->binaryData = $b64; $attachment->binaryData = $b64;
var_dump($sc->attachment($attachment)); var_dump($sc->attachment($attachment));
} catch (Exception $e) { } catch (Exception $e) {
var_dump($e); var_dump($e);
} }
@ -46,4 +45,4 @@ try {
// $sc->__getLastRequest(), // $sc->__getLastRequest(),
// $sc->__getLastResponseHeaders(), // $sc->__getLastResponseHeaders(),
// $sc->__getLastResponse() // $sc->__getLastResponse()
// ); // );

View File

@ -29,7 +29,6 @@ $options = array(
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/SwA.wsdl', $options); $sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/SwA.wsdl', $options);
try { try {
$upload = new uploadFile(); $upload = new uploadFile();
$upload->name = 'upload.txt'; $upload->name = 'upload.txt';
$upload->data = 'This is a test. :)'; $upload->data = 'This is a test. :)';
@ -49,4 +48,4 @@ try {
// $sc->__getLastRequest(), // $sc->__getLastRequest(),
// $sc->__getLastResponseHeaders(), // $sc->__getLastResponseHeaders(),
// $sc->__getLastResponse() // $sc->__getLastResponse()
// ); // );

View File

@ -26,4 +26,4 @@ class TestCase extends \PHPUnit_Framework_TestCase
curl_close($ch); curl_close($ch);
} }
} }

View File

@ -69,7 +69,6 @@ try {
$ab->type = 'scifi'; $ab->type = 'scifi';
var_dump($sc->addBook($ab)); var_dump($sc->addBook($ab));
} catch (Exception $e) { } catch (Exception $e) {
var_dump($e); var_dump($e);
} }

View File

@ -54,7 +54,6 @@ try {
$ab->type = 'scifi'; $ab->type = 'scifi';
var_dump($sc->addBook($ab)); var_dump($sc->addBook($ab));
} catch (Exception $e) { } catch (Exception $e) {
var_dump($e); var_dump($e);
} }

View File

@ -63,7 +63,7 @@ class WsSecurityUserPassServerInteropTest extends TestCase
$sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $this->options); $sc = new BeSimpleSoapClient(__DIR__.'/Fixtures/WsSecurityUserPass.wsdl', $this->options);
$wssFilter = new BeSimpleWsSecurityFilter(true, 600); $wssFilter = new BeSimpleWsSecurityFilter(true, 600);
$wssFilter->addUserData( 'libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_DIGEST ); $wssFilter->addUserData('libuser', 'books', BeSimpleWsSecurityFilter::PASSWORD_TYPE_DIGEST);
$soapKernel = $sc->getSoapKernel(); $soapKernel = $sc->getSoapKernel();
$soapKernel->registerFilter($wssFilter); $soapKernel->registerFilter($wssFilter);

View File

@ -25,9 +25,9 @@ use org\bovigo\vfs\vfsStreamWrapper;
*/ */
class WsdlDownloaderTest extends AbstractWebserverTest class WsdlDownloaderTest extends AbstractWebserverTest
{ {
static protected $filesystem; protected static $filesystem;
static protected $fixturesPath; protected static $fixturesPath;
/** /**
* @dataProvider provideDownload * @dataProvider provideDownload

View File

@ -157,7 +157,6 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
public function getReferenceParameter($ns, $parameter) public function getReferenceParameter($ns, $parameter)
{ {
if (isset($this->referenceParametersRecieved[$ns][$parameter])) { if (isset($this->referenceParametersRecieved[$ns][$parameter])) {
return $this->referenceParametersRecieved[$ns][$parameter]; return $this->referenceParametersRecieved[$ns][$parameter];
} }
@ -344,4 +343,4 @@ class WsAddressingFilter implements SoapRequestFilter, SoapResponseFilter
} }
} }
} }
} }

View File

@ -151,7 +151,6 @@ class WsSecurityFilter extends WsSecurityFilterClientServer implements SoapReque
if (null !== $this->password if (null !== $this->password
&& (null === $this->userSecurityKey && (null === $this->userSecurityKey
|| (null !== $this->userSecurityKey && !$this->userSecurityKey->hasPrivateKey()))) { || (null !== $this->userSecurityKey && !$this->userSecurityKey->hasPrivateKey()))) {
if (self::PASSWORD_TYPE_DIGEST === $this->passwordType) { if (self::PASSWORD_TYPE_DIGEST === $this->passwordType) {
$nonce = mt_rand(); $nonce = mt_rand();
$password = base64_encode(sha1($nonce . $createdTimestamp . $this->password, true)); $password = base64_encode(sha1($nonce . $createdTimestamp . $this->password, true));

View File

@ -56,7 +56,7 @@ class WsdlDownloader
/** /**
* Resolve WSDl/XSD includes. * Resolve WSDl/XSD includes.
* *
* @var boolean * @var bool
*/ */
protected $resolveRemoteIncludes = true; protected $resolveRemoteIncludes = true;
@ -64,13 +64,13 @@ class WsdlDownloader
* Constructor. * Constructor.
* *
* @param \BeSimple\SoapClient\Curl $curl Curl instance * @param \BeSimple\SoapClient\Curl $curl Curl instance
* @param boolean $resolveRemoteIncludes WSDL/XSD include enabled? * @param bool $resolveRemoteIncludes WSDL/XSD include enabled?
* @param boolean $cacheWsdl Cache constant * @param bool $cacheWsdl Cache constant
*/ */
public function __construct(Curl $curl, $resolveRemoteIncludes = true, $cacheWsdl = Cache::TYPE_DISK) public function __construct(Curl $curl, $resolveRemoteIncludes = true, $cacheWsdl = Cache::TYPE_DISK)
{ {
$this->curl = $curl; $this->curl = $curl;
$this->resolveRemoteIncludes = (Boolean) $resolveRemoteIncludes; $this->resolveRemoteIncludes = (bool) $resolveRemoteIncludes;
// get current WSDL caching config // get current WSDL caching config
$this->cacheEnabled = $cacheWsdl === Cache::TYPE_NONE ? Cache::DISABLED : Cache::ENABLED == Cache::isEnabled(); $this->cacheEnabled = $cacheWsdl === Cache::TYPE_NONE ? Cache::DISABLED : Cache::ENABLED == Cache::isEnabled();
@ -101,19 +101,33 @@ class WsdlDownloader
if ($responseSuccessfull) { if ($responseSuccessfull) {
$response = $this->curl->getResponseBody(); $response = $this->curl->getResponseBody();
libxml_use_internal_errors(true);
$doc = simplexml_load_string($response);
if (!$doc) {
$errors = libxml_get_errors();
if (count($errors)) {
throw new \Exception('There is something wrong with the WSDL file formatting. The file can\'t be downloaded to be cached.');
}
libxml_clear_errors();
}
if ($this->resolveRemoteIncludes) { if ($this->resolveRemoteIncludes) {
$this->resolveRemoteIncludes($response, $cacheFilePath, $wsdl); $this->resolveRemoteIncludes($response, $cacheFilePath, $wsdl);
} else { } else {
file_put_contents($cacheFilePath, $response); file_put_contents($cacheFilePath, $response);
} }
} else { } else {
throw new \ErrorException("SOAP-ERROR: Parsing WSDL: Couldn't load from '" . $wsdl ."'"); throw new \ErrorException("SOAP-ERROR: Parsing WSDL: Couldn't load from '".$wsdl."'");
} }
} elseif (file_exists($wsdl)) { } elseif (file_exists($wsdl)) {
$response = file_get_contents($wsdl); $response = file_get_contents($wsdl);
$this->resolveRemoteIncludes($response, $cacheFilePath); $this->resolveRemoteIncludes($response, $cacheFilePath);
} else { } else {
throw new \ErrorException("SOAP-ERROR: Parsing WSDL: Couldn't load from '" . $wsdl ."'"); throw new \ErrorException("SOAP-ERROR: Parsing WSDL: Couldn't load from '".$wsdl."'");
} }
} }
@ -122,7 +136,7 @@ class WsdlDownloader
return realpath($wsdl); return realpath($wsdl);
} }
throw new \ErrorException("SOAP-ERROR: Parsing WSDL: Couldn't load from '" . $wsdl ."'"); throw new \ErrorException("SOAP-ERROR: Parsing WSDL: Couldn't load from '".$wsdl."'");
} }
/** /**
@ -130,7 +144,7 @@ class WsdlDownloader
* *
* @param string $file File URL/path * @param string $file File URL/path
* *
* @return boolean * @return bool
*/ */
private function isRemoteFile($file) private function isRemoteFile($file)
{ {
@ -147,11 +161,9 @@ class WsdlDownloader
/** /**
* Resolves remote WSDL/XSD includes within the WSDL files. * Resolves remote WSDL/XSD includes within the WSDL files.
* *
* @param string $xml XML file * @param string $xml XML file
* @param string $cacheFilePath Cache file name * @param string $cacheFilePath Cache file name
* @param boolean $parentFilePath Parent file name * @param bool $parentFilePath Parent file name
*
* @return void
*/ */
private function resolveRemoteIncludes($xml, $cacheFilePath, $parentFilePath = null) private function resolveRemoteIncludes($xml, $cacheFilePath, $parentFilePath = null)
{ {
@ -214,10 +226,10 @@ class WsdlDownloader
$urlParts = parse_url($base); $urlParts = parse_url($base);
// combine base path with relative path // combine base path with relative path
if (isset($urlParts['path']) && '/' === $relative{0}) { if (isset($urlParts['path']) && '/' === $relative[0]) {
// $relative is absolute path from domain (starts with /) // $relative is absolute path from domain (starts with /)
$path = $relative; $path = $relative;
} elseif (isset($urlParts['path']) && strrpos($urlParts['path'], '/') === (strlen($urlParts['path']) )) { } elseif (isset($urlParts['path']) && strrpos($urlParts['path'], '/') === (strlen($urlParts['path']))) {
// base path is directory // base path is directory
$path = $urlParts['path'].$relative; $path = $urlParts['path'].$relative;
} elseif (isset($urlParts['path'])) { } elseif (isset($urlParts['path'])) {
@ -247,7 +259,7 @@ class WsdlDownloader
break; break;
} }
$keyToDelete--; --$keyToDelete;
} }
unset($parts[$key]); unset($parts[$key]);

View File

@ -65,6 +65,5 @@ class XmlMimeFilter implements SoapRequestFilter
} }
} }
} }
} }
} }

View File

@ -27,7 +27,7 @@ abstract class AbstractSoapBuilder
/** /**
* @return AbstractSoapBuilder * @return AbstractSoapBuilder
*/ */
static public function createWithDefaults() public static function createWithDefaults()
{ {
$builder = new static(); $builder = new static();

View File

@ -25,24 +25,24 @@ class Cache
const TYPE_MEMORY = WSDL_CACHE_MEMORY; const TYPE_MEMORY = WSDL_CACHE_MEMORY;
const TYPE_DISK_MEMORY = WSDL_CACHE_BOTH; const TYPE_DISK_MEMORY = WSDL_CACHE_BOTH;
static protected $types = array( protected static $types = array(
self::TYPE_NONE, self::TYPE_NONE,
self::TYPE_DISK, self::TYPE_DISK,
self::TYPE_MEMORY, self::TYPE_MEMORY,
self::TYPE_DISK_MEMORY, self::TYPE_DISK_MEMORY,
); );
static public function getTypes() public static function getTypes()
{ {
return self::$types; return self::$types;
} }
static public function isEnabled() public static function isEnabled()
{ {
return self::iniGet('soap.wsdl_cache_enabled'); return self::iniGet('soap.wsdl_cache_enabled');
} }
static public function setEnabled($enabled) public static function setEnabled($enabled)
{ {
if (!in_array($enabled, array(self::ENABLED, self::DISABLED), true)) { if (!in_array($enabled, array(self::ENABLED, self::DISABLED), true)) {
throw new \InvalidArgumentException(); throw new \InvalidArgumentException();
@ -51,12 +51,12 @@ class Cache
self::iniSet('soap.wsdl_cache_enabled', $enabled); self::iniSet('soap.wsdl_cache_enabled', $enabled);
} }
static public function getType() public static function getType()
{ {
return self::iniGet('soap.wsdl_cache'); return self::iniGet('soap.wsdl_cache');
} }
static public function setType($type) public static function setType($type)
{ {
if (!in_array($type, self::getTypes(), true)) { if (!in_array($type, self::getTypes(), true)) {
throw new \InvalidArgumentException('The cache type has to be either Cache::TYPE_NONE, Cache::TYPE_DISK, Cache::TYPE_MEMORY or Cache::TYPE_DISK_MEMORY'); throw new \InvalidArgumentException('The cache type has to be either Cache::TYPE_NONE, Cache::TYPE_DISK, Cache::TYPE_MEMORY or Cache::TYPE_DISK_MEMORY');
@ -65,12 +65,12 @@ class Cache
self::iniSet('soap.wsdl_cache', $type); self::iniSet('soap.wsdl_cache', $type);
} }
static public function getDirectory() public static function getDirectory()
{ {
return self::iniGet('soap.wsdl_cache_dir'); return self::iniGet('soap.wsdl_cache_dir');
} }
static public function setDirectory($directory) public static function setDirectory($directory)
{ {
if (!is_dir($directory)) { if (!is_dir($directory)) {
mkdir($directory, 0777, true); mkdir($directory, 0777, true);
@ -79,33 +79,33 @@ class Cache
self::iniSet('soap.wsdl_cache_dir', $directory); self::iniSet('soap.wsdl_cache_dir', $directory);
} }
static public function getLifetime() public static function getLifetime()
{ {
return self::iniGet('soap.wsdl_cache_ttl'); return self::iniGet('soap.wsdl_cache_ttl');
} }
static public function setLifetime($lifetime) public static function setLifetime($lifetime)
{ {
self::iniSet('soap.wsdl_cache_ttl', $lifetime); self::iniSet('soap.wsdl_cache_ttl', $lifetime);
} }
static public function getLimit() public static function getLimit()
{ {
return self::iniGet('soap.wsdl_cache_limit'); return self::iniGet('soap.wsdl_cache_limit');
} }
static public function setLimit($limit) public static function setLimit($limit)
{ {
self::iniSet('soap.wsdl_cache_limit', $limit); self::iniSet('soap.wsdl_cache_limit', $limit);
} }
static protected function iniGet($key) protected static function iniGet($key)
{ {
return ini_get($key); return ini_get($key);
} }
static protected function iniSet($key, $value) protected static function iniSet($key, $value)
{ {
ini_set($key, $value); ini_set($key, $value);
} }
} }

View File

@ -90,4 +90,4 @@ class Classmap
$this->add($type, $classname); $this->add($type, $classname);
} }
} }
} }

View File

@ -44,4 +44,3 @@ class DateTimeTypeConverter implements TypeConverterInterface
return sprintf('<%1$s>%2$s</%1$s>', $this->getTypeName(), $data->format('Y-m-d\TH:i:sP')); return sprintf('<%1$s>%2$s</%1$s>', $this->getTypeName(), $data->format('Y-m-d\TH:i:sP'));
} }
} }

View File

@ -44,4 +44,3 @@ class DateTypeConverter implements TypeConverterInterface
return sprintf('<%1$s>%2$s</%1$s>', $this->getTypeName(), $data->format('Y-m-d')); return sprintf('<%1$s>%2$s</%1$s>', $this->getTypeName(), $data->format('Y-m-d'));
} }
} }

View File

@ -65,10 +65,8 @@ class MtomTypeConverter implements TypeConverterInterface, SoapKernelAwareInterf
$contentId = urldecode(substr($ref, 4)); $contentId = urldecode(substr($ref, 4));
if (null !== ($part = $this->soapKernel->getAttachment($contentId))) { if (null !== ($part = $this->soapKernel->getAttachment($contentId))) {
return $part->getContent(); return $part->getContent();
} else { } else {
return null; return null;
} }
} }

View File

@ -28,5 +28,5 @@ interface SoapKernelAwareInterface
* *
* @return void * @return void
*/ */
function setKernel(SoapKernel $soapKernel); public function setKernel(SoapKernel $soapKernel);
} }

View File

@ -61,10 +61,8 @@ class SwaTypeConverter implements TypeConverterInterface, SoapKernelAwareInterfa
$contentId = urldecode(substr($ref, 4)); $contentId = urldecode(substr($ref, 4));
if (null !== ($part = $this->soapKernel->getAttachment($contentId))) { if (null !== ($part = $this->soapKernel->getAttachment($contentId))) {
return $part->getContent(); return $part->getContent();
} else { } else {
return null; return null;
} }
} }

View File

@ -74,10 +74,10 @@ class TypeConverterCollection
$typemap[] = array( $typemap[] = array(
'type_name' => $converter->getTypeName(), 'type_name' => $converter->getTypeName(),
'type_ns' => $converter->getTypeNamespace(), 'type_ns' => $converter->getTypeNamespace(),
'from_xml' => function($input) use ($converter) { 'from_xml' => function ($input) use ($converter) {
return $converter->convertXmlToPhp($input); return $converter->convertXmlToPhp($input);
}, },
'to_xml' => function($input) use ($converter) { 'to_xml' => function ($input) use ($converter) {
return $converter->convertPhpToXml($input); return $converter->convertPhpToXml($input);
}, },
); );

View File

@ -24,14 +24,14 @@ interface TypeConverterInterface
* *
* @return string * @return string
*/ */
function getTypeNamespace(); public function getTypeNamespace();
/** /**
* Get type name. * Get type name.
* *
* @return string * @return string
*/ */
function getTypeName(); public function getTypeName();
/** /**
* Convert given XML string to PHP type. * Convert given XML string to PHP type.
@ -40,7 +40,7 @@ interface TypeConverterInterface
* *
* @return mixed * @return mixed
*/ */
function convertXmlToPhp($data); public function convertXmlToPhp($data);
/** /**
* Convert PHP type to XML string. * Convert PHP type to XML string.
@ -49,5 +49,5 @@ interface TypeConverterInterface
* *
* @return string * @return string
*/ */
function convertPhpToXml($data); public function convertPhpToXml($data);
} }

View File

@ -25,7 +25,7 @@ class Message
public function __construct($name) public function __construct($name)
{ {
$this->name = $name; $this->name = $name;
$this->parts = array(); $this->parts = [];
} }
public function getName() public function getName()
@ -48,13 +48,13 @@ class Message
return 0 === count($this->parts) ? true : false; return 0 === count($this->parts) ? true : false;
} }
public function add($name, $phpType, $nillable = false, $attribute = false) public function add($name, $phpType, $nillable = false, $minOccurs = 1)
{ {
if ($phpType instanceof TypeInterface) { if ($phpType instanceof TypeInterface) {
$phpType = $phpType->getPhpType(); $phpType = $phpType->getPhpType();
} }
$this->parts[$name] = new Part($name, $phpType, $nillable, $attribute); $this->parts[$name] = new Part($name, $phpType, $nillable, $minOccurs);
return $this; return $this;
} }

View File

@ -12,8 +12,6 @@
namespace BeSimple\SoapCommon\Definition; namespace BeSimple\SoapCommon\Definition;
use BeSimple\SoapCommon\Definition\Type\TypeRepository;
/** /**
* @author Francis Besset <francis.besset@gmail.com> * @author Francis Besset <francis.besset@gmail.com>
*/ */
@ -53,7 +51,7 @@ class Method
public function getUse() public function getUse()
{ {
return \SOAP_ENCODED; return \SOAP_LITERAL;
} }
public function addHeader($name, $type) public function addHeader($name, $type)
@ -68,11 +66,7 @@ class Method
public function setOutput($type, $name = 'return') public function setOutput($type, $name = 'return')
{ {
if ('return' !== $name) { $this->output->add('return', $type);
$this->output = new Message($name);
}
$this->output->add($name, $type);
} }
public function getHeaders() public function getHeaders()

View File

@ -20,14 +20,14 @@ class Part
protected $name; protected $name;
protected $type; protected $type;
protected $nillable; protected $nillable;
protected $attribute; protected $minOccurs;
public function __construct($name, $type, $nillable = false, $attribute = false) public function __construct($name, $type, $nillable = false, $minOccurs = 1)
{ {
$this->name = $name; $this->name = $name;
$this->type = $type; $this->type = $type;
$this->minOccurs = $minOccurs;
$this->setNillable($nillable); $this->setNillable($nillable);
$this->setAttribute($attribute);
} }
public function getName() public function getName()
@ -35,26 +35,6 @@ class Part
return $this->name; return $this->name;
} }
/**
* @return bool
*/
public function isAttribute()
{
return $this->attribute;
}
/**
* @param bool $attribute
*
* @return $this
*/
public function setAttribute($attribute)
{
$this->attribute = $attribute;
return $this;
}
public function getType() public function getType()
{ {
return $this->type; return $this->type;
@ -72,6 +52,16 @@ class Part
public function setNillable($nillable) public function setNillable($nillable)
{ {
$this->nillable = (boolean) $nillable; $this->nillable = (bool) $nillable;
}
public function setMinOccurs($minOccurs)
{
$this->minOccurs = $minOccurs;
}
public function getMinOccurs()
{
return $this->minOccurs;
} }
} }

View File

@ -175,4 +175,4 @@ class FilterHelper
$this->namespaces[$namespaceURI] = $prefix; $this->namespaces[$namespaceURI] = $prefix;
} }
} }
} }

View File

@ -172,7 +172,8 @@ class Helper
return sprintf( return sprintf(
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x', '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
// 32 bits for "time_low" // 32 bits for "time_low"
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff),
mt_rand(0, 0xffff),
// 16 bits for "time_mid" // 16 bits for "time_mid"
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
// 16 bits for "time_hi_and_version", // 16 bits for "time_hi_and_version",
@ -183,7 +184,9 @@ class Helper
// two most significant bits holds zero and one for variant DCE1.1 // two most significant bits holds zero and one for variant DCE1.1
mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0x3fff) | 0x8000,
// 48 bits for "node" // 48 bits for "node"
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff) mt_rand(0, 0xffff),
mt_rand(0, 0xffff),
mt_rand(0, 0xffff)
); );
} }
@ -218,4 +221,4 @@ class Helper
return SOAP_1_1; return SOAP_1_1;
} }
} }
} }

View File

@ -172,4 +172,4 @@ class MultiPart extends PartHeader
{ {
return 'urn:uuid:' . Helper::generateUUID(); return 'urn:uuid:' . Helper::generateUUID();
} }
} }

View File

@ -184,4 +184,4 @@ class Parser
} }
$part->setContent($content); $part->setContent($content);
} }
} }

View File

@ -166,4 +166,4 @@ class Part extends PartHeader
{ {
return 'urn:uuid:' . Helper::generateUUID(); return 'urn:uuid:' . Helper::generateUUID();
} }
} }

View File

@ -143,4 +143,4 @@ abstract class PartHeader
return $string; return $string;
} }
} }
} }

View File

@ -47,7 +47,7 @@ abstract class SoapMessage
* *
* @var array(string=>string) * @var array(string=>string)
*/ */
static protected $versionToContentTypeMap = array( protected static $versionToContentTypeMap = array(
SOAP_1_1 => 'text/xml; charset=utf-8', SOAP_1_1 => 'text/xml; charset=utf-8',
SOAP_1_2 => 'application/soap+xml; charset=utf-8' SOAP_1_2 => 'application/soap+xml; charset=utf-8'
); );

View File

@ -22,5 +22,4 @@ use BeSimple\SoapCommon\SoapMessage;
*/ */
class SoapRequest extends SoapMessage class SoapRequest extends SoapMessage
{ {
}
}

View File

@ -28,4 +28,4 @@ interface SoapRequestFilter
* @param SoapRequest $request SOAP request * @param SoapRequest $request SOAP request
*/ */
public function filterRequest(SoapRequest $request); public function filterRequest(SoapRequest $request);
} }

View File

@ -22,5 +22,4 @@ use BeSimple\SoapCommon\SoapMessage;
*/ */
class SoapResponse extends SoapMessage class SoapResponse extends SoapMessage
{ {
}
}

View File

@ -28,4 +28,4 @@ interface SoapResponseFilter
* @param SoapResponse $response SOAP response * @param SoapResponse $response SOAP response
*/ */
public function filterResponse(SoapResponse $response); public function filterResponse(SoapResponse $response);
} }

View File

@ -78,4 +78,4 @@ class ClassmapTest extends \PHPUnit_Framework_TestCase
$this->setExpectedException('InvalidArgumentException'); $this->setExpectedException('InvalidArgumentException');
$classmap1->addClassmap($classmap2); $classmap1->addClassmap($classmap2);
} }
} }

View File

@ -51,4 +51,3 @@ class DateTimeTypeConverterTest extends \PHPUnit_Framework_TestCase
$this->assertNull($date); $this->assertNull($date);
} }
} }

View File

@ -49,4 +49,3 @@ class DateTypeConverterTest extends \PHPUnit_Framework_TestCase
$this->assertNull($date); $this->assertNull($date);
} }
} }

View File

@ -90,4 +90,4 @@ class TypeConverterCollectionTest extends \PHPUnit_Framework_TestCase
$this->setExpectedException('InvalidArgumentException'); $this->setExpectedException('InvalidArgumentException');
$converters1->addCollection($converters2); $converters1->addCollection($converters2);
} }
} }

View File

@ -131,13 +131,13 @@ class MultiPartTest extends \PHPUnit_Framework_TestCase
$mp->addPart($p2); $mp->addPart($p2);
$withoutMain = array( $withoutMain = array(
trim($p2->getHeader('Content-ID'),'<>') => $p2, trim($p2->getHeader('Content-ID'), '<>') => $p2,
); );
$this->assertEquals($withoutMain, $mp->getParts()); $this->assertEquals($withoutMain, $mp->getParts());
$withMain = array( $withMain = array(
trim($p1->getHeader('Content-ID'),'<>') => $p1, trim($p1->getHeader('Content-ID'), '<>') => $p1,
trim($p2->getHeader('Content-ID'),'<>') => $p2, trim($p2->getHeader('Content-ID'), '<>') => $p2,
); );
$this->assertEquals($withMain, $mp->getParts(true)); $this->assertEquals($withMain, $mp->getParts(true));
} }

View File

@ -338,7 +338,6 @@ abstract class WsSecurityFilterClientServer
return XmlSecurityKey::factory($algorithm, $key, false, XmlSecurityKey::TYPE_PRIVATE); return XmlSecurityKey::factory($algorithm, $key, false, XmlSecurityKey::TYPE_PRIVATE);
} elseif (Helper::NS_WSS === $referencedNode->namespaceURI } elseif (Helper::NS_WSS === $referencedNode->namespaceURI
&& 'BinarySecurityToken' == $referencedNode->localName) { && 'BinarySecurityToken' == $referencedNode->localName) {
$key = XmlSecurityPem::formatKeyInPemFormat($referencedNode->textContent); $key = XmlSecurityPem::formatKeyInPemFormat($referencedNode->textContent);
return XmlSecurityKey::factory(XmlSecurityKey::RSA_SHA1, $key, false, XmlSecurityKey::TYPE_PUBLIC); return XmlSecurityKey::factory(XmlSecurityKey::RSA_SHA1, $key, false, XmlSecurityKey::TYPE_PUBLIC);

View File

@ -113,4 +113,4 @@ class WsSecurityKey
{ {
return null !== $this->publicKey; return null !== $this->publicKey;
} }
} }

View File

@ -62,7 +62,7 @@ class SoapRequest extends CommonSoapRequest
} else { } else {
$url .= 'http://'; $url .= 'http://';
} }
$url .= isset( $_SERVER['SERVER_NAME'] ) ? $_SERVER['SERVER_NAME'] : ''; $url .= isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';
if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 80) { if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 80) {
$url .= ":{$_SERVER['SERVER_PORT']}"; $url .= ":{$_SERVER['SERVER_PORT']}";
} }

View File

@ -100,34 +100,6 @@ class SoapServer extends \SoapServer
parent::handle($soapRequest->getContent()); parent::handle($soapRequest->getContent());
$response = ob_get_clean(); $response = ob_get_clean();
$dom = \DOMDocument::loadXML($response);
/** @var \DOMElement $envelop */
$envelop = $dom->childNodes->item(0);
$ns1 = $envelop->getAttribute('xmlns:ns1');
$envelop->removeAttributeNS($ns1, 'ns1');
$envelop->prefix = 'soap';
$envelop->setAttribute('soap:encodingStyle', 'http://schemas.xmlsoap.org/soap/encoding/');
$envelop->setAttribute('xmlns:soapenc', 'http://schemas.xmlsoap.org/soap/encoding/');
$envelop->setAttribute('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema');
$envelop->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
/** @var \DOMElement $body */
$body = $envelop->childNodes->item(0);
$body->prefix = 'soap';
/** @var \DOMElement $responseRoot */
$responseRoot = $body->childNodes->item(0);
$responseRoot->setAttribute('xmlns', $ns1);
$envelop->removeAttributeNS('http://schemas.xmlsoap.org/soap/envelope/', 'SOAP-ENV');
$envelop->removeAttributeNS('http://schemas.xmlsoap.org/soap/encoding/', 'SOAP-ENC');
$response = $dom->saveXML();
$response = preg_replace('/xsi:type="ns1:\w*"/', '', $response);
// Remove headers added by SoapServer::handle() method // Remove headers added by SoapServer::handle() method
header_remove('Content-Length'); header_remove('Content-Length');
header_remove('Content-Type'); header_remove('Content-Type');
@ -159,9 +131,7 @@ class SoapServer extends \SoapServer
/** /**
* Configure filter and type converter for SwA/MTOM. * Configure filter and type converter for SwA/MTOM.
* *
* @param array &$options SOAP constructor options array. * @param array &$options SOAP constructor options array
*
* @return void
*/ */
private function configureMime(array &$options) private function configureMime(array &$options)
{ {
@ -185,11 +155,11 @@ class SoapServer extends \SoapServer
} }
$options['typemap'][] = array( $options['typemap'][] = array(
'type_name' => $converter->getTypeName(), 'type_name' => $converter->getTypeName(),
'type_ns' => $converter->getTypeNamespace(), 'type_ns' => $converter->getTypeNamespace(),
'from_xml' => function($input) use ($converter) { 'from_xml' => function ($input) use ($converter) {
return $converter->convertXmlToPhp($input); return $converter->convertXmlToPhp($input);
}, },
'to_xml' => function($input) use ($converter) { 'to_xml' => function ($input) use ($converter) {
return $converter->convertPhpToXml($input); return $converter->convertPhpToXml($input);
}, },
); );

View File

@ -33,7 +33,7 @@ class SoapServerBuilder extends AbstractSoapBuilder
* *
* @return \BeSimple\SoapServer\SoapServerBuilder * @return \BeSimple\SoapServer\SoapServerBuilder
*/ */
static public function createWithDefaults() public static function createWithDefaults()
{ {
return parent::createWithDefaults() return parent::createWithDefaults()
->withErrorReporting(false); ->withErrorReporting(false);
@ -197,4 +197,4 @@ class SoapServerBuilder extends AbstractSoapBuilder
throw new \InvalidArgumentException('The handler has to be configured!'); throw new \InvalidArgumentException('The handler has to be configured!');
} }
} }
} }

View File

@ -65,6 +65,5 @@ class XmlMimeFilter implements SoapResponseFilter
} }
} }
} }
} }
} }

View File

@ -61,7 +61,7 @@ abstract class AbstractVersion implements VersionInterface
{ {
if (!$this->bindingNode) { if (!$this->bindingNode) {
$this->bindingNode = $this->document->createElement('binding'); $this->bindingNode = $this->document->createElement('binding');
$this->bindingNode->setAttribute('name', $this->name.'_SOAP'); $this->bindingNode->setAttribute('name', $this->name.'Binding');
$this->bindingNode->setAttribute('type', $this->portTypeName); $this->bindingNode->setAttribute('type', $this->portTypeName);
$this->addSoapBinding(); $this->addSoapBinding();
@ -75,7 +75,7 @@ abstract class AbstractVersion implements VersionInterface
if (!$this->servicePortNode) { if (!$this->servicePortNode) {
$this->servicePortNode = $this->document->createElement('port'); $this->servicePortNode = $this->document->createElement('port');
$this->servicePortNode->setAttribute('name', $this->name.'Port'); $this->servicePortNode->setAttribute('name', $this->name.'Port');
$this->servicePortNode->setAttribute('binding', $this->typeNs.':'.$this->name.'_SOAP'); $this->servicePortNode->setAttribute('binding', $this->typeNs.':'.$this->name.'Binding');
$this->addSoapAddress(); $this->addSoapAddress();
} }

View File

@ -54,7 +54,7 @@ class Dumper
protected $domService; protected $domService;
protected $domPortType; protected $domPortType;
public function __construct(Definition $definition, array $options = array()) public function __construct(Definition $definition, array $options = [])
{ {
$this->definition = $definition; $this->definition = $definition;
$this->document = new \DOMDocument('1.0', 'utf-8'); $this->document = new \DOMDocument('1.0', 'utf-8');
@ -64,15 +64,15 @@ class Dumper
public function setOptions(array $options) public function setOptions(array $options)
{ {
$this->options = array( $this->options = [
'version11_class' => 'BeSimple\\SoapWsdl\\Dumper\\Version11', 'version11_class' => 'BeSimple\\SoapWsdl\\Dumper\\Version11',
'version12_class' => 'BeSimple\\SoapWsdl\\Dumper\\Version12', 'version12_class' => 'BeSimple\\SoapWsdl\\Dumper\\Version12',
'version11_name' => $this->definition->getName(), 'version11_name' => $this->definition->getName(),
'version12_name' => $this->definition->getName().'12', 'version12_name' => $this->definition->getName() . '12',
'stylesheet' => null, 'stylesheet' => null,
); ];
$invalid = array(); $invalid = [];
foreach ($options as $key => $value) { foreach ($options as $key => $value) {
if (array_key_exists($key, $this->options)) { if (array_key_exists($key, $this->options)) {
$this->options[$key] = $value; $this->options[$key] = $value;
@ -114,7 +114,7 @@ class Dumper
$this->addMethods(); $this->addMethods();
$this->addService(); $this->addService();
foreach (array($this->version11, $this->version12) as $version) { foreach ([$this->version11, $this->version12] as $version) {
if (!$version) { if (!$version) {
continue; continue;
} }
@ -143,7 +143,7 @@ class Dumper
protected function addService() protected function addService()
{ {
$this->domService = $this->document->createElement('service'); $this->domService = $this->document->createElement('service');
$this->domService->setAttribute('name', $this->definition->getName().'Service'); $this->domService->setAttribute('name', $this->definition->getName() . 'Service');
$this->domDefinitions->appendChild($this->domService); $this->domDefinitions->appendChild($this->domService);
@ -154,15 +154,15 @@ class Dumper
{ {
$this->domDefinitions = $this->document->createElement('definitions'); $this->domDefinitions = $this->document->createElement('definitions');
$this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS, static::WSDL_NS_URI); $this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS, static::WSDL_NS_URI);
$this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::TYPES_NS, $this->definition->getNamespace()); $this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS . ':' . static::TYPES_NS, $this->definition->getNamespace());
$this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::SOAP_NS, static::SOAP_NS_URI); $this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS . ':' . static::SOAP_NS, static::SOAP_NS_URI);
$this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::SOAP12_NS, static::SOAP12_NS_URI); $this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS . ':' . static::SOAP12_NS, static::SOAP12_NS_URI);
$this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::XSD_NS, static::XSD_NS_URI); $this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS . ':' . static::XSD_NS, static::XSD_NS_URI);
$this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::SOAP_ENC_NS, static::SOAP_ENC_URI); $this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS . ':' . static::SOAP_ENC_NS, static::SOAP_ENC_URI);
$this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS.':'.static::WSDL_NS, static::WSDL_NS_URI); $this->domDefinitions->setAttributeNS(static::XML_NS_URI, static::XML_NS . ':' . static::WSDL_NS, static::WSDL_NS_URI);
foreach ($this->definition->getTypeRepository()->getXmlNamespaces() as $prefix => $uri) { foreach ($this->definition->getTypeRepository()->getXmlNamespaces() as $prefix => $uri) {
$this->domDefinitions->setAttributeNs(static::XML_NS_URI, static::XML_NS.':'.$prefix, $uri); $this->domDefinitions->setAttributeNs(static::XML_NS_URI, static::XML_NS . ':' . $prefix, $uri);
} }
$this->domDefinitions->setAttribute('name', $this->definition->getName()); $this->domDefinitions->setAttribute('name', $this->definition->getName());
@ -203,9 +203,9 @@ class Dumper
$partElement->setAttribute('name', $part->getName()); $partElement->setAttribute('name', $part->getName());
if ($type instanceof ComplexType) { if ($type instanceof ComplexType) {
$partElement->setAttribute('element', static::TYPES_NS.':'.$type->getXmlType()); $partElement->setAttribute('type', static::TYPES_NS . ':' . $type->getXmlType());
} else { } else {
$partElement->setAttribute('element', $type); $partElement->setAttribute('type', $type);
} }
$messageElement->appendChild($partElement); $messageElement->appendChild($partElement);
@ -217,13 +217,11 @@ class Dumper
protected function addComplexTypes() protected function addComplexTypes()
{ {
$types = $this->document->createElement(static::WSDL_NS . ':types'); $types = $this->document->createElement('types');
$this->domDefinitions->appendChild($types); $this->domDefinitions->appendChild($types);
$this->domSchema = $this->document->createElement(static::XSD_NS.':schema'); $this->domSchema = $this->document->createElement(static::XSD_NS . ':schema');
$this->domSchema->setAttribute('targetNamespace', $this->definition->getNamespace()); $this->domSchema->setAttribute('targetNamespace', $this->definition->getNamespace());
$this->domSchema->setAttribute('elementFormDefault', 'unqualified');
$this->domSchema->setAttribute(static::XML_NS.':'.static::XSD_NS, static::XSD_NS_URI);
$types->appendChild($this->domSchema); $types->appendChild($this->domSchema);
foreach ($this->definition->getTypeRepository()->getComplexTypes() as $type) { foreach ($this->definition->getTypeRepository()->getComplexTypes() as $type) {
@ -235,21 +233,16 @@ class Dumper
protected function addComplexType(ComplexType $type) protected function addComplexType(ComplexType $type)
{ {
$complexType = $this->document->createElement(static::XSD_NS.':complexType'); $complexType = $this->document->createElement(static::XSD_NS . ':complexType');
$complexType->setAttribute('name', $type->getXmlType()); $complexType->setAttribute('name', $type->getXmlType());
$all = $this->document->createElement(static::XSD_NS.':'.'sequence'); $all = $this->document->createElement(static::XSD_NS . ':' . ($type instanceof ArrayOfType ? 'sequence' : 'all'));
$complexType->appendChild($all); $complexType->appendChild($all);
foreach ($type->all() as $child) { foreach ($type->all() as $child) {
$isArray = false;
$childType = $this->definition->getTypeRepository()->getType($child->getType()); $childType = $this->definition->getTypeRepository()->getType($child->getType());
if ($child->isAttribute()) { $element = $this->document->createElement(static::XSD_NS . ':element');
$element = $this->document->createElement(static::XSD_NS.':attribute');
} else {
$element = $this->document->createElement(static::XSD_NS.':element');
}
$element->setAttribute('name', $child->getName()); $element->setAttribute('name', $child->getName());
if ($childType instanceof ComplexType) { if ($childType instanceof ComplexType) {
@ -258,29 +251,26 @@ class Dumper
$name = $childType->getName(); $name = $childType->getName();
} }
$element->setAttribute('type', static::TYPES_NS.':'.$name); $element->setAttribute('type', static::TYPES_NS . ':' . $name);
} else { } else {
$element->setAttribute('type', $childType); $element->setAttribute('type', $childType);
} }
if ($child->isNillable()) { if ($child->isNillable()) {
$element->setAttribute('minOccurs', 0); $element->setAttribute('nillable', 'true');
} else {
$element->setAttribute('minOccurs', 1);
} }
if ($type instanceof ArrayOfType || $isArray) { if ($type instanceof ArrayOfType) {
$element->setAttribute('minOccurs', 0); $element->setAttribute('minOccurs', 0);
$element->setAttribute('maxOccurs', 'unbounded'); $element->setAttribute('maxOccurs', 'unbounded');
} else {
$element->setAttribute('maxOccurs', 1);
} }
if ($child->isAttribute()) { // 1 is the default value of minOccurs.
$complexType->appendChild($element); if (1 != $child->getMinOccurs()) {
} else { $element->setAttribute('minOccurs', $child->getMinOccurs());
$all->appendChild($element);
} }
$all->appendChild($element);
} }
$this->domSchema->appendChild($complexType); $this->domSchema->appendChild($complexType);
@ -289,7 +279,7 @@ class Dumper
protected function addPortType() protected function addPortType()
{ {
$this->domPortType = $this->document->createElement('portType'); $this->domPortType = $this->document->createElement('portType');
$this->domPortType->setAttribute('name', $this->definition->getName().'PortType'); $this->domPortType->setAttribute('name', $this->definition->getName() . 'PortType');
$this->domDefinitions->appendChild($this->domPortType); $this->domDefinitions->appendChild($this->domPortType);
} }
@ -299,13 +289,13 @@ class Dumper
$operation = $this->document->createElement('operation'); $operation = $this->document->createElement('operation');
$operation->setAttribute('name', $method->getName()); $operation->setAttribute('name', $method->getName());
foreach (array('input' => $method->getInput(), 'output' => $method->getOutput(), 'fault' => $method->getFault()) as $type => $message) { foreach (['input' => $method->getInput(), 'output' => $method->getOutput(), 'fault' => $method->getFault()] as $type => $message) {
if ('fault' === $type && $message->isEmpty()) { if ('fault' === $type && $message->isEmpty()) {
continue; continue;
} }
$node = $this->document->createElement($type); $node = $this->document->createElement($type);
$node->setAttribute('message', static::TYPES_NS.':'.$message->getName()); $node->setAttribute('message', static::TYPES_NS . ':' . $message->getName());
$operation->appendChild($node); $operation->appendChild($node);
} }
@ -341,7 +331,7 @@ class Dumper
static::TYPES_NS, static::TYPES_NS,
$this->options['version11_name'], $this->options['version11_name'],
$this->definition->getNamespace(), $this->definition->getNamespace(),
static::TYPES_NS.':'.$this->definition->getName().'PortType', static::TYPES_NS . ':' . $this->definition->getName() . 'PortType',
$this->definition->getOption('location'), $this->definition->getOption('location'),
$this->definition->getOption('style') $this->definition->getOption('style')
); );
@ -358,7 +348,7 @@ class Dumper
static::TYPES_NS, static::TYPES_NS,
$this->options['version12_name'], $this->options['version12_name'],
$this->definition->getNamespace(), $this->definition->getNamespace(),
static::TYPES_NS.':'.$this->definition->getName().'PortType', static::TYPES_NS . ':' . $this->definition->getName() . 'PortType',
$this->definition->getOption('location'), $this->definition->getOption('location'),
$this->definition->getOption('style') $this->definition->getOption('style')
); );