HQU XML Web Services
HQU plugins can be invoked as a web-service, returning values as XML.
Requests are sent to HQ via a regular HTTP request:
curl https://hqadmin:hqadmin@localhost:7443/hqu/myplugin/edator/findUsers.hqu
and result in XML:
<users> <user Name="JoeBob" Id="2323"/> <user Name="hqadmin" Id="1"/> </users>
Easy-returning XML from controllers
HQU provides an instance of groovy.xml.MarkupBuilder to controller methods set with setXMLMethods()
See Also: Using MarkupBuilder for Agile Xml Creation
class EdatorController extends BaseController {
EdatorController() {
setXMLMethods(['findUsers'])
}
def findUsers(xmlBuilder, params) {
xmlBuilder.users {
for (u in UserManager.getUsers()) {
user(Name:u.name, Id:id)
}
}
xmlBuilder
}
}
By using setXMLMethods, HQU will create a MarkupBuilder and pass it in as the first argument to your controller method. The controller should return the builder object, or some other XML that it wants to render.