Hmmmm... Changing the sample code below to have a return type of "xml" and leaving all 
else the same yields an exception, seen in the Axis fault code as "Could not resolve 
CFC datatype: xml", just as Tony copied in below.





-----Original Message-----
From: Matt Liotta [mailto:mliotta@;r337.com]
Sent: Wednesday, October 30, 2002 11:55 PM
To: CF-Talk
Subject: RE: another error...cfc...datatype...xml


I have found that setting the return type to XML works just fine as long
as the data is returned as a string. It will not work if you try and
return an XML object.

<cfreturn xmlObj> fails!
<cfreturn ToString(xmlObj)> works!

Matt Liotta
President & CEO
Montara Software, Inc.
http://www.montarasoftware.com/
888-408-0900 x901

> -----Original Message-----
> From: Steven Erat [mailto:serat@;macromedia.com]
> Sent: Wednesday, October 30, 2002 11:53 PM
> To: CF-Talk
> Subject: RE: another error...cfc...datatype...xml
> 
> I have to agree with Matt regarding the application design goals and
that
> the best means for that particular solution might be to provide raw
XML as
> a HTTP response.
> 
> However, to attack the problem of returning XML from a CFMX Web
Service, I
> found that I was not able to return an XML object unless I converted
it to
> a string first.  And as Tony pointed out, setting the return type of
> CFFUNCTION to "xml" is not legal, ... yet.
> 
> This small example did work, in the end, to display the XML result.
> 
> C:\Inetpub\wwwroot\xml_test.cfc
> ================================
> <CFCOMPONENT displayname="Return Simple XML">
>       <CFFUNCTION name="getXML" access="remote" returntype="any"
> output="No">
>                       <CFSCRIPT>
>                               xmlDoc =  XMLNew();
>                               xmlDoc.theRoot =
XmlElemNew(xmlDoc,"theRoot");
>                               xmlDoc.theRoot.XmlChildren[1] =
> XmlElemNew(xmlDoc,"aChildNode");
>                               xmlDoc.theRoot.XmlChildren[1].XmlText =
"foo";
> 
>       xmlDoc.theRoot.XmlChildren[1].XmlAttributes["type"] = "1";
>                               xmlDoc.theRoot.XmlChildren[2] =
> XmlElemNew(xmlDoc,"aChildNode");
>                               xmlDoc.theRoot.XmlChildren[2].XmlText =
"bar";
> 
>       xmlDoc.theRoot.XmlChildren[2].XmlAttributes["type"] = "2";
>                       </CFSCRIPT>
>                       <CFSET tmpXml = toString(xmlDoc)>
> 
>               <CFRETURN tmpXml>
> 
>               <!---
>               <CFRETURN xmlDoc>
>               --->
> 
>       </CFFUNCTION>
> </CFCOMPONENT>
> 
> 
> C:\Inetpub\wwwroot\xml_test.cfm
> ================================
> <CFSETTING showdebugoutput="No">
> <CFSCRIPT>
>       objXML =
> createObject("webservice","http://localhost/xml_test.cfc?wsdl";);
>       xmlDoc = objXML.getXML();
> </CFSCRIPT>
> <CFCONTENT type="text/xml">
> <CFOUTPUT>#xmlDoc#</CFOUTPUT>
> 
> 
> 
> -----Original Message-----
> From: Matt Liotta [mailto:mliotta@;r337.com]
> Sent: Wednesday, October 30, 2002 11:07 PM
> To: CF-Talk
> Subject: RE: another error...cfc...datatype...xml
> 
> 
> I'm not sure why you want to return an XML document to a consumer of
> your web service. That would essentially mean your web service would
be
> encapsulating an XML document inside of an XML document (SOAP). If you
> just want a client to receive an XML document, skip web services and
> just provide the XML document as the HTTP response.
> 
> If you could share what you are really trying to do we could probably
> help better with that. However, if you really need to send an XML
> document via a web service then you should return it as an encoded
> string.
> 
> Matt Liotta
> President & CEO
> Montara Software, Inc.
> http://www.montarasoftware.com/
> 888-408-0900 x901
> 
> > -----Original Message-----
> > From: Tony Weeg [mailto:tony@;navtrak.net]
> > Sent: Wednesday, October 30, 2002 11:00 PM
> > To: CF-Talk
> > Subject: RE: another error...cfc...datatype...xml
> >
> > i could share it, but i got it....it was the problem that
> > i had an application.cfm file, and when invoking the webservice, it
> > didnt
> > pull some vars that i had set in there, i hard coded them
> > and i got it!
> >
> > now, the problem is i just want to return an xml feed back to the
> > consumer
> > and using xml as a datatype doesnt jive?
> >
> > any ideas?
> >
> > thanks.
> > tony.
> >
> >
> >
> > -----Original Message-----
> > From: Matt Liotta [mailto:mliotta@;r337.com]
> > Sent: Wednesday, October 30, 2002 10:50 PM
> > To: CF-Talk
> > Subject: RE: another error...cfc...datatype...xml
> >
> >
> > Can you share some code, so we can see what is going on?
> >
> > Matt Liotta
> > President & CEO
> > Montara Software, Inc.
> > http://www.montarasoftware.com/
> > 888-408-0900 x901
> >
> > > -----Original Message-----
> > > From: Tony Weeg [mailto:tony@;navtrak.net]
> > > Sent: Wednesday, October 30, 2002 10:47 PM
> > > To: CF-Talk
> > > Subject: another error...cfc...datatype...xml
> > >
> > > matt
> > >
> > > you had mention the use of the return datatype being
> > > xml as an ok one to use....error...
> > >
> > > AXIS error
> > > Sorry, something seems to have gone wrong... here are the details:
> > >
> > >
> [coldfusion.xml.rpc.SkeletonClassLoader$UnresolvedCFCDataTypeException
> > :
> > > Could not resolve CFC datatype: xml]
> > >
> > > and even this one...
> > >
> > > AXIS error
> > > Sorry, something seems to have gone wrong... here are the details:
> > >
> > >
> [coldfusion.xml.rpc.SkeletonClassLoader$UnresolvedCFCDataTypeException
> > :
> > > Could not resolve CFC datatype: structure]
> > >
> > > wtf!!!!
> > >
> > > ...tony
> > >
> > > tony weeg
> > > [EMAIL PROTECTED]
> > > www.revolutionwebdesign.com
> > > rEvOlUtIoN wEb DeSiGn
> > > 410.334.6331
> > >
> > >
> >
> >
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to