Return XML from a Request Handler

Guest post from Jim Lehmer, originally published on his now deleted blog - Wednesday, August 26, 2009

During LiveLink training this week it suddenly hit me that with very little effort at all one should be able to create a LiveLink request handler and instead of excreting HTML for end-user consumption instead send back dynamically generated XML (or CSV-formatted values, or JSON or text or whatever) using a minimum amount of programming on the LiveLink side except for some OScript in the Weblingo files.

Given that LiveLink's functionality is accessible via parameter driven URLs, this seemed like a great way to provide a RESTful like solution with "no code" (other than some OScript, but hey, that's not real code, right? :o). After some playing around I got it working and this post is meant to document how I did it, both for myself and for anyone who stumbles across this via search engines.

Sample WebLingo File 1 Sample WebLingo File 2
							
							    
							        `System.RefCounts()`
							    
							
						
							;System.BaselineRefCounts()
							
							LiveLink stats:
							
							

						
Sample Execute Method
							function Dynamic Execute(Dynamix ctxIn, Dynamic ctxOut, Record r)
							    .fExtraHeaders ='Content-Distribution: attachment;filename=test.xml' + Web.CRLF;
							    return undefined;
							end
						
Website Designed by Adservio Consulting Valid HTML 4.01 Strict    Valid CSS!    Level A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0