From b5af83f9d259217aad459e73c833773b5c2f87d5 Mon Sep 17 00:00:00 2001 From: Andreas Schamberger Date: Fri, 23 Aug 2013 20:30:50 +0200 Subject: [PATCH] add workaround for cli webserver, option implemented in client --- src/BeSimple/SoapServer/SoapRequest.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/BeSimple/SoapServer/SoapRequest.php b/src/BeSimple/SoapServer/SoapRequest.php index 8a03d7a..427673f 100644 --- a/src/BeSimple/SoapServer/SoapRequest.php +++ b/src/BeSimple/SoapServer/SoapRequest.php @@ -32,10 +32,21 @@ class SoapRequest extends CommonSoapRequest */ public static function create($content, $version) { - $content = is_null($content) ? file_get_contents("php://input") : $content; $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(); // $content is if unmodified from SoapClient not a php string type!