query)) { throw new Api_WfsException("Only WPS Service is allowed"); } $req = V::geti('request', '', $request->query); if (!empty($req)) { $methodName = "{$req}Action"; if (!method_exists($this, $methodName)) { throw new Api_WfsException("Not Implemented " . htmlspecialchars($req), 501); } $this->DBG("WpsServer->{$methodName}() ...", __LINE__); $document = $this->$methodName($urlQuery); } else { $this->DBG("WpsServer->parseXMLRequest() ...", __LINE__); $document = $this->parseXMLRequest(); header('Content-type: application/xml'); echo ''; echo $document; exit;// TODO: return $document; } IF(V::get('DBG','',$_GET)){echo'
$document (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($document);echo'';}
if ('raw' == V::get('outputFormat', '', $request->query)) {
header('Content-type: text/plain; charset=utf-8');
echo $document;
} else {
header('Content-type: application/xml');
echo $document;
}
}
public function parseXMLRequest() {
$data = array();
$reqContent = Request::getRequestBody();
if (empty($reqContent)) {
throw new Exception("Empty request");
}
$parserXml = xml_parser_create();
xml_parser_set_option($parserXml, XML_OPTION_CASE_FOLDING, 0);
xml_parser_set_option($parserXml, XML_OPTION_SKIP_WHITE, 1);
if (0 == xml_parse_into_struct($parserXml, $reqContent, $tags)) {
throw new Exception("Error parsing xml");
}
xml_parser_free($parserXml);
if (empty($tags)) {
throw new Exception("Empty structure from request");
}
$rootTagName = V::get('tag', '', $tags[0]);
if ('Transaction' == $rootTagName) return $this->_parseTransactionXmlStruct($reqContent, $tags);
throw new Api_WfsException("Not implemented '{$rootTagName}' #L." . __LINE__, 501);
}
function describeProcessAction() {
$identifier = V::geti('identifier', '', $_REQUEST);
if (empty($identifier)) throw new HttpException("Missing identifier", 400);
if ('JTS:Aarea' === $identifier) return self::exampleDescribeProcess_JTS_Area();
if ('vec:Feature' === $identifier) return self::exampleDescribeProcess_vec_Feature();
$wpsServerUrl = $this->getBaseUri();
Api_WpsV1_DescribeProcess::sendDescribeProcessXml($wpsServerUrl, $identifier);
}
static function exampleDescribeProcess_JTS_Area() {
header('Content-type: application/xml; charset=utf-8');
echo '