SoapServer now handles get WSDL requests

This commit is contained in:
Petr Bechyně 2016-11-09 13:43:18 +01:00
parent bd1fbf9cfc
commit c4d993585f
2 changed files with 37 additions and 19 deletions

View File

@ -142,6 +142,7 @@ class Parser
*/ */
private static function parseContentTypeHeader(PartHeader $part, $headerName, $headerValue) private static function parseContentTypeHeader(PartHeader $part, $headerName, $headerValue)
{ {
if (strpos($headerValue, ';')) {
list($value, $remainder) = explode(';', $headerValue, 2); list($value, $remainder) = explode(';', $headerValue, 2);
$value = trim($value); $value = trim($value);
$part->setHeader($headerName, $value); $part->setHeader($headerName, $value);
@ -152,7 +153,7 @@ class Parser
} }
$name = $matches[1]; $name = $matches[1];
$delimiter = $matches[2]; $delimiter = $matches[2];
$remainder = substr($remainder, strlen($name)+1); $remainder = substr($remainder, strlen($name) + 1);
if (!preg_match('/([^;]+)(;)?(\s|$)?/', $remainder, $matches)) { if (!preg_match('/([^;]+)(;)?(\s|$)?/', $remainder, $matches)) {
break; break;
} }
@ -163,6 +164,9 @@ class Parser
$part->setHeader($headerName, $name, $value); $part->setHeader($headerName, $name, $value);
$remainder = substr($remainder, strlen($matches[0])); $remainder = substr($remainder, strlen($matches[0]));
} }
} else {
$part->setHeader($headerName, $headerValue);
}
} }
/** /**

View File

@ -117,6 +117,20 @@ class SoapServer extends \SoapServer
} }
} }
public function handleWsdlRequest(SoapRequest $soapRequest)
{
ob_start();
parent::handle();
$nativeSoapServerResponse = ob_get_clean();
return SoapResponseFactory::create(
$nativeSoapServerResponse,
$soapRequest->getLocation(),
$soapRequest->getAction(),
$soapRequest->getVersion()
);
}
/** /**
* Runs the currently registered request filters on the request, calls the * Runs the currently registered request filters on the request, calls the
* necessary functions (through the parent's class handle()) and runs the * necessary functions (through the parent's class handle()) and runs the