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

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

Using type to return objects to Flex

  << Previous Post |  RSS |  Tree View |  Sort Oldest First |  Subscribe to this Group Next >> 

Using __type__ to return objects to Flex

Yeah, I finally finding that out (after many trials), I was wondering if BlazeDS Gareth Arch 02/21/2008 09:39 PM
I don't think it will be possible in cfmx7 (I might be wrong) but I João_Fernandes 02/21/2008 07:23 PM
Just figured I would post a follow up here for anyone who is following along (or Gareth Arch 02/21/2008 06:06 PM
I think there must be a setting that I'm missing.  I copied the code Gareth Arch 02/21/2008 09:11 AM
> Thanks for trying.  I'll keep plugging away.  If I find Tom Chiverton 02/21/2008 05:14 AM
And one other thing to mention (that hopefully wouldn't have made a big Gareth Arch 02/20/2008 03:58 PM
OK, one last try.  Here's my services-config.xml file.  Gareth Arch 02/20/2008 03:02 PM
Thanks for trying.  I'll keep plugging away.  If I find Gareth Arch 02/20/2008 01:35 PM
I don't know what to say. Jon Messer 02/20/2008 12:43 PM
I swear, I'm not starting to believe it myself :) Gareth Arch 02/20/2008 12:17 PM
> As soon as you compile TestClass into the app it works for Tom Chiverton 02/20/2008 11:53 AM
Here is the code I used, that you provided it worked for me in both CF7 and Jon Messer 02/20/2008 11:47 AM
So you're saying that the EXACT same flex code and the EXACT same cf code Jon Messer 02/20/2008 11:43 AM
I hadn't, but I shall now.  If I find anything out, I'll post back Gareth Arch 02/20/2008 10:28 AM
>  body = (Array #2) Tom Chiverton 02/20/2008 10:14 AM
Wow, I had no idea about the "Debug" mode.  It's nice to see what CF Gareth Arch 02/20/2008 10:07 AM
>         <target class="flex.messaging.log.ConsoleTarget" Tom Chiverton 02/20/2008 09:50 AM
Here's the remote object info: Gareth Arch 02/20/2008 09:42 AM
> When the data is returned back to AS from CF, it is still just an array of Tom Chiverton 02/20/2008 09:25 AM
Thanks for taking the time to answer all of my questions... Gareth Arch 02/20/2008 09:11 AM
> How are you calling it from Flex?  __type__ only works with FDS, Tom Chiverton 02/20/2008 04:53 AM
Sorry I guess I wasn't clear, you absolutely can return arrays of typed Jon Messer 02/19/2008 11:49 PM
Hmmm...not too sure what you mean by this. Gareth Arch 02/19/2008 08:50 PM
This actually works fine without LCDS or FDS. It requires that you put the Jon Messer 02/19/2008 04:44 PM
sorry pressed send too soon. To finish that sentence : Jon Messer 02/19/2008 04:39 PM
No, not that I've found.  But it's simple to inflate the generic Barney Boisvert 02/19/2008 04:29 PM
Argh!  For some reason I skipped completely over that part.  Gareth Arch 02/19/2008 03:40 PM
How are you calling it from Flex?  __type__ only works with FDS, I Barney Boisvert 02/19/2008 03:26 PM
I am giving this a try on my current app.  However, when the data is Gareth Arch 02/19/2008 02:29 PM

02/21/2008 09:39 PM
Author: Gareth Arch Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299652 Yeah, I finally finding that out (after many trials), I was wondering if BlazeDS + CFMX7 would work using the __type__ method?  I didn't know if that would translate the structs to objects before passing it off to ActionScript. ----- Excess quoted text cut - see Original Post for more -----
02/21/2008 07:23 PM
Author: João_Fernandes Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299637 I don't think it will be possible in cfmx7 (I might be wrong) but I think that __type__ solution was introduced with CF8 for supporting faster object creation for LCDS 2.5.1 data management destinations. -- João Fernandes http://www.onflexwithcf.org http://www.riapt.org
02/21/2008 06:06 PM
Author: Gareth Arch Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299631 Just figured I would post a follow up here for anyone who is following along (or may be in the future).  I've tried way too many different things with settings files and could not get it working.  Jon Messer retried and found that it was using a CF8 instance from his CFMX7 install, so was not actually using CFMX7 to return the values, so thus far returning objects by just using remote object on CFMX7 does not appear to work unless using LiveCycle or some other dataservices intermediary.  If anyone does get it working (or knows some alterations on CFMX7 to get it working), please post.  Thanks. ----- Excess quoted text cut - see Original Post for more -----
02/21/2008 09:11 AM
Author: Gareth Arch Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299577 I think there must be a setting that I'm missing.  I copied the code over to new install of Eclipse 3 and CF8 (on a clean PC) and ran the code and it returned the correctly Typed Objects (instead of the generic objects I was seeing).  I'll probably go through some of the files and see if there's something that's installed on the new copy vs. my local copy.  There are quite a few xml files in my jrun folder that may be affecting things.  I'll have to check it out and see.   What's really frustrating is that if I knew it *didn't* work in CF7, then I would just stop, but as I know it *does* work and is insanely faster than instantiating objects in CF (and transferring them back to AS), that I really want to get it working. Do you guys think that it is one of the XML files that is causing the weirdness or another setting?  I just want to make sure I'm focusing my efforts in the correct area. Thanks. ----- Excess quoted text cut - see Original Post for more -----
02/21/2008 05:14 AM
Author: Tom Chiverton Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299565 > Thanks for trying.  I'll keep plugging away.  If I find anything, I'll be > sure to post back (perhaps it will help someone else) Did you reboot and clean re-compile both ends ? -- Tom Chiverton Helping to biannually build fine-grained design-patterns on: http://thefalken.livejournal.com **************************************************** This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP.  Regulated by The Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged.  If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents.   If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500. For more information about Halliwells LLP visit www.halliwells.com.
02/20/2008 03:58 PM
Author: Gareth Arch Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299509 And one other thing to mention (that hopefully wouldn't have made a big difference).  Our environment is running through JRun server.  I don't think that would make any difference, but it's something else to note. ----- Excess quoted text cut - see Original Post for more -----      > <services>          > <service id="coldfusion-flashremoting-service"                  > class="flex.messaging.services.RemotingService"                  > messageTypes="flex.messaging.messages.RemotingMessage"> >              > <adapters>                  > <adapter-definition id="cf-object" class="coldfusion.flash.messaging. > ColdFusionAdapter" default="true"/>              > </adapters> > >     <destination id="ColdFusion">                  > <channels>                      > <channel ref="my-securecfamf"/>                  > </channels>                  > <properties>                      > <source>*</source>                      > <!-- define the resolution rules and access level of the cfc being > invoked -->                      > <access>                          > <!-- Use the ColdFusion mappings to find CFCs, by default only CFC > files under your webroot can be found. -->                          > <use-mappings>true</use-mappings>                          > <!-- allow "public and remote" or just "remote" methods to be invoked > -->                          > <method-access-level>remote</method-access-level>                      > </access> >                      > <property-case>                          > <!-- cfc property names -->                          > <force-cfc-lowercase>false</force-cfc-lowercase>                          > <!-- Query column names -->                          > <force-query-lowercase>false</force-query-lowercase>                          > <!-- struct keys -->                          > <force-struct-lowercase>false</force-struct-lowercase>                      > </property-case> >                           > </properties>              > </destination> >          > </service>      > </services> >      > <channels>          > <channel-definition id="my-cfamf" class="mx.messaging.channels. > AMFChannel">              > <endpoint uri="http://{server.name}:{server.port}{context. > root}/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>              > <properties>                  > <polling-enabled>false</polling-enabled>                  > <serialization>                      > <instantiate-types>false</instantiate-types>                  > </serialization> >                   > </properties>          > </channel-definition>          > <channel-definition id="my-securecfamf" class="mx.messaging.channels. > SecureAMFChannel">              > <endpoint uri="https://{server.name}:{server.port}{context. > root}/flex2gateway/" > > class="flex.messaging.endpoints.SecureAMFEndpoint"/>              > <properties>                  > <polling-enabled>false</polling-enabled>                  > <serialization>                      > <instantiate-types>false</instantiate-types>                  > </serialization> >     <add-no-cache-headers>false</add-no-cache-headers>              > </properties>          > </channel-definition> >      > </channels> >      > <logging>          > <target class="flex.messaging.log.ConsoleTarget" level="Debug">              > <properties>                  > <prefix>[Flex] </prefix>                  > <includeDate>false</includeDate>                  > <includeTime>false</includeTime>                  > <includeLevel>false</includeLevel>                  > <includeCategory>false</includeCategory>              > </properties>              > <filters>                  > <pattern>Endpoint.*</pattern>                  > <pattern>Service.*</pattern>                  > <pattern>Configuration</pattern>                  > <pattern>Message.*</pattern>              > </filters>          > </target>      > </logging> >      > <system>      ----- Excess quoted text cut - see Original Post for more -----
02/20/2008 03:02 PM
Author: Gareth Arch Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299489 OK, one last try.  Here's my services-config.xml file.  Could you compare it to yours and see if there's anything that doesn't add up. <?xml version="1.0" encoding="UTF-8"?> <services-config>     <services>         <service id="coldfusion-flashremoting-service"                  class="flex.messaging.services.RemotingService"                  messageTypes="flex.messaging.messages.RemotingMessage">             <adapters>                 <adapter-definition id="cf-object" class="coldfusion.flash.messaging.ColdFusionAdapter" default="true"/>             </adapters>     <destination id="ColdFusion">                 <channels>                     <channel ref="my-securecfamf"/>                 </channels>                 <properties>                     <source>*</source>                     <!-- define the resolution rules and access level of the cfc being invoked -->                     <access>                         <!-- Use the ColdFusion mappings to find CFCs, by default only CFC files under your webroot can be found. -->                         <use-mappings>true</use-mappings>                         <!-- allow "public and remote" or just "remote" methods to be invoked -->                          <method-access-level>remote</method-access-level>                     </access>                     <property-case>                         <!-- cfc property names -->                          <force-cfc-lowercase>false</force-cfc-lowercase>                         <!-- Query column names -->                          <force-query-lowercase>false</force-query-lowercase>                         <!-- struct keys -->                          <force-struct-lowercase>false</force-struct-lowercase>                     </property-case>                          </properties>             </destination>         </service>     </services>     <channels>         <channel-definition id="my-cfamf" class="mx.messaging.channels.AMFChannel">             <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>             <properties>                 <polling-enabled>false</polling-enabled>                 <serialization>                     <instantiate-types>false</instantiate-types>                 </serialization>                  </properties>         </channel-definition>         <channel-definition id="my-securecfamf" class="mx.messaging.channels.SecureAMFChannel">             <endpoint uri="https://{server.name}:{server.port}{context.root}/flex2gateway/" class="flex.messaging.endpoints.SecureAMFEndpoint"/>             <properties>                 <polling-enabled>false</polling-enabled>                 <serialization>                     <instantiate-types>false</instantiate-types>                 </serialization>     <add-no-cache-headers>false</add-no-cache-headers>             </properties>         </channel-definition>     </channels>     <logging>         <target class="flex.messaging.log.ConsoleTarget" level="Debug">             <properties>                 <prefix>[Flex] </prefix>                 <includeDate>false</includeDate>                 <includeTime>false</includeTime>                 <includeLevel>false</includeLevel>                 <includeCategory>false</includeCategory>             </properties>             <filters>                 <pattern>Endpoint.*</pattern>                 <pattern>Service.*</pattern>                 <pattern>Configuration</pattern>                 <pattern>Message.*</pattern>             </filters>         </target>     </logging>     <system>     </system> </services-config> ----- Excess quoted text cut - see Original Post for more -----
02/20/2008 01:35 PM
Author: Gareth Arch Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299456 Thanks for trying.  I'll keep plugging away.  If I find anything, I'll be sure to post back (perhaps it will help someone else) ----- Excess quoted text cut - see Original Post for more -----
02/20/2008 12:43 PM
Author: Jon Messer Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299437 I don't know what to say. That exact code (and only that code) works for me on a Mac CF8, on Linux CF8 and Windows CF7. The only difference I see is that I didn't run it over SSL and it looks like you are, but I use this method in production with SSL. I'm at a total loss...  :-( On Feb 20, 2008 8:43 AM, Gareth Arch <Lampei@yahoo.com> wrote: ----- Excess quoted text cut - see Original Post for more -----
02/20/2008 12:17 PM
Author: Gareth Arch Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299428 I swear, I'm not starting to believe it myself :) I actually did have a Test.mxml page that was instantiating the TestClass, but I didn't add that bit.  Sorry about that. OK. I pasted the code you sent (exactly as sent into separate files) and I still get the generic objects returned.  My code is outputting to C:\Inetpub\wwwroot\OptimizationDemo Do I need to do something else to aliases if I it is setup like this?  I have my https://localhost pointing to C:\Inetpub\wwwroot\OptimizationDemo though, so my test page would be https://localhost/Test.html  My CFCs are also right in this folder. As long as you keep giving me hope that this really does work, I'll keep making changes to try to get this working :) ----- Excess quoted text cut - see Original Post for more -----
02/20/2008 11:53 AM
Author: Tom Chiverton Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299423 > As soon as you compile TestClass into the app it works for > both cases with the code you posted... *Ahh*, I bet that's it. We'd normally have some component somewhere with a variable of the RemoteClass type, so this doesn't occur - it's basically because the demo code is *too* simple :-) All Gareth needs to do is add   import TestClass;   private var dummy:TestClass=new TestClass(); to his SWF app. somewhere. Anywhere :-) -- Tom Chiverton Helping to heterogeneously morph edge-of-your-seat convergence on: http://thefalken.livejournal.com **************************************************** This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP.  Regulated by The Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged.  If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents.   If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500. For more information about Halliwells LLP visit www.halliwells.com.
02/20/2008 11:47 AM
Author: Jon Messer Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299420 Here is the code I used, that you provided it worked for me in both CF7 and CF8 : http://www.nomorepasting.com/getpaste.php?pasteid=11881 Hope that helps you figure out what you are doing differently... On Feb 20, 2008 8:18 AM, J ----- Excess quoted text cut - see Original Post for more -----
02/20/2008 11:43 AM
Author: Jon Messer Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299418 So you're saying that the EXACT same flex code and the EXACT same cf code with this one change in buildStruct everything works? //arrayAppend( ret, duplicate( obj ) ); arrayAppend( ret, CreateObject("component","TestClass") ); You shouldn't even recompile the flex app, just change that one line in your TestGateway and then everything works? I don't mean sound rude or to sound like I don't believe you but I find that pretty hard to believe. I ran the code you posted and as I would expect it is receiving a generic object in both cases, because there is no instance of TestClass compiled into Test.mxml. As soon as you compile TestClass into the app it works for both cases with the code you posted... On Feb 20, 2008 6:54 AM, Gareth Arch <Lampei@yahoo.com> wrote: ----- Excess quoted text cut - see Original Post for more -----
02/20/2008 10:28 AM
Author: Gareth Arch Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299409 I hadn't, but I shall now.  If I find anything out, I'll post back here.  Thanks for all the help. ----- Excess quoted text cut - see Original Post for more -----
02/20/2008 10:14 AM
Author: Tom Chiverton Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299407 >  body = (Array #2) >         [0] = (Object #3) I would have expected 'typed object' here, if it were working... have you tried dropping Sean/the Transfer list an email ? -- Tom Chiverton Helping to administratively reinvent industry-wide models on: http://thefalken.livejournal.com **************************************************** This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP.  Regulated by The Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged.  If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents.   If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500. For more information about Halliwells LLP visit www.halliwells.com.
02/20/2008 10:07 AM
Author: Gareth Arch Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299406 Wow, I had no idea about the "Debug" mode.  It's nice to see what CF "sees" :) Here's what was output (I wasn't sure *exactly* what was needed, so I copied as much as seemed pertinent...I trimmed anything that was repeating too much)  Let me know if there's something else that I need to change or more info that you need. [Flex] HttpFlexSession has not been registered as a listener in web.xml for this application so no events will be dispatched to FlexSessionAttributeListeners or FlexSessionBindingListeners. To correct this, register flex.messaging.HttpFlexSession as a listener in web.xml. [Flex] Channel endpoint my-securecfamf received request. [Flex] Deserializing AMF/HTTP request Version: 3   (Message #0 targetURI=null, responseURI=/1)     (Array #0)       [0] = (Typed Object #0 'flex.messaging.messages.CommandMessage')         operation = 5         correlationId = ""         messageId = "001068F3-9EC6-DFDD-A4C5-37432AC68D25"         body = (Object #1)         clientId = null         timestamp = 0         headers = (Object #2)           DSMessagingVersion = 1           DSId = "nil"         timeToLive = 0         destination = "" [Flex] Executed command: (default service)   commandMessage: Flex Message (flex.messaging.messages.CommandMessage)     operation = cluster_request     messageRefType = null     clientId = 1EEAFD5F-720F-AAD1-4A98-D14C681F09FB     correlationId =     destination =     messageId = 001068F3-9EC6-DFDD-A4C5-37432AC68D25     timestamp = 1203517991826     timeToLive = 0     body = {}     hdr(DSId) = nil     hdr(DSMessagingVersion) = 1   replyMessage: Flex Message (flex.messaging.messages.AcknowledgeMessage)     clientId = 1EEAFD5F-720F-AAD1-4A98-D14C681F09FB     correlationId = 001068F3-9EC6-DFDD-A4C5-37432AC68D25     destination = null     messageId = 1EEAFD5F-7218-FBB1-C3D6-A984EF568F72     timestamp = 1203517991826     timeToLive = 0     body = null [Flex] Serializing AMF/HTTP response Version: 3   (Header #0 name=AppendToGatewayUrl, mustUnderstand=false)     ";jsessionid=483029c7e25675496141"   (Message #0 targetURI=/1/onResult, responseURI=)     (Typed Object #0 'flex.messaging.messages.AcknowledgeMessage')       destination = null       headers = (Object #1)       correlationId = "001068F3-9EC6-DFDD-A4C5-37432AC68D25"       messageId = "1EEAFD5F-7218-FBB1-C3D6-A984EF568F72"       timestamp = 1.203517991826E12       clientId = "1EEAFD5F-720F-AAD1-4A98-D14C681F09FB"       timeToLive = 0.0       body = null [Flex] Channel endpoint my-securecfamf received request. [Flex] Deserializing AMF/HTTP request Version: 3   (Message #0 targetURI=null, responseURI=/2)     (Array #0)       [0] = (Typed Object #0 'flex.messaging.messages.RemotingMessage')         source = "TestClassGateway"         operation = "getAll"         messageId = "BE545A8C-2563-069E-DCA8-37432AB6FBDE"         body = (Array #1)         clientId = null         timestamp = 0         headers = (Object #2)           DSEndpoint = "my-securecfamf"           DSId = "nil"         timeToLive = 0         destination = "ColdFusion" [Flex] Before invoke service: coldfusion-flashremoting-service   incomingMessage: Flex Message (flex.messaging.messages.RemotingMessage)     operation = getAll     clientId = 1EEAFE1D-E008-1D8C-1417-19C0822F5EF4     destination = ColdFusion     messageId = BE545A8C-2563-069E-DCA8-37432AB6FBDE     timestamp = 1203517991904     timeToLive = 1203517991904     body = null     hdr(DSEndpoint) = my-securecfamf     hdr(DSId) = nil [Flex] Adapter 'cf-object' called 'TestClassGateway.getAll(java.util.Arrays$ArrayList (Collection size:0) )' [Flex] Result: 'Flex Message (flex.messaging.messages.AcknowledgeMessage)     clientId = null     correlationId = null     destination = null     messageId = 1EEB00D0-CB0D-8B04-2C39-4837CFE66988     timestamp = 1203517992187     timeToLive = 0     body =     [       {phone=, address2=, country=, __type__=TestClass, state=, email=, address1=, zip=, fax=, firstName=, city=, lastName=},       {phone=, address2=, country=, __type__=TestClass, state=, email=, address1=, zip=, fax=, firstName=, city=, lastName=},       {phone=, address2=, country=, __type__=TestClass, state=, email=, address1=, zip=, fax=, firstName=, city=, lastName=},       {phone=, address2=, country=, __type__=TestClass, state=, email=, address1=, zip=, fax=, firstName=, city=, lastName=} ]' [Flex] After invoke service: coldfusion-flashremoting-service   reply: Flex Message (flex.messaging.messages.AcknowledgeMessage)     clientId = null     correlationId = null     destination = null     messageId = 1EEB00D0-CB0D-8B04-2C39-4837CFE66988     timestamp = 1203517992187     timeToLive = 0     body =     [       {phone=, address2=, country=, __type__=TestClass, state=, email=, address1=, zip=, fax=, firstName=, city=, lastName=},       {phone=, address2=, country=, __type__=TestClass, state=, email=, address1=, zip=, fax=, firstName=, city=, lastName=},       {phone=, address2=, country=, __type__=TestClass, state=, email=, address1=, zip=, fax=, firstName=, city=, lastName=},       {phone=, address2=, country=, __type__=TestClass, state=, email=, address1=, zip=, fax=, firstName=, city=, lastName=} ] [Flex] Serializing AMF/HTTP response Version: 3   (Message #0 targetURI=/2/onResult, responseURI=)     (Typed Object #0 'flex.messaging.messages.AcknowledgeMessage')       destination = null       headers = (Object #1)       correlationId = "BE545A8C-2563-069E-DCA8-37432AB6FBDE"       messageId = "1EEB00D0-CB0D-8B04-2C39-4837CFE66988"       timestamp = 1.203517992187E12       clientId = "1EEAFE1D-E008-1D8C-1417-19C0822F5EF4"       timeToLive = 0.0       body = (Array #2)         [0] = (Object #3)           phone = ""           address2 = ""           country = ""           __type__ = "TestClass"           state = ""           email = ""           address1 = ""           zip = ""           fax = ""           firstName = ""           city = ""           lastName = ""         [1] = (Object #4)           phone = ""           address2 = ""           country = ""           __type__ = "TestClass"           state = ""           email = ""           address1 = ""           zip = ""           fax = ""           firstName = ""           city = ""           lastName = ""         [2] = (Object #5)           phone = ""           address2 = ""           country = ""           __type__ = "TestClass"           state = ""           email = ""           address1 = ""           zip = ""           fax = ""           firstName = ""           city = ""           lastName = ""         [3] = (Object #6)           phone = ""           address2 = ""           country = ""           __type__ = "TestClass"           state = ""           email = ""           address1 = ""           zip = ""           fax = ""           firstName = ""           city = ""           lastName = ""         [4] = (Object #7)           phone = ""           address2 = ""           country = ""           __type__ = "TestClass"           state = ""           email = ""           address1 = ""           zip = ""           fax = ""           firstName = ""           city = ""           lastName = "" > > >         <target class="flex.messaging.log.ConsoleTarget" > level="Error"> >          ----- Excess quoted text cut - see Original Post for more -----
02/20/2008 09:50 AM
Author: Tom Chiverton Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299405 >         <target class="flex.messaging.log.ConsoleTarget" level="Error">         <target class="flex.messaging.log.ConsoleTarget" level="Debug"> I've not tried it on 7 myself, but if Sean says it works it probably does :-) -- Tom Chiverton Helping to globally customize vertical interfaces on: http://thefalken.livejournal.com **************************************************** This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP.  Regulated by The Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged.  If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents.   If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500. For more information about Halliwells LLP visit www.halliwells.com.
02/20/2008 09:42 AM
Author: Gareth Arch Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299404 Here's the remote object info: import mx.rpc.events.ResultEvent; import mx.rpc.remoting.mxml.Operation; import mx.rpc.remoting.mxml.RemoteObject; private var _ro:RemoteObject; private var _op:Operation; public function TestClass() {   _ro=new RemoteObject;   _ro.source="TestClassGateway";   _ro.destination="ColdFusion";   _ro.showBusyCursor=true;   _op=Operation(_ro.getOperation("getAll"));   _op.addEventListener(ResultEvent.RESULT, receiveAll); }      public function getAll():void {   _ro.getAll(); }      public function receiveAll( event:ResultEvent ):void {   this.dispatchEvent( new Event( TestClass.ALL_RECEIVED ) ); } I put a breakpoint at the dispatchEvent point so I could see what was contained in the resultEvent. Could you post what I'm supposed to change in my services-config.xml file to get that working?  This is what I have for <logging> in there currently <logging>         <target class="flex.messaging.log.ConsoleTarget" level="Error">             <properties>                 <prefix>[Flex] </prefix>                 <includeDate>false</includeDate>                 <includeTime>false</includeTime>                 <includeLevel>false</includeLevel>                 <includeCategory>false</includeCategory>             </properties>             <filters>                 <pattern>Endpoint.*</pattern>                 <pattern>Service.*</pattern>                 <pattern>Configuration</pattern>                 <pattern>Message.*</pattern>             </filters>         </target>     </logging> I also wanted to point out that I'm on CFMX7 (not 8).  In the mailing list I originally saw this on, Sean Corfield mentioned that this was available in MX7 so I've been trying to get it to work (I just wanted to put that out there in case that's what is messing things up). ----- Excess quoted text cut - see Original Post for more -----
02/20/2008 09:25 AM
Author: Tom Chiverton Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299403 > When the data is returned back to AS from CF, it is still just an array of > generic objects.  If I create CF objects and return them, they come back as Can you post your AS code (RemoteObject call and result handler) ? Also, set the log level to 'debug' at the bottom of services-config.xml, and let us know the output in the CF log file. -- Tom Chiverton Helping to evangelistically consolidate fine-grained experiences on: http://thefalken.livejournal.com **************************************************** This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP.  Regulated by The Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged.  If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents.   If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500. For more information about Halliwells LLP visit www.halliwells.com.
02/20/2008 09:11 AM
Author: Gareth Arch Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299402 Thanks for taking the time to answer all of my questions... OK, I had been originally trying to do this in my main application, but seeing as that wasn't working, I set up a test environment. I've created (all in my src folder of my Test Flex project) Test.mxml TestClass.as TestClass.cfc TestClassGateway.cfc In my gateway file I generate a struct VO.  The function I use is: <cffunction name="buildStruct" output="false" access="remote">   <cfset var i = 0>   <cfset var obj = structNew() />   <cfset var ret = arrayNew( 1 )>   <cfscript>     while (i lt 100) {       obj['__type__'] = 'TestClass';       obj['firstName'] = "";       obj['lastName'] = "";       obj['address1'] = "";       obj['address2'] = "";       obj['city'] = "";       obj['state'] = "";       obj['zip'] = "";       obj['country'] = "";       obj['email'] = "";       obj['phone'] = "";       obj['fax'] = "";       arrayAppend( ret, duplicate( obj ) );       i = i+1;     }   </cfscript>   <cfreturn ret /> </cffunction> I use a getAll function to return this newly created VO to my calling AS object <cffunction name="getAll" output="false" access="remote">   <cfreturn buildStruct() /> </cffunction> My TestClass.cfc has: <cfcomponent output="false" alias="TestClass">   <cfproperty name="firstName" type="string" default="" />   <cfproperty name="lastName" type="string" default="" />   <cfproperty name="address1" type="string" default="" />   <cfproperty name="address2" type="string" default="" />   <cfproperty name="city" type="string" default="" />   <cfproperty name="state" type="string" default="" />   <cfproperty name="zip" type="string" default="" />   <cfproperty name="country" type="string" default="" />   <cfproperty name="email" type="string" default="" />   <cfproperty name="phone" type="string" default="" />   <cfproperty name="fax" type="string" default="" />      <cfscript>     this.firstName = "";     this.lastName = "";     this.address1 = "";     this.address2 = "";     this.city = "";     this.state = "";     this.zip = "";     this.country = "";     this.email = "";     this.phone = "";     this.fax = "";   </cfscript> </cfcomponent> My TestClass.as has [RemoteClass(alias="TestClass")] public class TestClass extends EventDispatcher { (along with getters/setters and my constructor and function call to the TestClassGateway). When the data is returned back to AS from CF, it is still just an array of generic objects.  If I create CF objects and return them, they come back as an array of TestClass objects.  I also noticed that in the list of properties of the generic objects, __type__ is one of them.  If it's being converted, this shouldn't be there, should it? ----- Excess quoted text cut - see Original Post for more -----
02/20/2008 04:53 AM
Author: Tom Chiverton Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299396 > How are you calling it from Flex?  __type__ only works with FDS, I > believe, not with remote objects. Works with RemoteObject() here. -- Tom Chiverton Helping to revolutionarily streamline bleeding-edge meta-services on: http://thefalken.livejournal.com **************************************************** This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB.  A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP.  Regulated by The Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged.  If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents.   If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500. For more information about Halliwells LLP visit www.halliwells.com.
02/19/2008 11:49 PM
Author: Jon Messer Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299389 Sorry I guess I wasn't clear, you absolutely can return arrays of typed structs and have them converted for you. That's the main point of doing this. You can return thousands of objects in arrays, and it is ridiculously faster then creating cfcs, you do not need LCDS to do this. I mentioned the array because in Flex if you don't have an instance of the AddressBook object compiled into the app, it will come in as a generic object. But if it works when you return arrays of vos that were created with CreateObject, then that's not the problem. Is the AddressBook.cfc in your webroot or is it under some path? This : [RemoteClass(alias="AddressBook")] will only work (with this method) if AddressBook is in your webroot, if you use CreateObject it will work without the fully qualified path, but if you want to use this typed struct method you have to use the full path. So if your AddressBook is actually in com.vo.AddressBook then you have to use struct['__type__'] = 'com.vo.AddressBook' and [RemoteClass(alias="com.vo.AddressBook")] Sorry if I am making it sound more complicated then it is, but it basically boils down to making sure your __type__ is fully qualified and matches your alias. On Feb 19, 2008 5:15 PM, Gareth Arch <Lampei@yahoo.com> wrote: ----- Excess quoted text cut - see Original Post for more -----
02/19/2008 08:50 PM
Author: Gareth Arch Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299378 Hmmm...not too sure what you mean by this. I had the code setup in a DAO gateway, so the <cfcomponent alias="AddressBook"> was in an AddressBook.cfc (the code I posted was a cffunction in AddressBookGateway.cfc).  In my AS class, I have [RemoteClass(alias="AddressBook")] to handle the class that is returned from CF (and convert it to the correct AddressBook class).  In the code, I'm trying to return an array of AddressBook objects (thus the array that I'm returning).  If I do a createobject for CF AddressBook objects and put it in an array, it correctly returns an array of AddressBook objects back to AS; however, if I use the __type__ and a struct of the other variables (even with correct camelCasing), it returns an array of generic objects.  If I try a returntype of AddressBook[] from CF, it states that it is not a valid AddressBook (which makes sense as it hasn't been converted yet).  If I can only return one item back to AS from CF using this method, I'll probably just stick with the method I was using before (as creating one object vs. one struct isn't going to make a big difference), but if it can send multiple items back as VOs, then that's what I'm looking for.  There's something I'm missing between the gateway and the AS.  If, as Barney states, it is the LiveCycle intermediary, then I'm fresh out as my company won't pony up for that, but if there's something else that I'm missing that can do the conversion via AMF, then I'm all ears :) Thanks. Gareth ----- Excess quoted text cut - see Original Post for more -----
02/19/2008 04:44 PM
Author: Jon Messer Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299354 This actually works fine without LCDS or FDS. It requires that you put the appropriate fully qualified RemoteClass on your AS vlaue object, but if you do that you get automatic conversion from typed CF Struct to AS. The only thing I see that is odd about your posted code is that you are returning an array On Feb 19, 2008 1:04 PM, Barney Boisvert <bboisvert@gmail.com> wrote: ----- Excess quoted text cut - see Original Post for more -----
02/19/2008 04:39 PM
Author: Jon Messer Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299353 sorry pressed send too soon. To finish that sentence : The only thing I see that is odd about your posted code is that you are returning an array, so on the flex side you need to make sure that you are compiling an instance of your VO into the application or you will get a generic object... On Feb 19, 2008 1:13 PM, J ----- Excess quoted text cut - see Original Post for more -----
02/19/2008 04:29 PM
Author: Barney Boisvert Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299352 No, not that I've found.  But it's simple to inflate the generic objects into typed objects in AS.  Just add a static createFromProperties(o:Object):AddressBook method that will copy properties from the passed object into a new instance of the strongly typed object, and then when you get your ArrayCollection in Flex, loop over the elements and inflate each one. var ac:ArrayCollection = event.result; for (var i:int = 0; i < ac.length; i++) {   ac[i] = AddressBook.createFromProperties(ac[i]); } It's not really elegant, but it's simple, and mandatory with how slow CF is at creating CFC instances. cheers, barneyb On Feb 19, 2008 12:05 PM, Gareth Arch <Lampei@yahoo.com> wrote: ----- Excess quoted text cut - see Original Post for more -----
02/19/2008 03:40 PM
Author: Gareth Arch Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299349 Argh!  For some reason I skipped completely over that part.  Other than having to use createobject, do you know of anything that will just return the properties rather than the whole shebang (in CFMX7)?  I've returned the data as a query before, but that then requires manipulation on the ActionScript side of things, so if there was a way to tell it "this is an AddressBook" from CF, that would be extremely useful (without going through LiveCycle).  Thanks for the help. ----- Excess quoted text cut - see Original Post for more -----
02/19/2008 03:26 PM
Author: Barney Boisvert Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299348 How are you calling it from Flex?  __type__ only works with FDS, I believe, not with remote objects. cheers, barneyb On Feb 19, 2008 10:54 AM, Gareth Arch <Lampei@yahoo.com> wrote: ----- Excess quoted text cut - see Original Post for more -----
02/19/2008 02:29 PM
Author: Gareth Arch Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:55258#299343 I am giving this a try on my current app.  However, when the data is returned to Flex, it is not of the type that I specified.  All fields are camelCased correctly (I added the properties argument to get around the uppercasing issue), the type is set correctly, and all data is returned, but it is not of type "AddressBook".  If I do <cfreturn createObject( "component", "AddressBook" ).init( arguments.id ) /> the data is returned as "AddressBook".  Any ideas?   (Code is below). <cffunction name="getAllProperties" output="false" access="remote">   <cfargument name="queryData" type="query" required="true" />   <cfargument name="properties" type="string" required="false" default="addressBookId,ownerId,connectionSourceId,addressTypeId,address1,address2,city,state,zip,countryId,longitude,latitude,radianLat,radianLong,lastUpdate,lastUpdateBy,lastUpdateByConnectionSourceId" />   <cfset var INST = structNew() />   <cfset INST.obj = structNew() />   <cfset INST.ret = arrayNew( 1 ) />   <!---  default object to addressbook --->   <cfset INST.obj['__type__'] = "AddressBook" />   <!--- loop over query --->   <cfloop query="arguments.queryData">     <!--- loop over columns and assign to temporary object --->     <cfloop list="#arguments.properties#" index="INST.property">       <cfset INST.obj[INST.property] = arguments.queryData[INST.property][currentRow] />     </cfloop>     <cfscript>       ArrayAppend( INST.ret, duplicate( INST.obj ) );     </cfscript>   </cfloop>        <cfreturn INST.ret /> </cffunction>
<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

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

Designer, Developer and mobile workflow conference