I've for a REST endpoint that will be accepting a POST in the form of XML. Currently it's throwing an "Invalid xml message received" in vendor/friendsofsymfony/rest-bundle/EventListener/BodyListener.php (line 115) when it attempts to decode the content.
Here's the first three lines of code. Note the XML itself validates.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE SupplierSyncMessage SYSTEM "http://integrations.sciquest.com/app_docs/dtd/supplier/TSMSupplier.dtd">
<SupplierSyncMessage version="1.0">
Best I can tell the offending part is:
<!DOCTYPE SupplierSyncMessage SYSTEM "http://integrations.sciquest.com/app_docs/dtd/supplier/TSMSupplier.dtd">
If I remove this line from my test post the request goes through.
I won't have the latitude to receive the XML without this string in it, so is there a config or something that will tell the decoder to ignore it? Is there some other config that tells it to use the .dtd to validate the XML?
Any idea what I'm missing.. Not real sure where to start looking.
Adding the controller code.
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
class DefaultController
{
/**
* Retrieves data via POST
*
* @Route("/api/import", methods={"POST"})
*
*
* @param Request $request
* @return \Symfony\Component\HttpFoundation\JsonResponse
* @throws \Exception
*/
public function getXML(Request $request) {
print_r($request); exit;
}
}