I am writing a CSS Notifier service in PHP to receive XML notification data. I have managed to get the authentication working, but the XML Payload (sent as POST Body) is bombing with the error “Invalid XML Payload Supplied”.
The XML Data being sent looks like this:
<?xml version="1.0" encoding="UTF-8"?> <submission-notification> <form> <id type="integer">1</id> <name>FORM_NAME</name> <guid>FORM_GUID</guid> </form> <submission> <guid>SUBMISSION_GUID</guid> </submission> </submission-notification>
Im using SimpleXML to read in the payload data:
curl -i -k -3 -X POST https://relay.wastestrategies.com/rest/user/session
-H "X-DreamFactory-Application-Name: canvasnotifier"
-d "{ \"email\" : \"user@example.com\", \"password\" : \"Password\" }"
$dataPOST = trim(file_get_contents("php://input"));
$xmlData = simplexml_load_string($dataPOST);
$notification = new SimpleXMLElement($xmlData);
if(!isset( $notification->submission[0]->guid )){
http_response_code(406);
]; return [
"success" => false,
"message" => "Missing submission GUID in params"
];
}
$submission_guid = $notification->submission[0]->guid;
http_response_code(200);
return [
"success" => true,
"result" => $submission_guid
];
Any ideas why the payload would be invalid?