add workaround for cli webserver, option implemented in client

This commit is contained in:
Andreas Schamberger 2013-08-23 20:30:50 +02:00
parent 9f9bab242d
commit b5af83f9d2
1 changed files with 14 additions and 3 deletions

View File

@ -32,10 +32,21 @@ class SoapRequest extends CommonSoapRequest
*/ */
public static function create($content, $version) public static function create($content, $version)
{ {
$content = is_null($content) ? file_get_contents("php://input") : $content;
$location = self::getCurrentUrl(); $location = self::getCurrentUrl();
$action = $_SERVER[SoapMessage::SOAP_ACTION_HEADER]; /*
$contentType = $_SERVER[SoapMessage::CONTENT_TYPE_HEADER]; * Work around missing header/php://input access in PHP cli webserver by
* setting headers additionally as GET parameters and SOAP request body
* explicitly as POST variable
*/
if (php_sapi_name() == "cli-server") {
$content = is_null($content) ? $_POST['request'] : $content;
$action = $_GET[SoapMessage::SOAP_ACTION_HEADER];
$contentType = $_GET[SoapMessage::CONTENT_TYPE_HEADER];
} else {
$content = is_null($content) ? file_get_contents("php://input") : $content;
$action = $_SERVER[SoapMessage::SOAP_ACTION_HEADER];
$contentType = $_SERVER[SoapMessage::CONTENT_TYPE_HEADER];
}
$request = new SoapRequest(); $request = new SoapRequest();
// $content is if unmodified from SoapClient not a php string type! // $content is if unmodified from SoapClient not a php string type!