I found and tried the code below but it does not look to be working. I have an installation of OE 11.1 on Windows 2008 Server. Also the vendor will only sent response to a secure HTTPS URL.
{src/web/method/cgidefs.i}
define variable XMLDocHandle as handle no-undo.
define variable XMLSaveDirectory as character initial "\bh\logs\".
if web-context:is-xml then
do:
create x-document XMLDocHandle.
XMLDocHandle = web-context:x-document.
/* Save the document to file */
output-content-type("text/xml").
XMLDocHandle:save("file",XMLSaveDirectory + "pygtnotification.xml ).
delete object XMLDocHandle.
end.
The Vendor provided a PHP sample of what the page should look like as follows
// Read the raw POST data containing the XML response
$rawXML = file_get_contents("php://input");
// Arrays to hold the data returned
$dataError = "";
$dataAuth = "";
// Functions required to parse the XML data returned
function startElement($parser, $name, $attrs)
{
global $dataError, $dataAuth;
if ($name == "AUTHRX") $dataAuth = $attrs;
if ($name == "ERRORRX") $dataError = $attrs;
}
function endElement($parser, $name)
{
}
// Calculate the name of the file that will store the values.
$FileName = "Notify_".date("Ymd").".txt";
// Open the file that will store the values
$handle = fopen(dirname($_SERVER['PATH_TRANSLATED']).$FileName,"a+");
// Create XML parser and set element handlers
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
// Read the XML response and stop if an unexpected error occurred.
if (xml_parse($xml_parser, $rawXML)) {
$data = "Raw XML\r\n".
"-------\r\n".
$rawXML."\r\n";
fwrite($handle, $data);
if ($dataError) {
// XML returned an error; write the error to the file
$data = "ecode: ".$dataError['ECODE'].
"\r\nedesc: ".$dataError['EDESC'];
fwrite($handle, $data);
} elseif ($dataAuth) {
// XML returned a response message; write the values to the file
$data = "tid: ".$dataAuth['TID'].
"\r\nstat: ".$dataAuth['STAT'].
"\r\nres: ".$dataAuth['RES'].
"\r\nrisk: ".$dataAuth['RISK'];
fwrite($handle, $data);
}
} else {
// The XML received is not valid
$data = sprintf("The XML notification is not well formed; reason: %d \r\n", xml_error_string(xml_get_error_code($xml_parser)));
fwrite($handle, $data);
}
// Destroy XML parser
xml_parser_free($xml_parser);
// Close the file
fwrite($handle, "\r\n\r\n");
fclose($handle);
// Return the value OK to acknowledge that the notification has been received.
die("OK");