diff --git a/ServiceBinding/RpcLiteralRequestMessageBinder.php b/ServiceBinding/RpcLiteralRequestMessageBinder.php index 21cfe17..f550a8b 100644 --- a/ServiceBinding/RpcLiteralRequestMessageBinder.php +++ b/ServiceBinding/RpcLiteralRequestMessageBinder.php @@ -96,12 +96,14 @@ class RpcLiteralRequestMessageBinder implements MessageBinderInterface $value = $p->getValue($message); } - $value = $this->processType($type->getValue(), $value); + if (null !== $value) { + $value = $this->processType($type->getValue(), $value); - if ($p->isPublic()) { - $message->{$type->getName()} = $value; - } else { - $p->setValue($message, $value); + if ($p->isPublic()) { + $message->{$type->getName()} = $value; + } else { + $p->setValue($message, $value); + } } if (!$type->isNillable() && null === $value) { @@ -111,4 +113,4 @@ class RpcLiteralRequestMessageBinder implements MessageBinderInterface return $message; } -} \ No newline at end of file +} diff --git a/ServiceBinding/RpcLiteralResponseMessageBinder.php b/ServiceBinding/RpcLiteralResponseMessageBinder.php index d4e57df..cb6635b 100644 --- a/ServiceBinding/RpcLiteralResponseMessageBinder.php +++ b/ServiceBinding/RpcLiteralResponseMessageBinder.php @@ -81,12 +81,14 @@ class RpcLiteralResponseMessageBinder implements MessageBinderInterface $value = $p->getValue($message); } - $value = $this->processType($type->getValue(), $value); + if (null !== $value) { + $value = $this->processType($type->getValue(), $value); - if ($p->isPublic()) { - $message->{$type->getName()} = $value; - } else { - $p->setValue($message, $value); + if ($p->isPublic()) { + $message->{$type->getName()} = $value; + } else { + $p->setValue($message, $value); + } } if (!$type->isNillable() && null === $value) { diff --git a/Tests/ServiceBinding/RpcLiteralRequestMessageBinderTest.php b/Tests/ServiceBinding/RpcLiteralRequestMessageBinderTest.php index b48adf7..d1e9786 100644 --- a/Tests/ServiceBinding/RpcLiteralRequestMessageBinderTest.php +++ b/Tests/ServiceBinding/RpcLiteralRequestMessageBinderTest.php @@ -133,7 +133,7 @@ class RpcLiteralRequestMessageBinderTest extends \PHPUnit_Framework_TestCase ); $result = $result['simple_arrays']; - $this->assertEquals(array(), $result->array1); + $this->assertEquals(null, $result->array1); $this->assertEquals(array(), $result->getArray2()); $this->assertEquals($array, $result->getArray3()); }