diff --git a/ServiceBinding/RpcLiteralRequestMessageBinder.php b/ServiceBinding/RpcLiteralRequestMessageBinder.php index f3c0b99..e058547 100644 --- a/ServiceBinding/RpcLiteralRequestMessageBinder.php +++ b/ServiceBinding/RpcLiteralRequestMessageBinder.php @@ -61,6 +61,16 @@ class RpcLiteralRequestMessageBinder implements MessageBinderInterface foreach ($message->item 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; diff --git a/ServiceBinding/RpcLiteralResponseMessageBinder.php b/ServiceBinding/RpcLiteralResponseMessageBinder.php index bfb752d..dfdd509 100644 --- a/ServiceBinding/RpcLiteralResponseMessageBinder.php +++ b/ServiceBinding/RpcLiteralResponseMessageBinder.php @@ -46,6 +46,16 @@ class RpcLiteralResponseMessageBinder implements MessageBinderInterface if ($isArray) { $array = array(); + // See https://github.com/BeSimple/BeSimpleSoapBundle/issues/29 + if (is_array($message) && in_array('BeSimple\SoapCommon\Type\AbstractKeyValue', class_parents($phpType))) { + $keyValue = array(); + foreach ($message as $key => $value) { + $keyValue[] = new $phpType($key, $value); + } + + $message = $keyValue; + } + foreach ($message as $complexType) { $array[] = $this->checkComplexType($phpType, $complexType); }