XML Import Mapping -- DOCTYPE workaround?

0
I am working with a legacy device that POSTs XML to a Published REST Service. The payload XML begins with: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE transaction SYSTEM "redacted.dtd"> <transaction> ... </transaction> I am receiving the following response: { "error": { "code": "400", "message": "The XML could not be parsed. DOCTYPE is disallowed when the feature \"http://apache.org/xml/features/disallow-doctype-decl\" set to true." } } I researched this and found that DOCTYPE is disallowed due to security issues. Is there a workaround? The DOCTYPE isn't necessary, is there a way to pre-process the payload and strip these lines? I cannot modify the firmware of the device to remove them at the source.  
asked
1 answers
0

You could maybe delay the import mapping. Use a System.HttpRequest as input parameter in the flow that you use in your published service, then create a string variable where you delete the line and then use your import mapping on the string variable.

Delete the line e.g. by

replaceFirst($httpRequest/Content, '<!DOCTYPE.*>', '')

 

answered