I'm using XMLhttp to do some RIA stuff. Rather than having a separate CFM file for each XML file that I need to return, I want to have a single CFC with a bunch of methods in it that return the proper content (XML, using cfheader/cfcontent) to the app.
The question is, can I do this (and is it good practice)? I have a script that I'm working on but it's not working; a cfm page with similar code on it works just fine. Here is the code: <cfcomponent name="XMLconduit" author="Pete Ruckelshaus" displayname="XMLconduit" hint="This .cfc is used for all XML-returned data for the application."> <cfsetting enablecfoutputonly="Yes"> <cffunction name="getContactsByOrganization" access="public" output="Yes" returntype="XML"> <cfargument name="param" default="0" required="Yes" type="numeric"> <cfquery name="getContacts" datasource="#request.app.dsname#"> SELECT C.ID, C.fname, C.lname FROM tblContacts C WHERE C.contactTypeID = (SELECT id FROM tblContactTypes WHERE typename = 'individual') AND C.organizationid = #param# ORDER BY C.fname, C.lname </cfquery> <cfheader name="content-type" value="text/xml"> <cfcontent type="text/xml"> <cfoutput><?xml version="1.0" standalone="yes"?> <contactdata> <cfloop query="getContacts"><id>#getContacts.id#</id> <firstname>#getContacts.fname#</firstname> <lastname>#getContacts.lname#</lastname></cfloop></contactdata></cfoutput> </cffunction> <cfsetting enablecfoutputonly="No"> </cfcomponent> Are there any glaring errors in this code that would explain why I'm not getting anything but whitespace back? Also, I'm calling the CFC like this http://localhost/cfc/xmlconduit.cfc?method=getcontactsbyorganization¶m=5 Thanks, Pete ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:207545 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54