From 63d3611006fa338978f9794943278c5f955d0e91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0ar=C5=ABnas=20Dubinskas?= Date: Wed, 11 Jan 2012 15:11:55 +0200 Subject: [PATCH] Fix to allow ComplexType to be nillable --- ServiceBinding/RpcLiteralRequestMessageBinder.php | 4 +++- ServiceBinding/RpcLiteralResponseMessageBinder.php | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ServiceBinding/RpcLiteralRequestMessageBinder.php b/ServiceBinding/RpcLiteralRequestMessageBinder.php index edef394..edcaecc 100644 --- a/ServiceBinding/RpcLiteralRequestMessageBinder.php +++ b/ServiceBinding/RpcLiteralRequestMessageBinder.php @@ -96,7 +96,9 @@ class RpcLiteralRequestMessageBinder implements MessageBinderInterface $value = $p->getValue($message); } - $value = $this->processType($type->getValue(), $value); + if ($value !== null) { + $value = $this->processType($type->getValue(), $value); + } if (!$type->isNillable() && null === $value) { throw new \SoapFault('SOAP_ERROR_COMPLEX_TYPE', sprintf('"%s:%s" cannot be null.', ucfirst(Wsdl::translateType($phpType)), $type->getName())); diff --git a/ServiceBinding/RpcLiteralResponseMessageBinder.php b/ServiceBinding/RpcLiteralResponseMessageBinder.php index 5cb6310..f894d97 100644 --- a/ServiceBinding/RpcLiteralResponseMessageBinder.php +++ b/ServiceBinding/RpcLiteralResponseMessageBinder.php @@ -82,7 +82,11 @@ class RpcLiteralResponseMessageBinder implements MessageBinderInterface $p->setAccessible(true); $value = $p->getValue($message); - $p->setValue($message, $this->processType($type->getValue(), $value)); + if ($value !== null) { + $value = $this->processType($type->getValue(), $value); + } + + $p->setValue($message, $value); } if (!$type->isNillable() && null === $value) {