This is the code which generates the XML from the Query. I converted it from
a function I found on cflib.org.
***********
<cffunction name="queryToXML"
access="remote"
returntype="string">
<cfargument displayname="Query to Transform" required="true"
name="q">
<cfset root = "query">
<cfset row = "row">
<cfset cols = #ListToArray(q.columnlist)#>
<cfset recCount = #q.RecordCount#>
<cfset nodeMode = "values">
<cfset ii = 1>
<cfset rr = 1>
<cfset thisColumn = "">
<cfset thisValue = "">
<cfset xml = XMLNew()>
<!--- create the root node --->
<cfset xml.xmlRoot = #XMLElemNew(xml, root)#>
<cfset xml[root].XMLAttributes["columns"] =
#ArrayLen(cols)#>
<cfset xml[root].XMLAttributes["rows"] = #recCount#>
<!--- loop through the records and add a row for each one
--->
<cfloop index="rowVal" from="#rr#" to="#recCount#" step="1">
<cfset tmp =
#ArrayAppend(xml[root].XMLChildren,XMLElemNew(xml, row))#>
<!--- loop over the columns and populate the values
for the row --->
<cfloop index="colVal" from="#ii#"
to="#ArrayLen(cols)#" step="1">
<cfset thisColumn = LCase(cols[colVal])>
<cfset thisValue =
#q[cols[colVal]][rowVal]#>
<cfset tXML =
#ArrayAppend(xml[root][row][rowVal].XMLChildren, XMLElemNew(xml,
thisColumn))#>
<cfset
#xml[root][row][rowVal][thisColumn].XMLText# = #thisValue#>
</cfloop>
</cfloop>
<cfreturn #xml#>
</cffunction>
**************
-----Original Message-----
From: James Johnson [mailto:[EMAIL PROTECTED]
Sent: Friday, May 14, 2004 2:53 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Problems returning XML via WebService
Hi Sean,
I am doing a <cfdump> and what is output is
"[EMAIL PROTECTED]" (the chars after the @ change)
<cfoutput>#IsXMLDoc(getDocsRet)#</cfoutput> returns "NO"
But if I call it as a component, dumping the variable shows a nice XML tree
and IsXMLDoc() returns "Yes"
James
-----Original Message-----
From: Sean A Corfield [mailto:[EMAIL PROTECTED]
Sent: Friday, May 14, 2004 2:08 PM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] Problems returning XML via WebService
On May 14, 2004, at 12:02 PM, James Johnson wrote:
> If I use the component as a component, it returns the XML document. If
> I use it as a webservice all I get is
> [EMAIL PROTECTED]
Many web services end up returning an encapsulated object. You can <cfdump>
it and you'll see all the methods defined on it - you'll have to call some
of those methods to get at the data.
Regards,
Sean
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool,
Corporation (www.mindtool.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool,
Corporation (www.mindtool.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]