|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Returning XML via webservice, cont
Dear List,Chris Dempsey 06/02/04 10:26 A Why is your function return type "void" it should be "string" if you want toTom Kitta 06/02/04 10:33 A Oops, wrong version of the function. Here is the right code:Christopher Dempsey 06/02/04 11:05 A I have tryed your function, with code:Tom Kitta 06/02/04 12:29 P Tom,Christopher Dempsey 06/02/04 01:35 P I tryed the links you supplied and I got what I expected. Can you send meTom Kitta 06/02/04 02:06 P Tom,Christopher Dempsey 06/02/04 04:50 P Yes, I see the same thing when I view the source, it is a WDDX pocket. It isTom Kitta 06/03/04 09:40 A Tom,Chris Dempsey 06/03/04 11:29 P Tom,Chris Dempsey 06/03/04 11:43 P Dear List, I saw this thread a few days ago, about returning an XML document as a string from a CFC. I tried using returntype="any" and the toString() function - neither worked. What ends up happening is that the XML document gets returned as a WDDX packet. Is it possible to just return it as a string, with no further changes? Here is the XML doc: http://www.graddiv.ucsb.edu/ssoNavigation.xml Here is the simplified CFC code: <cfcomponent extends="base"> <cffunction name="getNavigation" access="remote" returntype="void" output="false"> <cffile action="read" file="#path#ssoNavigation.xml" variable="myString" /> <cfreturn toString(myString) /> </cffunction> </cfcomponent> The cfc is located here: http://www.graddiv.ucsb.edu/sso.cfc Thanks! Chris -- *********************** Chris Dempsey Director, Information Services UCSB Graduate Division Quis custodiet ipsos custodies Why is your function return type "void" it should be "string" if you want to return a string[Tom Kitta] . Change it to string and give it a go. TK Dear List, I saw this thread a few days ago, about returning an XML document as a string from a CFC. I tried using returntype="any" and the toString() function - neither worked. What ends up happening is that the XML document gets returned as a WDDX packet. Is it possible to just return it as a string, with no further changes? Here is the XML doc: http://www.graddiv.ucsb.edu/ssoNavigation.xml Here is the simplified CFC code: <cfcomponent extends="base"> <cffunction name="getNavigation" access="remote" returntype="void" output="false"> <cffile action="read" file="#path#ssoNavigation.xml" variable="myString" /> <cfreturn toString(myString) /> </cffunction> </cfcomponent> The cfc is located here: http://www.graddiv.ucsb.edu/sso.cfc Thanks! Chris -- *********************** Chris Dempsey Director, Information Services UCSB Graduate Division Quis custodiet ipsos custodies Oops, wrong version of the function. Here is the right code: <cffunction name="getNavigation2" access="remote" returntype="any" output="false"> <cffile action="read" file="D:\inetpub\wwwroot\ssoNavigation.xml" variable="myString" /> <cfreturn toString(myString) /> </cffuncti ----- Excess quoted text cut - see Original Post for more ----- I have tryed your function, with code: <cffunction name="getNavigation" access="remote" returntype="any" output="false"> <cffile action="read" file="c:\inetpub\wwwroot\tk\gb\data\data1.xml" variable="myString"> <cfreturn xmlFormat(toString(myString))> </cffunction> Works fine. Try to copy above exactly, maybe it is your /> at the tag ends. Check the actual XML file, what is in it. Etc. Function works fine on CF6.1 TK http://www.tomkitta.com Oops, wrong version of the function. Here is the right code: <cffunction name="getNavigation2" access="remote" returntype="any" output="false"> <cffile action="read" file="D:\inetpub\wwwroot\ssoNavigation.xml" variable="myString" /> <cfreturn toString(myString) /> </cffuncti > Why is your function return type "void" it should be "string" if you want to > return a string[Tom Kitta] . Change it to string and give it a go. > > TK > Dear List, > > I saw this thread a few days ago, about returning an XML document as a > string from a CFC. I tried using returntype="any" and the toString() > function - neither worked. What ends up happening is that the XML > document gets returned as a WDDX packet. Is it possible to just return > it as a string, with no further changes? > > Here is the XML doc: http://www.graddiv.ucsb.edu/ssoNavigation.xml > > Here is the simplified CFC code: > > <cfcomponent extends="base"> > <cffunction name="getNavigation" access="remote" > returntype="void" output="false"> > <cffile action="read" file="#path#ssoNavigation.xml" > variable="myString" /> > > <cfreturn toString(myString) /> > </cffunction> > </cfcomponent> > > The cfc is located here: http://www.graddiv.ucsb.edu/sso.cfc > > Thanks! > > Chris Tom, I tried what you recommended, I have tried your method below, and it didn't work quite right. It still returns a WDDX packet, but now all of the XML is escaped. The XML file is at http://www.graddiv.ucsb.edu/ssoNavigation.xml and I am calling the below code with http://www.graddiv.ucsb.edu/sso.cfc?method=getNavigation Here is the code now. I tried it without using the closing /> and it had no effect. <cffunction name="getNavigation" access="remote" returntype="any" displayname="Get SSO navigation XML document" hint="This method retrieves an XML document used for SSO navigation bar." output="false"> <cffile action="read" file="D:\inetpub\wwwroot\ssoNavigation.xml" variable="myString" /> <cfreturn toString(myString) /> </cffunction> Totally bizarre. Also tried restarting the CF service and clearing the browser cache, no effect. Thanks, Chris ----- Excess quoted text cut - see Original Post for more ----- -- *********************** Chris Dempsey Director, Information Services UCSB Graduate Division Quis custodiet ipsos custodies I tryed the links you supplied and I got what I expected. Can you send me what you get as your browser response? Maybe you need to clear browser cache or something. I looked at the XML raw and one returned by your CFC call and they are the same minus the formatting of the actual XML (mine doesn't have the line feeds). Check it out and tell me whatever it works now, if it works for me it should for you, right? TK Tom, I tried what you recommended, I have tried your method below, and it didn't work quite right. It still returns a WDDX packet, but now all of the XML is escaped. The XML file is at http://www.graddiv.ucsb.edu/ssoNavigation.xml and I am calling the below code with http://www.graddiv.ucsb.edu/sso.cfc?method=getNavigation Here is the code now. I tried it without using the closing /> and it had no effect. <cffunction name="getNavigation" access="remote" returntype="any" displayname="Get SSO navigation XML document" hint="This method retrieves an XML document used for SSO navigation bar." output="false"> <cffile action="read" file="D:\inetpub\wwwroot\ssoNavigation.xml" variable="myString" /> <cfreturn toString(myString) /> </cffunction> Totally bizarre. Also tried restarting the CF service and clearing the browser cache, no effect. Thanks, Chri Tom, The displayed output is correct, but when I view the source, I see the <wddx> tags. Is that the same with you? Chris ----- Excess quoted text cut - see Original Post for more ----- Yes, I see the same thing when I view the source, it is a WDDX pocket. It is the way CF is sending the XML to the browser as XML encapsulated in WDDX. You can always write the XML to a file and then you get straight XML. Why this would be problem for your application? TK Tom, The displayed output is correct, but when I view the source, I see the <wddx> tags. Is that the same with you? Chris > I tryed the links you supplied and I got what I expected. Can you send me > what you get as your browser response? Maybe you need to clear browser cache > or something. I looked at the XML raw and one returned by your CFC call and > they are the same minus the formatting of the actual XML (mine doesn't have > the line feeds). Check it out and tell me whatever it works now, if it works > for me it should for you, right? > > TK > Tom, > > I tried what you recommended, > > I have tried your method below, and it didn't work quite right. It still > returns a WDDX packet, but now all of the XML is escaped. The XML file is > at http://www.graddiv.ucsb.edu/ssoNavigation.xml and I am calling the > below code with http://www.graddiv.ucsb.edu/sso.cfc?method=getNavigation > > Here is the code now. I tried it without using the closing /> and it had > no effect. > > <cffunction name="getNavigation" access="remote" > returntype="any" displayname="Get SSO navigation XML document" > hint="This method retrieves an XML document used for SSO navigation > bar." > output="false"> > <cffile action="read" file="D:\inetpub\wwwroot\ssoNavigation.xml" > variable="myString" /> > <cfreturn toString(myString) /> > </cffunction> > > Totally bizarre. Also tried restarting the CF service and clearing the > browser cache, no effect. > > Thanks, > > Chri > > > > Tom, I think you mean why do I not call the XML directly? Ie., have the user hit http://www.graddiv.ucsb.edu/ssoNavigation.xml instead of /sso.cfc?method=getNavigation The reason why I'd like to work out going through the CFC is that a future version will return a customized XML based on some input parameters, such as userID. Thanks, Chris On Jun 3, 2004, at 6:37 AM, Tom Kitta wrote: ----- Excess quoted text cut - see Original Post for more ----- Tom, I think you mean why do I not call the XML directly? Ie., have the user hit http://www.graddiv.ucsb.edu/ssoNavigation.xml instead of /sso.cfc?method=getNavigation The reason why I'd like to work out going through the CFC is that a future version will return a customized XML based on some input parameters, such as userID. Thanks, Chris On Jun 3, 2004, at 6:37 AM, Tom Kitta wrote: ----- Excess quoted text cut - see Original Post for more ----- -- *********************** Chris Dempsey Director, Information Services UCSB Graduate Division Quis custodiet ipsos custodies
|
September 09, 2010
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||