diff --git a/src/BeSimple/SoapBundle/Converter/XopIncludeTypeConverter.php b/src/BeSimple/SoapBundle/Converter/XopIncludeTypeConverter.php index b83e38d9..0f54f66a 100644 --- a/src/BeSimple/SoapBundle/Converter/XopIncludeTypeConverter.php +++ b/src/BeSimple/SoapBundle/Converter/XopIncludeTypeConverter.php @@ -11,26 +11,48 @@ namespace BeSimple\SoapBundle\Converter; use BeSimple\SoapBundle\Soap\SoapRequest; -use BeSimple\SoapBundle\Soap\SoapResponse; use BeSimple\SoapBundle\Util\String; +use BeSimple\SoapCommon\Converter\RequestAwareInterface; use BeSimple\SoapCommon\Converter\TypeConverterInterface; /** * @author Christian Kerl */ -class XopIncludeTypeConverter implements TypeConverterInterface +class XopIncludeTypeConverter implements TypeConverterInterface, RequestAwareInterface { + /** + * @var SoapRequest + */ + protected $request; + + /** + * {@inheritdoc} + */ + function setRequest(SoapRequest $request) + { + $this->request = $request; + } + + /** + * {@inheritdoc} + */ public function getTypeNamespace() { return 'http://www.w3.org/2001/XMLSchema'; } + /** + * {@inheritdoc} + */ public function getTypeName() { return 'base64Binary'; } - public function convertXmlToPhp(SoapRequest $request, $data) + /** + * {@inheritdoc} + */ + public function convertXmlToPhp($data) { $doc = new \DOMDocument(); $doc->loadXML($data); @@ -43,13 +65,20 @@ public function convertXmlToPhp(SoapRequest $request, $data) if (String::startsWith($ref, 'cid:')) { $cid = urldecode(substr($ref, 4)); - return $request->getSoapAttachments()->get($cid)->getContent(); + if (!$this->request) { + throw new \InvalidArgumentException('Request is missing'); + } + + return $this->request->getSoapAttachments()->get($cid)->getContent(); } return $data; } - public function convertPhpToXml(SoapResponse $response, $data) + /** + * {@inheritdoc} + */ + public function convertPhpToXml($data) { return $data; } diff --git a/src/BeSimple/SoapBundle/ServiceBinding/DocumentLiteralWrappedRequestMessageBinder.php b/src/BeSimple/SoapBundle/ServiceBinding/DocumentLiteralWrappedRequestMessageBinder.php index 5d779b01..acd80d2f 100644 --- a/src/BeSimple/SoapBundle/ServiceBinding/DocumentLiteralWrappedRequestMessageBinder.php +++ b/src/BeSimple/SoapBundle/ServiceBinding/DocumentLiteralWrappedRequestMessageBinder.php @@ -11,13 +11,17 @@ namespace BeSimple\SoapBundle\ServiceBinding; use BeSimple\SoapBundle\ServiceDefinition\Method; +use BeSimple\SoapCommon\Definition\Type\TypeRepository; /** * @author Christian Kerl */ class DocumentLiteralWrappedRequestMessageBinder implements MessageBinderInterface { - public function processMessage(Method $messageDefinition, $message) + /** + * {@inheritdoc} + */ + public function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository) { if(count($message) > 1) { throw new \InvalidArgumentException(); diff --git a/src/BeSimple/SoapCommon/Converter/RequestAwareInterface.php b/src/BeSimple/SoapCommon/Converter/RequestAwareInterface.php new file mode 100644 index 00000000..db102976 --- /dev/null +++ b/src/BeSimple/SoapCommon/Converter/RequestAwareInterface.php @@ -0,0 +1,28 @@ + + * (c) Francis Besset + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace BeSimple\SoapCommon\Converter; + +use BeSimple\SoapBundle\Soap\SoapRequest; + +/** + * Request aware interface. + */ +interface RequestAwareInterface +{ + /** + * Set request. + * + * @param SoapRequest $request + */ + function setRequest(SoapRequest $request); +}