diff --git a/.gitignore b/.gitignore index 72bd9c9f..cd1adfe5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /vendor/ composer.lock phpunit.xml +.idea/* diff --git a/src/BeSimple/SoapBundle/ServiceBinding/RpcLiteralRequestMessageBinder.php b/src/BeSimple/SoapBundle/ServiceBinding/RpcLiteralRequestMessageBinder.php index 13abf080..7834607b 100644 --- a/src/BeSimple/SoapBundle/ServiceBinding/RpcLiteralRequestMessageBinder.php +++ b/src/BeSimple/SoapBundle/ServiceBinding/RpcLiteralRequestMessageBinder.php @@ -49,13 +49,15 @@ public function processMessage(Method $messageDefinition, $message, TypeReposito protected function processType($phpType, $message) { $isArray = false; + $arrayOfTypeName = ''; $type = $this->typeRepository->getType($phpType); if ($type instanceof ArrayOfType) { $isArray = true; $array = array(); + $arrayOfTypeName = str_replace('ArrayOf', '', $type->getXmlType()); - $type = $this->typeRepository->getType($type->get('item')->getType()); + $type = $this->typeRepository->getType($type->get($arrayOfTypeName)->getType()); } // @TODO Fix array reference @@ -63,8 +65,8 @@ protected function processType($phpType, $message) $phpType = $type->getPhpType(); if ($isArray) { - if (isset($message->item)) { - foreach ($message->item as $complexType) { + if (isset($message->{$arrayOfTypeName})) { + foreach ($message->{$arrayOfTypeName} as $complexType) { $array[] = $this->checkComplexType($phpType, $complexType); } @@ -84,8 +86,8 @@ protected function processType($phpType, $message) $message = $this->checkComplexType($phpType, $message); } } elseif ($isArray) { - if (isset($message->item)) { - $message = $message->item; + if (isset($message->{$arrayOfTypeName})) { + $message = $message->{$arrayOfTypeName}; } else { $message = $array; } diff --git a/src/BeSimple/SoapBundle/ServiceBinding/RpcLiteralResponseMessageBinder.php b/src/BeSimple/SoapBundle/ServiceBinding/RpcLiteralResponseMessageBinder.php index b6b4361c..2de156d1 100644 --- a/src/BeSimple/SoapBundle/ServiceBinding/RpcLiteralResponseMessageBinder.php +++ b/src/BeSimple/SoapBundle/ServiceBinding/RpcLiteralResponseMessageBinder.php @@ -42,8 +42,9 @@ private function processType($phpType, $message) $type = $this->typeRepository->getType($phpType); if ($type instanceof ArrayOfType) { $isArray = true; + $arrayOfTypeName = str_replace('ArrayOf', '', $type->getXmlType()); - $type = $this->typeRepository->getType($type->get('item')->getType()); + $type = $this->typeRepository->getType($type->get($arrayOfTypeName)->getType()); } if ($type instanceof ComplexType) { diff --git a/src/BeSimple/SoapCommon/Definition/Type/ArrayOfType.php b/src/BeSimple/SoapCommon/Definition/Type/ArrayOfType.php index 6f052152..007681b9 100644 --- a/src/BeSimple/SoapCommon/Definition/Type/ArrayOfType.php +++ b/src/BeSimple/SoapCommon/Definition/Type/ArrayOfType.php @@ -25,6 +25,6 @@ public function __construct($phpType, $arrayOf, $xmlTypeOf) parent::__construct($phpType, 'ArrayOf'.ucfirst($xmlTypeOf ?: $arrayOf)); - $this->add('item', $arrayOf); + $this->add($xmlTypeOf, $arrayOf); } }