Commit 0bbe6b29 authored by Benni Mack's avatar Benni Mack
Browse files

[BUGFIX] Deliver WSDL with /ter?wsdl

The SOAP endpoint does not deliver the WSDL file when using
the common ?wsdl GET parameter.

This is now added, allowing to use

http://extensions.typo3.org/ter?wsdl=1

in addition to:

https://extensions.typo3.org/typo3conf/ext/ter/tx_ter_wsdl.php

to conform standards (which are also necessary for the tests)
parent abbdf775
Pipeline #9073 passed with stages
in 6 minutes and 54 seconds
......@@ -58,8 +58,14 @@ class tx_ter_pi1 extends AbstractPlugin
}
}
// Always deliver the proper WSDL file if ?wsdl is given
if (isset(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('wsdl'))) {
require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ter') . 'tx_ter_wsdl.php');
exit;
}
try {
$server = new SoapServer(null, ['uri' => $this->wsdlNamespace, 'trace' => true, 'exceptions' => true]);
$server = new \SoapServer(null, ['uri' => $this->wsdlNamespace, 'trace' => true, 'exceptions' => true]);
$server->setClass(\tx_ter_api::class, $this);
$server->handle(file_get_contents('php://input'));
// Due to different behaviour on stage and prod server we need this exit to prevent wrong XML response
......
......@@ -25,12 +25,13 @@ error_reporting(E_ALL ^ E_NOTICE);
$serviceLocation = 'https://' . $_SERVER['HTTP_HOST'] . '/ter';
$wsdlFileName = 'tx_ter.wsdl';
if (getenv('TYPO3_CONTEXT') === 'Production/Stage') {
if (\TYPO3\CMS\Core\Core\Environment::getContext() === 'Production') {
$wsdlFileName = 'tx_ter.wsdl';
} else {
$wsdlFileName = 'tx_ter.stage.wsdl';
}
$WSDLSource = file_get_contents($wsdlFileName);
$WSDLSource = file_get_contents(__DIR__ . '/' . $wsdlFileName);
$WSDLSource = trim(str_replace('---SERVICE_LOCATION---', $serviceLocation, $WSDLSource));
if (!headers_sent()) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment