Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix methods declarations #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 34 additions & 5 deletions src/BeSimple/SoapBundle/Converter/XopIncludeTypeConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
*/
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);
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
namespace BeSimple\SoapBundle\ServiceBinding;

use BeSimple\SoapBundle\ServiceDefinition\Method;
use BeSimple\SoapCommon\Definition\Type\TypeRepository;

/**
* @author Christian Kerl <[email protected]>
*/
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();
Expand Down
28 changes: 28 additions & 0 deletions src/BeSimple/SoapCommon/Converter/RequestAwareInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

/*
* This file is part of the BeSimpleSoapCommon.
*
* (c) Christian Kerl <[email protected]>
* (c) Francis Besset <[email protected]>
*
* 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);
}