Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0

env:
- SYMFONY_VERSION=2.6.*
- SYMFONY_VERSION="dev-master symfony/debug:~2.7@dev symfony/http-kernel:~2.7@dev"
- SYMFONY_VERSION=2.3.*
- SYMFONY_VERSION=2.7.*

before_script:
- phpenv config-add myphp.ini
- composer self-update
- composer require symfony/framework-bundle:${SYMFONY_VERSION} --no-update
- composer update --no-interaction --prefer-source
Expand All @@ -22,4 +22,4 @@ script:

matrix:
allow_failures:
- env: SYMFONY_VERSION="dev-master symfony/debug:~2.7@dev symfony/http-kernel:~2.7@dev"
- env: SYMFONY_VERSION=2.3.*
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Build SOAP and WSDL based web services

[![Build Status](https://travis-ci.org/phpmike/BeSimpleSoap.svg?branch=0.4)](https://travis-ci.org/phpmike/BeSimpleSoap)

# Components

BeSimpleSoap consists of five components ...
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"ext-soap": "*",
"ext-curl": "*",
"ass/xmlsecurity": "~1.0",
"symfony/framework-bundle": "~2.6",
"symfony/twig-bundle": "~2.6",
"symfony/framework-bundle": "~2.3",
"symfony/twig-bundle": "~2.3",
"zendframework/zend-mime": "2.1.*"
},
"replace": {
Expand Down
2 changes: 2 additions & 0 deletions myphp.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
date.timezone = "Europe/Paris"
always_populate_raw_post_data = -1
4 changes: 2 additions & 2 deletions src/BeSimple/SoapBundle/Converter/XopIncludeTypeConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

use BeSimple\SoapBundle\Soap\SoapRequest;
use BeSimple\SoapBundle\Soap\SoapResponse;
use BeSimple\SoapBundle\Util\String;
use BeSimple\SoapBundle\Util\BsString;
use BeSimple\SoapCommon\Converter\TypeConverterInterface;

/**
Expand Down Expand Up @@ -40,7 +40,7 @@ public function convertXmlToPhp(SoapRequest $request, $data)

$ref = $include->getAttribute('href');

if (String::startsWith($ref, 'cid:')) {
if (BsString::startsWith($ref, 'cid:')) {
$cid = urldecode(substr($ref, 4));

return $request->getSoapAttachments()->get($cid)->getContent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ public function processMessage(Method $messageDefinition, $message, TypeReposito
protected function processType($phpType, $message)
{
$isArray = false;

$type = $this->typeRepository->getType($phpType);
if ($type instanceof ArrayOfType) {
$isArray = true;
$array = array();

$type = $this->typeRepository->getType($type->get('item')->getType());
$phpType = substr($type->getPhpType(), 0, strlen($type->getPhpType()) - 2);
$type = $this->typeRepository->getType($phpType);
}

// @TODO Fix array reference
Expand All @@ -78,6 +78,21 @@ protected function processType($phpType, $message)
$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;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ public function processMessage(Method $messageDefinition, $message, TypeReposito
{
$this->typeRepository = $typeRepository;

return $this->processType($messageDefinition->getOutput()->get('return')->getType(), $message);
$parts = $messageDefinition->getOutput()->all();
$part = array_shift($parts);

return $this->processType($part->getType(), $message);
}

private function processType($phpType, $message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ComplexType extends Configuration
private $name;
private $value;
private $isNillable = false;
private $isAttribute = false;

public function getName()
{
Expand Down Expand Up @@ -49,6 +50,26 @@ public function setNillable($isNillable)
$this->isNillable = (bool) $isNillable;
}

/**
* @return bool
*/
public function isAttribute()
{
return $this->isAttribute;
}

/**
* @param bool $isAttribute
*
* @return $this
*/
public function setIsAttribute($isAttribute)
{
$this->isAttribute = $isAttribute;

return $this;
}

public function getAliasName()
{
return 'complextype';
Expand Down
21 changes: 21 additions & 0 deletions src/BeSimple/SoapBundle/ServiceDefinition/ComplexType.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ComplexType
private $name;
private $value;
private $isNillable = false;
private $isAttribute = false;

public function getName()
{
Expand Down Expand Up @@ -50,4 +51,24 @@ public function setNillable($isNillable)
{
$this->isNillable = (bool) $isNillable;
}

/**
* @return bool
*/
public function isAttribute()
{
return $this->isAttribute;
}

/**
* @param bool $isAttribute
*
* @return $this
*/
public function setIsAttribute($isAttribute)
{
$this->isAttribute = $isAttribute;

return $this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function load($class, $type = null)
}

$serviceReturn = $annotation->getPhpType();
$serviceXmlReturn = $annotation->getXmlType();
}
}

Expand All @@ -116,7 +117,11 @@ public function load($class, $type = null)
throw new \LogicException(sprintf('@Soap\Result non-existent for "%s".', $method->getName()));
}

$serviceMethod->setOutput($this->loadType($serviceReturn));
if (!isset($serviceXmlReturn) || !$serviceXmlReturn) {
$serviceXmlReturn = 'return';
}

$serviceMethod->setOutput($this->loadType($serviceReturn), $serviceXmlReturn);

$definition->addMethod($serviceMethod);
}
Expand Down Expand Up @@ -155,7 +160,7 @@ private function loadType($phpType)
$loaded = $complexTypeResolver->load($phpType);
$complexType = new ComplexType($phpType, isset($loaded['alias']) ? $loaded['alias'] : $phpType);
foreach ($loaded['properties'] as $name => $property) {
$complexType->add($name, $this->loadType($property->getValue()), $property->isNillable());
$complexType->add($name, $this->loadType($property->getValue()), $property->isNillable(), $property->isAttribute());
}

$this->typeRepository->addComplexType($complexType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function load($class, $type = null)
$propertyComplexType = new ComplexType();
$propertyComplexType->setValue($complexType->getValue());
$propertyComplexType->setNillable($complexType->isNillable());
$propertyComplexType->setIsAttribute($complexType->isAttribute());
$propertyComplexType->setName($property->getName());
$annotations['properties']->add($propertyComplexType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @author Christian Kerl <[email protected]>
*/
class String
class BsString
{
/**
* Checks if a string starts with a given string.
Expand Down
5 changes: 4 additions & 1 deletion src/BeSimple/SoapBundle/WebServiceContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ public function getWsdlFile($endpoint = null)
}

$dumper = new Dumper($definition, array('stylesheet' => $this->options['wsdl_stylesheet']));
$cache->write($dumper->dump());

$wsdl = $dumper->dump();

$cache->write($wsdl);
}

return (string) $cache;
Expand Down
4 changes: 2 additions & 2 deletions src/BeSimple/SoapBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"besimple/soap-common": "0.3.*",
"besimple/soap-wsdl": "0.3.*",
"ass/xmlsecurity": "~1.0",
"symfony/framework-bundle": "~2.6",
"symfony/twig-bundle": "~2.6",
"symfony/framework-bundle": "~2.3",
"symfony/twig-bundle": "~2.3",
"zendframework/zend-mime": "2.1.*"
},
"suggest": {
Expand Down
4 changes: 2 additions & 2 deletions src/BeSimple/SoapCommon/Definition/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public function isEmpty()
return 0 === count($this->parts) ? true : false;
}

public function add($name, $phpType, $nillable = false)
public function add($name, $phpType, $nillable = false, $attribute = false)
{
if ($phpType instanceof TypeInterface) {
$phpType = $phpType->getPhpType();
}

$this->parts[$name] = new Part($name, $phpType, $nillable);
$this->parts[$name] = new Part($name, $phpType, $nillable, $attribute);

return $this;
}
Expand Down
11 changes: 9 additions & 2 deletions src/BeSimple/SoapCommon/Definition/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,19 @@ public function addHeader($name, $type)

public function addInput($name, $type)
{
$inName = $this->name;
$this->input = new Message($inName);

$this->input->add($name, $type);
}

public function setOutput($type)
public function setOutput($type, $name = 'return')
{
$this->output->add('return', $type);
if ('return' !== $name) {
$this->output = new Message($name);
}

$this->output->add($name, $type);
}

public function getHeaders()
Expand Down
24 changes: 23 additions & 1 deletion src/BeSimple/SoapCommon/Definition/Part.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ class Part
protected $name;
protected $type;
protected $nillable;
protected $attribute;

public function __construct($name, $type, $nillable = false)
public function __construct($name, $type, $nillable = false, $attribute = false)
{
$this->name = $name;
$this->type = $type;
$this->setNillable($nillable);
$this->setAttribute($attribute);
}

public function getName()
Expand All @@ -52,4 +54,24 @@ public function setNillable($nillable)
{
$this->nillable = (boolean) $nillable;
}

/**
* @return bool
*/
public function isAttribute()
{
return $this->attribute;
}

/**
* @param bool $attribute
*
* @return $this
*/
public function setAttribute($attribute)
{
$this->attribute = $attribute;

return $this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use BeSimple\SoapCommon\Type\AbstractKeyValue;

class Boolean extends AbstractKeyValue
class BsBoolean extends AbstractKeyValue
{
/**
* @Soap\ComplexType("boolean")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use BeSimple\SoapCommon\Type\AbstractKeyValue;

class Float extends AbstractKeyValue
class BsFloat extends AbstractKeyValue
{
/**
* @Soap\ComplexType("float")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use BeSimple\SoapCommon\Type\AbstractKeyValue;

class Int extends AbstractKeyValue
class BsInt extends AbstractKeyValue
{
/**
* @Soap\ComplexType("int")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use BeSimple\SoapCommon\Type\AbstractKeyValue;

class String extends AbstractKeyValue
class BsString extends AbstractKeyValue
{
/**
* @Soap\ComplexType("string")
Expand Down
2 changes: 1 addition & 1 deletion src/BeSimple/SoapCommon/WsSecurityFilterClientServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ abstract class WsSecurityFilterClientServer
/**
* The date format to be used with {@link \DateTime}
*/
const DATETIME_FORMAT = 'Y-m-d\TH:i:s.000\Z';
const DATETIME_FORMAT = 'Y-m-d\TH:i:s.u\Z';

/**
* (X509 3.2.1) Reference to a Subject Key Identifier
Expand Down
Loading