REST Functionality for XML/RSS in Lucee 5.2

We’re in the process of moving our website from Lucee 4.5 to version 5.2 and we have a number of custom RSS/XML feeds that rely on the component / function REST wiring functionality.

It seems like in Lucee 5.x, we can no longer return custom crafted XML from a rest function. Using the old 4.x code on Lucee 5, these rest functions that output XML now return nothing.

Playing around a bit and making changes to the code, I’m able to get a response output if I add produces="application/xml" to the function definition and have the XML content returned at the bottom of the function.

However, the result is the escaped XML (all of the tags are escaped as <…>)

If we remove produces and use returntype="xml" instead, we get the XML output but it’s surrounded in quotes as a string. In this case, the Content-Type header is set to “application/json;charset=UTF-8”.

We have a lot of services that currently rely on this functionality and with our timeline, completely rewriting isn’t an option.

If anyone has any ideas or tips as to how we can get custom XML out of the REST functions, please let us know. Thanks in advance!

-Nick

is there a ticket for this?

No, there isn’t a ticket.

In this case, we weren’t sure if this was as designed and suspected we might of had some legacy code that maybe should have never worked in the first place. I can create certainly create one with sample code if this is not expected behavior.

Hi, was this issue ever solved? I search and this comes up. Thanks

not sure exactly, but i’ve done a lot of work on REST recently

can you try with the 7.0.1-RC?

1 Like


Hi, thank you very much for the reply and the work you do. I tried 7.0.1.98 RC and the output is still in quotes.

Switching back to ColdFusion (same code), produces the output as XML.

Wait, now I switched Postman to XML and it produced the right result but with a lot of white space. That works for now. Thanks!

2 Likes

The white space can be removed by selecting Settings - Output - Whitespace management - Smart whitespace management in the Lucee administrator.