implemented basic SoapKernel to transform a SoapRequest to a SoapResponse

This commit is contained in:
Christian Kerl
2010-10-05 21:44:30 +02:00
parent 54a76a4ef8
commit b0681e5fcf
10 changed files with 414 additions and 31 deletions

68
Soap/SoapRequest.php Normal file
View File

@ -0,0 +1,68 @@
<?php
/*
* This file is part of the WebServiceBundle.
*
* (c) Christian Kerl <christian-kerl@web.de>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Bundle\WebServiceBundle\Soap;
use Symfony\Component\HttpFoundation\Request;
/**
* SoapRequest.
*
* @author Christian Kerl <christian-kerl@web.de>
*/
class SoapRequest extends Request
{
/**
* @var string
*/
protected $rawContent;
/**
* @var string
*/
protected $soapAction;
/**
* @var unknown
*/
protected $soapHeader;
/**
* @var unknown
*/
protected $soapArguments;
public function __construct($rawContent = null, array $query = null, array $attributes = null, array $cookies = null, array $server = null)
{
parent::__construct($query, null, $attributes, $cookies, null, $server);
$this->rawContent = $rawContent != null ? $rawContent : $this->loadRawContent();
}
/**
* Gets the SOAP XML content.
*
* @return string
*/
public function getRawContent()
{
return $this->rawContent;
}
/**
* Loads the plain HTTP POST data.
*
* @return string
*/
protected function loadRawContent()
{
return isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : file_get_contents('php://input');
}
}

48
Soap/SoapResponse.php Normal file
View File

@ -0,0 +1,48 @@
<?php
/*
* This file is part of the WebServiceBundle.
*
* (c) Christian Kerl <christian-kerl@web.de>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Bundle\WebServiceBundle\Soap;
use Symfony\Component\HttpFoundation\Response;
/**
* SoapResponse.
*
* @author Christian Kerl <christian-kerl@web.de>
*/
class SoapResponse extends Response
{
protected $soapHeaders;
protected $soapReturnValue;
public function __construct($returnValue)
{
parent::__construct();
$this->soapHeaders = array();
$this->soapReturnValue = $returnValue;
}
public function addSoapHeader(\SoapHeader $header)
{
$this->soapHeaders[] = $header;
}
public function getSoapHeaders()
{
return $this->soapHeaders;
}
public function getReturnValue()
{
return $this->soapReturnValue;
}
}