House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

Returning XML via webservice, cont

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Dear List,
Chris Dempsey
06/02/04 10:26 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
Tom,
Christopher Dempsey
06/02/04 04:50 P
Tom,
Chris Dempsey
06/03/04 11:29 P
Tom,
Chris Dempsey
06/03/04 11:43 P
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Chris Dempsey
06/02/2004 10:26 AM

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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Tom Kitta
06/02/2004 10:33 AM

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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Christopher Dempsey
06/02/2004 11:05 AM

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 -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Tom Kitta
06/02/2004 12:29 PM

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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Christopher Dempsey
06/02/2004 01:35 PM

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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Tom Kitta
06/02/2004 02:06 PM

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

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Christopher Dempsey
06/02/2004 04:50 PM

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 -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Tom Kitta
06/03/2004 09:40 AM

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   >   >   >   >

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Chris Dempsey
06/03/2004 11:29 PM

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 -----

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Chris Dempsey
06/03/2004 11:43 PM

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


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

September 09, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30