There is a decent chance I am wrong about this but I think when you
use RemoteObject with FDS you set up some sort of Java <-> AS class
mapping in a config file.

Ben


--- In flexcoders@yahoogroups.com, "grahampengelly" <[EMAIL PROTECTED]> wrote:
>
> Thanks Ben & Franck for your help. Like you Franck I couldn't see why
> it would work to cast one completely unrelated thing to another but
> this is the way it appeared to be being done in the samples.
> 
> Of course, what I hadn't got to grips with is that the two samples
> that I was studying are both using RemoteObject rather than WebService
>  calls and consequently are returning something that can be cast...
> 
> Thanks...
> 
> Graham
> 
> --- In flexcoders@yahoogroups.com, "ben.clinkinbeard"
> <ben.clinkinbeard@> wrote:
> >
> > Nothing definitive here but I do have a couple of suggestions. Any
> > time I see ObjectProxy mentioned in an error description, I
> > immediately wonder if makeObjectsBindable is at fault. Try setting it
> > to false on your WS and see what happens.
> > 
> > Personally, I always use e4x as my resultFormat (for various reasons),
> > so I don't have experience casting to a custom object but if you do
> > end up needing to use Franck's suggested methodology I would certainly
> > recommend creating a factory that will accept the SOAP return values
> > and return an instance of your custom object.
> > 
> > HTH,
> > Ben
> > 
> > 
> > --- In flexcoders@yahoogroups.com, "grahampengelly" <graham@> wrote:
> > >
> > > I am just getting up to speed with the Cairngorm architecture
and have
> > > been struggling with this problem for a while. I have got to the
point
> > > where I am getting a response from my web service call that has
> the data
> > > in that I expect but I cannot seem to get it to deserialize into the
> > > object that I need.
> > > 
> > > The code (I have used IResponder rather than the cairngorm Responder
> > > here as suggested during an earlier post here 
> > > <http://groups.yahoo.com/group/flexcoders/message/47366>  )
> > > 
> > >          public function result( data:Object ):void
> > >          {
> > >               var event:ResultEvent = data as ResultEvent;
> > > 
> > >               var testString:String = "";
> > >               for each(var thing:Object in event.result)
> > >               {
> > >                   testString += " " + thing + " ";
> > >               }
> > >               //test alert 1
> > >               Alert.show(testString);
> > >               //test alert 2
> > >               Alert.show("event.result.Id = " + event.result.Id + ",
> > > event.result.Name = " + event.result.Name);
> > > 
> > >               var tObj:TestObj = event.result as TestObj;
> > >               Alert.show("TestObj.Id = " + tObj.Id);
> > > 
> > >          }
> > > The test alerts print out:
> > >      test 1: Graham 1
> > >      test 2: "event.result.Id = 1, event.result.Name = Graham
> > > 
> > > The subsequent line throws an exception:
> > > 
> > > TypeError: Error #1034: Type Coercion failed: cannot convert
> > > mx.utils::[EMAIL PROTECTED] to HASAW.ClientApp.Model.TestObj.
> > > 
> > > The object that I am trying to create from the results looks like
> this:
> > > 
> > >      public class TestObj implements ValueObject
> > >      {
> > > 
> > >          public var Id:int;
> > >          public var Name:String;
> > >          public function TestObj()
> > >          {
> > >              Id = 0;
> > >              Name = "";
> > >          }
> > >      }
> > > 
> > > 
> > > I have tried various implementations and can't get the web service
> > > response to cast to TestObj. To be honest, I wouldn't have thought
> that
> > > it should cast to TestObj but I have followed all of the code
samples
> > > for Cairngorm and they all do it like this.
> > > 
> > > I am using .NET for the web service which may be an issue as the
> samples
> > > don't. It is returning the following SOAP in event.result.body
> > > 
> > >    <?xml  version="1.0" encoding="utf-8" ?>   - <#>     
> <soap:Envelope
> > > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
> > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";    
> > > xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
> > > <soap:Body>      - <#>          <GetTesterResponse xmlns="">   - <#>
> > > <GetTesterResult>                     <Id>1</Id>                    
> > > <Name>Graham</Name>            </GetTesterResult>      
> > > </GetTesterResponse>       </soap:Body>   </soap:Envelope>
> > > I know I could manually populate the object with the values but the
> > > objects I will be deserializing in the application are much more
> complex
> > > than this which would make a manual approach a pain.
> > > 
> > > Thanks in advance...
> > > 
> > > Graham
> > >
> >
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to