RE: [flexcoders] Re: Flex and .net webservices
Thanks Ben, Changing the data type to Number didn't help either. I'll have a look at Darron's solution ... Cheers Robin From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ben.clinkinbeard Sent: Tuesday, 12 December 2006 4:56 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Flex and .net webservices Might want to try making employeeID a Number instead of an int. If that doesn't work use this: http://www.darronschall.com/weblog/archives/000247.cfm http://www.darronschall.com/weblog/archives/000247.cfm HTH, Ben --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Robin Burrer [EMAIL PROTECTED] wrote: Thanks Ben, I tried that. It still does not work ..:-(. I got rid of everything which could cause errors. ... Here's the code. I reckon this is as basic as it gets ... public function onMyResult(event:ResultEvent):void { // this works fine var myObject:Object = Object(event.result); // this causes an error (Error #1034: Type Coercion failed: cannot convert [EMAIL PROTECTED] to webserviceClasses.Employee.) var myEmployee:Employee = Employee(event.result); // does not work trace (myEmployee.employeeName); // does work trace (myObject.employeeName); } ]] /// the web service object /mx:Script mx:WebService showBusyCursor=true wsdl=http://localhost/ComplexDataTypeService/Service1.asmx?WSDL http://localhost/ComplexDataTypeService/Service1.asmx?WSDL id=myWebservice makeObjectsBindable=false mx:operation name=getDetails result={ onMyResult (event)} resultFormat=object/ /mx:WebService // the Employee object: public class Employee (AS) { public var employeeName:String; public var employeeID:int; } (c#) public class Employee { public string employeeName; public int employeeID; } Any ideas? Robin From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of ben.clinkinbeard Sent: Tuesday, 12 December 2006 2:02 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] Re: Flex and .net webservices Hi Robin, I have good news :), both of these issues should go away by setting a single attribute on your WebService object. Try setting makeObjectsBindable = false. This will cause Flex to deserialize your ws responses into regular Object and Array instances instead of ObjectProxy and ArrayCollection instances. HTH, Ben --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com mailto:flexcoders%40yahoogroups.com , Robin Burrer rburrer@ wrote: Hi there, I have been playing around .net and flex for a while. Primarily I want to send value objects (consisting of strings, intergers and arrays of VOs) back and forth. I could not figure out how to do the following things though: 1. Sending arrays to a webservice works fine. However when I receive an array of the .net data type array flex creates and Array Collection data type. Sending arrays as array collections to a web service causes an error. That's really annoying when you try to keep the VOs consitent on both ends. What's the solution for this? 2. When I receive a complex data type from a .net web service flex creates an Object but when I try to cast this object to the dataType it represents I get a complier error, even though the received object has exactly the same properties as underlying VO. E.g. I get the following error code if I try to cast the result of a webservice call to my custom data Type TelephoneNumber. Note casting to an Object works fine. TypeError: Error #1034: Type Coercion failed: cannot convert mx.utils::[EMAIL PROTECTED] to webserviceClasses.TelephoneNumber. Any help is highly appreciated. Robin
Re: [flexcoders] Re: Flex and .net webservices
Robin: It sounds like you may be looking for a Remoting Gateway which uses AMF rather than Web Services and has the ability to translate .NET - AS Objects. I've got articles written on two different options, Fluorine and WebOrb. http://blog.shrefler.net/?p=6 http://blog.shrefler.net/?p=10 Hope that helps Sam On 12/12/06, Robin Burrer [EMAIL PROTECTED] wrote: Darron's ObjectTranslator works perfectly – thanks for the tip! I still have to do some manual work though since I'm going to have nested VOs…. R -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Robin Burrer *Sent:* Tuesday, 12 December 2006 3:32 PM *To:* flexcoders@yahoogroups.com *Subject:* RE: [flexcoders] Re: Flex and .net webservices Thanks Ben, I tried that. It still does not work ..:-(. I got rid of everything which could cause errors. … Here's the code. I reckon this is as basic as it gets … public function onMyResult(event:ResultEvent):void { // this works fine var myObject:Object = Object(event.result); // this causes an error (Error #1034: Type Coercion failed: cannot convert [EMAIL PROTECTED] to webserviceClasses.Employee.) var myEmployee:Employee = Employee(event.result); // does not work trace ( myEmployee.employeeName); // does work trace ( myObject.employeeName); } ]] /// the web service object /mx:Script mx:WebService showBusyCursor=true wsdl=http://localhost/ComplexDataTypeService/Service1.asmx?WSDL; id=myWebservice makeObjectsBindable=false mx:operation name=getDetails result={ onMyResult (event)} resultFormat=object/ /mx:WebService // the Employee object: public class Employee (AS) { public var employeeName:String; public var employeeID:int; } (c#) public class Employee { public string employeeName; public int employeeID; } Any ideas? Robin -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *ben.clinkinbeard *Sent:* Tuesday, 12 December 2006 2:02 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Re: Flex and .net webservices Hi Robin, I have good news :), both of these issues should go away by setting a single attribute on your WebService object. Try setting makeObjectsBindable = false. This will cause Flex to deserialize your ws responses into regular Object and Array instances instead of ObjectProxy and ArrayCollection instances. HTH, Ben --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Robin Burrer [EMAIL PROTECTED] wrote: Hi there, I have been playing around .net and flex for a while. Primarily I want to send value objects (consisting of strings, intergers and arrays of VOs) back and forth. I could not figure out how to do the following things though: 1. Sending arrays to a webservice works fine. However when I receive an array of the .net data type array flex creates and Array Collection data type. Sending arrays as array collections to a web service causes an error. That's really annoying when you try to keep the VOs consitent on both ends. What's the solution for this? 2. When I receive a complex data type from a .net web service flex creates an Object but when I try to cast this object to the dataType it represents I get a complier error, even though the received object has exactly the same properties as underlying VO. E.g. I get the following error code if I try to cast the result of a webservice call to my custom data Type TelephoneNumber. Note casting to an Object works fine. TypeError: Error #1034: Type Coercion failed: cannot convert mx.utils::[EMAIL PROTECTED] to webserviceClasses.TelephoneNumber. Any help is highly appreciated. Robin
Re: [flexcoders] Re: Flex and .net webservices
Try ObjectUtil.toString(myObject) Patrick Robin Burrer a écrit : Thanks Ben, I tried that. It still does not work ..:-(. I got rid of everything which could cause errors. … Here’s the code. I reckon this is as basic as it gets … public function onMyResult(event: ResultEvent) :void { // this works fine var myObject:Object = Object(event. result); // this causes an error ( Error #1034: Type Coercion failed: cannot convert [EMAIL PROTECTED] to webserviceClasses. Employee. ) var myEmployee:Employee = Employee(event. result); // does not work trace (myEmployee. employeeName) ; // does work trace (myObject.employeeN ame); } ]] /// the web service object /mx:Script mx:WebService showBusyCursor=true wsdl=http://localhost/ ComplexDataTypeS ervice/Service1. asmx?WSDL id=myWebservice makeObjectsBindable =false mx:operation name=getDetails result={ onMyResult (event)} resultFormat=object/ /mx:WebService // the Employee object: public class Employee (AS) { public var employeeName: String; public var employeeID:int; } (c#) public class Employee { public string employeeName; public int employeeID; } Any ideas? Robin * From: * [EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups. com] *On Behalf Of *ben.clinkinbeard *Sent:* Tuesday, 12 December 2006 2:02 PM *To:* [EMAIL PROTECTED] ups.com *Subject:* [flexcoders] Re: Flex and .net webservices Hi Robin, I have good news :), both of these issues should go away by setting a single attribute on your WebService object. Try setting makeObjectsBindable = false. This will cause Flex to deserialize your ws responses into regular Object and Array instances instead of ObjectProxy and ArrayCollection instances. HTH, Ben --- In [EMAIL PROTECTED] ups.com mailto:flexcoders%40yahoogroups.com, Robin Burrer [EMAIL PROTECTED] wrote: Hi there, I have been playing around .net and flex for a while. Primarily I want to send value objects (consisting of strings, intergers and arrays of VOs) back and forth. I could not figure out how to do the following things though: 1. Sending arrays to a webservice works fine. However when I receive an array of the .net data type array flex creates and Array Collection data type. Sending arrays as array collections to a web service causes an error. That's really annoying when you try to keep the VOs consitent on both ends. What's the solution for this? 2. When I receive a complex data type from a .net web service flex creates an Object but when I try to cast this object to the dataType it represents I get a complier error, even though the received object has exactly the same properties as underlying VO. E.g. I get the following error code if I try to cast the result of a webservice call to my custom data Type TelephoneNumber . Note casting to an Object works fine. TypeError: Error #1034: Type Coercion failed: cannot convert mx.utils::ObjectPro [EMAIL PROTECTED] to webserviceClasses. TelephoneNumber. Any help is highly appreciated. Robin -- 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/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * 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/
Re: [flexcoders] Re: Flex and .net webservices
Hi Sam, I've read your tutorial, good stuff. I've been using flourine for a while in different projects but I haven't got the chance to use weborb. As you've tried both of them, I was wondering if you can make a comparison table or a pro and cons of each of them. It would be great. BTW, how do you send nullable objects back and forth? Cheers, Diego. On Wed, 13 Dec 2006 02:08:06 +1300, Sam Shrefler [EMAIL PROTECTED] wrote: Robin: It sounds like you may be looking for a Remoting Gateway which uses AMF rather than Web Services and has the ability to translate .NET - AS Objects. I've got articles written on two different options, Fluorine and WebOrb. http://blog.shrefler.net/?p=6 http://blog.shrefler.net/?p=10 Hope that helps Sam On 12/12/06, Robin Burrer [EMAIL PROTECTED] wrote: Darron's ObjectTranslator works perfectly – thanks for the tip! I still have to do some manual work though since I'm going to have nested VOs…. R -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *Robin Burrer *Sent:* Tuesday, 12 December 2006 3:32 PM *To:* flexcoders@yahoogroups.com *Subject:* RE: [flexcoders] Re: Flex and .net webservices Thanks Ben, I tried that. It still does not work ..:-(. I got rid of everything which could cause errors. … Here's the code. I reckon this is as basic as it gets … public function onMyResult(event:ResultEvent):void { // this works fine var myObject:Object = Object(event.result); // this causes an error (Error #1034: Type Coercion failed: cannot convert [EMAIL PROTECTED] to webserviceClasses.Employee.) var myEmployee:Employee = Employee(event.result); // does not work trace ( myEmployee.employeeName); // does work trace ( myObject.employeeName); } ]] /// the web service object /mx:Script mx:WebService showBusyCursor=true wsdl=http://localhost/ComplexDataTypeService/Service1.asmx?WSDL; id=myWebservice makeObjectsBindable=false mx:operation name=getDetails result={ onMyResult (event)} resultFormat=object/ /mx:WebService // the Employee object: public class Employee (AS) { public var employeeName:String; public var employeeID:int; } (c#) public class Employee { public string employeeName; public int employeeID; } Any ideas? Robin -- *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On Behalf Of *ben.clinkinbeard *Sent:* Tuesday, 12 December 2006 2:02 PM *To:* flexcoders@yahoogroups.com *Subject:* [flexcoders] Re: Flex and .net webservices Hi Robin, I have good news :), both of these issues should go away by setting a single attribute on your WebService object. Try setting makeObjectsBindable = false. This will cause Flex to deserialize your ws responses into regular Object and Array instances instead of ObjectProxy and ArrayCollection instances. HTH, Ben --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Robin Burrer [EMAIL PROTECTED] wrote: Hi there, I have been playing around .net and flex for a while. Primarily I want to send value objects (consisting of strings, intergers and arrays of VOs) back and forth. I could not figure out how to do the following things though: 1. Sending arrays to a webservice works fine. However when I receive an array of the .net data type array flex creates and Array Collection data type. Sending arrays as array collections to a web service causes an error. That's really annoying when you try to keep the VOs consitent on both ends. What's the solution for this? 2. When I receive a complex data type from a .net web service flex creates an Object but when I try to cast this object to the dataType it represents I get a complier error, even though the received object has exactly the same properties as underlying VO. E.g. I get the following error code if I try to cast the result of a webservice call to my custom data Type TelephoneNumber. Note casting to an Object works fine. TypeError: Error #1034: Type Coercion failed: cannot convert mx.utils::[EMAIL PROTECTED] to webserviceClasses.TelephoneNumber. Any help is highly
Re: [flexcoders] Re: Flex and .net webservices
Diego: First: Compare...I haven't used WebOrb at all past that. So my table consists of: Free vs Paid - i've chosen free at this point. WebOrb looks like an awesome product always being updated, but ihaven't had the need/chance to use it yet Second: Nullable objects! Ah yes...something I beat my head against the desk for quite some time with DateTimes. in .NET: public NullableDateTime myDateTime; Nothing changes in Flex. Hope that helps Sam On 12/12/06, Diego Guebel [EMAIL PROTECTED] wrote: Hi Sam, I've read your tutorial, good stuff. I've been using flourine for a while in different projects but I haven't got the chance to use weborb. As you've tried both of them, I was wondering if you can make a comparison table or a pro and cons of each of them. It would be great. BTW, how do you send nullable objects back and forth? Cheers, Diego. On Wed, 13 Dec 2006 02:08:06 +1300, Sam Shrefler [EMAIL PROTECTED]sshrefler%40gmail.com wrote: Robin: It sounds like you may be looking for a Remoting Gateway which uses AMF rather than Web Services and has the ability to translate .NET - AS Objects. I've got articles written on two different options, Fluorine and WebOrb. http://blog.shrefler.net/?p=6 http://blog.shrefler.net/?p=10 Hope that helps Sam On 12/12/06, Robin Burrer [EMAIL PROTECTED] rburrer%40hubb.com wrote: Darron's ObjectTranslator works perfectly – thanks for the tip! I still have to do some manual work though since I'm going to have nested VOs…. R -- *From:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com[mailto: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] *On Behalf Of *Robin Burrer *Sent:* Tuesday, 12 December 2006 3:32 PM *To:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com *Subject:* RE: [flexcoders] Re: Flex and .net webservices Thanks Ben, I tried that. It still does not work ..:-(. I got rid of everything which could cause errors. … Here's the code. I reckon this is as basic as it gets … public function onMyResult(event:ResultEvent):void { // this works fine var myObject:Object = Object(event.result); // this causes an error (Error #1034: Type Coercion failed: cannot convert [EMAIL PROTECTED] to webserviceClasses.Employee.) var myEmployee:Employee = Employee(event.result); // does not work trace ( myEmployee.employeeName); // does work trace ( myObject.employeeName); } ]] /// the web service object /mx:Script mx:WebService showBusyCursor=true wsdl=http://localhost/ComplexDataTypeService/Service1.asmx?WSDL; id=myWebservice makeObjectsBindable=false mx:operation name=getDetails result={ onMyResult (event)} resultFormat=object/ /mx:WebService // the Employee object: public class Employee (AS) { public var employeeName:String; public var employeeID:int; } (c#) public class Employee { public string employeeName; public int employeeID; } Any ideas? Robin -- *From:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com[mailto: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] *On Behalf Of *ben.clinkinbeard *Sent:* Tuesday, 12 December 2006 2:02 PM *To:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com *Subject:* [flexcoders] Re: Flex and .net webservices Hi Robin, I have good news :), both of these issues should go away by setting a single attribute on your WebService object. Try setting makeObjectsBindable = false. This will cause Flex to deserialize your ws responses into regular Object and Array instances instead of ObjectProxy and ArrayCollection instances. HTH, Ben --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders%40yahoogroups.com, Robin Burrer [EMAIL PROTECTED] wrote: Hi there, I have been playing around .net and flex for a while. Primarily I want to send value objects (consisting of strings, intergers and arrays of VOs) back and forth. I could not figure out how to do the following things though: 1. Sending arrays to a webservice works fine. However when I receive an array of the .net data type array flex creates and Array Collection data type. Sending arrays as array collections to a web service causes an error. That's really annoying when you try to keep the VOs consitent on both ends. What's the solution for this? 2. When I receive a complex data type from a .net web service flex creates an Object but when I try to cast this object to the dataType it represents I get a complier error, even though the received object has exactly the same properties as underlying VO. E.g. I get the following error code if I try to cast the result of a webservice call to my custom data Type TelephoneNumber. Note casting to an Object works fine. TypeError: Error #1034: Type
Re: [flexcoders] Re: Flex and .net webservices
Hi Sam, I've made the same decision :D What about nullable boolean and the rest of the possible types? cheers, Diego. On Wed, 13 Dec 2006 09:51:43 +1300, Sam Shrefler [EMAIL PROTECTED] wrote: Diego: First: Compare...I haven't used WebOrb at all past that. So my table consists of: Free vs Paid - i've chosen free at this point. WebOrb looks like an awesome product always being updated, but ihaven't had the need/chance to use it yet Second: Nullable objects! Ah yes...something I beat my head against the desk for quite some time with DateTimes. in .NET: public NullableDateTime myDateTime; Nothing changes in Flex. Hope that helps Sam On 12/12/06, Diego Guebel [EMAIL PROTECTED] wrote: Hi Sam, I've read your tutorial, good stuff. I've been using flourine for a while in different projects but I haven't got the chance to use weborb. As you've tried both of them, I was wondering if you can make a comparison table or a pro and cons of each of them. It would be great. BTW, how do you send nullable objects back and forth? Cheers, Diego. On Wed, 13 Dec 2006 02:08:06 +1300, Sam Shrefler [EMAIL PROTECTED]sshrefler%40gmail.com wrote: Robin: It sounds like you may be looking for a Remoting Gateway which uses AMF rather than Web Services and has the ability to translate .NET - AS Objects. I've got articles written on two different options, Fluorine and WebOrb. http://blog.shrefler.net/?p=6 http://blog.shrefler.net/?p=10 Hope that helps Sam On 12/12/06, Robin Burrer [EMAIL PROTECTED] rburrer%40hubb.com wrote: Darron's ObjectTranslator works perfectly – thanks for the tip! I still have to do some manual work though since I'm going to have nested VOs…. R -- *From:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com[mailto: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] *On Behalf Of *Robin Burrer *Sent:* Tuesday, 12 December 2006 3:32 PM *To:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com *Subject:* RE: [flexcoders] Re: Flex and .net webservices Thanks Ben, I tried that. It still does not work ..:-(. I got rid of everything which could cause errors. … Here's the code. I reckon this is as basic as it gets … public function onMyResult(event:ResultEvent):void { // this works fine var myObject:Object = Object(event.result); // this causes an error (Error #1034: Type Coercion failed: cannot convert [EMAIL PROTECTED] to webserviceClasses.Employee.) var myEmployee:Employee = Employee(event.result); // does not work trace ( myEmployee.employeeName); // does work trace ( myObject.employeeName); } ]] /// the web service object /mx:Script mx:WebService showBusyCursor=true wsdl=http://localhost/ComplexDataTypeService/Service1.asmx?WSDL; id=myWebservice makeObjectsBindable=false mx:operation name=getDetails result={ onMyResult (event)} resultFormat=object/ /mx:WebService // the Employee object: public class Employee (AS) { public var employeeName:String; public var employeeID:int; } (c#) public class Employee { public string employeeName; public int employeeID; } Any ideas? Robin -- *From:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com[mailto: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] *On Behalf Of *ben.clinkinbeard *Sent:* Tuesday, 12 December 2006 2:02 PM *To:* flexcoders@yahoogroups.com flexcoders%40yahoogroups.com *Subject:* [flexcoders] Re: Flex and .net webservices Hi Robin, I have good news :), both of these issues should go away by setting a single attribute on your WebService object. Try setting makeObjectsBindable = false. This will cause Flex to deserialize your ws responses into regular Object and Array instances instead of ObjectProxy and ArrayCollection instances. HTH, Ben --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.comflexcoders%40yahoogroups.com, Robin Burrer [EMAIL PROTECTED] wrote: Hi there, I have been playing around .net and flex for a while. Primarily I want to send value objects (consisting of strings, intergers and arrays of VOs) back and forth. I could not figure out how to do the following things though: 1. Sending arrays to a webservice works fine. However when I receive an array of the .net data type array flex creates and Array Collection data type. Sending arrays as array collections to a web service causes an error. That's really annoying when you try to keep the VOs consitent on both ends. What's the solution
RE: [flexcoders] Re: Flex and .net webservices
Hi Sam, Remoting is definitely a good alternative and would probably make things a bit easier. I'm not programming the .net side of things though and the guys who are working on the backend are not too keen on using a technology which is not established standards yet. I had a look at Fluorine earlier this year and it looks very good though Cheers Robin From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Sam Shrefler Sent: Wednesday, 13 December 2006 12:08 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Flex and .net webservices Robin: It sounds like you may be looking for a Remoting Gateway which uses AMF rather than Web Services and has the ability to translate .NET - AS Objects. I've got articles written on two different options, Fluorine and WebOrb. http://blog.shrefler.net/?p=6 http://blog.shrefler.net/?p=6 http://blog.shrefler.net/?p=10 http://blog.shrefler.net/?p=10 Hope that helps Sam On 12/12/06, Robin Burrer [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Darron's ObjectTranslator works perfectly - thanks for the tip! I still have to do some manual work though since I'm going to have nested VOs R From: flexcoders@yahoogroups.com [mailto: flexcoders@ mailto:flexcoders@ yahoogroups.com http://yahoogroups.com ] On Behalf Of Robin Burrer Sent: Tuesday, 12 December 2006 3:32 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Re: Flex and .net webservices Thanks Ben, I tried that. It still does not work ..:-(. I got rid of everything which could cause errors. ... Here's the code. I reckon this is as basic as it gets ... public function onMyResult(event:ResultEvent):void { // this works fine var myObject:Object = Object(event.result); // this causes an error ( Error #1034: Type Coercion failed: cannot convert [EMAIL PROTECTED] to webserviceClasses.Employee.) var myEmployee:Employee = Employee(event.result); // does not work trace (myEmployee.employeeName); // does work trace (myObject.employeeName); } ]] /// the web service object /mx:Script mx:WebService showBusyCursor=true wsdl=http://localhost/ComplexDataTypeService/Service1.asmx?WSDL; id=myWebservice makeObjectsBindable=false mx:operation name=getDetails result={ onMyResult (event)} resultFormat=object/ /mx:WebService // the Employee object: public class Employee (AS) { public var employeeName:String; public var employeeID:int; } (c#) public class Employee { public string employeeName; public int employeeID; } Any ideas? Robin From: [EMAIL PROTECTED] ups.com [mailto:flexcoders@ yahoogroups.com http://yahoogroups.com ] On Behalf Of ben.clinkinbeard Sent: Tuesday, 12 December 2006 2:02 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Flex and .net webservices Hi Robin, I have good news :), both of these issues should go away by setting a single attribute on your WebService object. Try setting makeObjectsBindable = false. This will cause Flex to deserialize your ws responses into regular Object and Array instances instead of ObjectProxy and ArrayCollection instances. HTH, Ben --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Robin Burrer [EMAIL PROTECTED] wrote: Hi there, I have been playing around .net and flex for a while. Primarily I want to send value objects (consisting of strings, intergers and arrays of VOs) back and forth. I could not figure out how to do the following things though: 1. Sending arrays to a webservice works fine. However when I receive an array of the .net data type array flex creates and Array Collection data type
RE: [flexcoders] Re: Flex and .net webservices
Thanks Ben, I tried that. It still does not work ..:-(. I got rid of everything which could cause errors. ... Here's the code. I reckon this is as basic as it gets ... public function onMyResult(event:ResultEvent):void { // this works fine var myObject:Object = Object(event.result); // this causes an error (Error #1034: Type Coercion failed: cannot convert [EMAIL PROTECTED] to webserviceClasses.Employee.) var myEmployee:Employee = Employee(event.result); // does not work trace (myEmployee.employeeName); // does work trace (myObject.employeeName); } ]] /// the web service object /mx:Script mx:WebService showBusyCursor=true wsdl=http://localhost/ComplexDataTypeService/Service1.asmx?WSDL; id=myWebservice makeObjectsBindable=false mx:operation name=getDetails result={ onMyResult (event)} resultFormat=object/ /mx:WebService // the Employee object: public class Employee (AS) { public var employeeName:String; public var employeeID:int; } (c#) public class Employee { public string employeeName; public int employeeID; } Any ideas? Robin From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ben.clinkinbeard Sent: Tuesday, 12 December 2006 2:02 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Flex and .net webservices Hi Robin, I have good news :), both of these issues should go away by setting a single attribute on your WebService object. Try setting makeObjectsBindable = false. This will cause Flex to deserialize your ws responses into regular Object and Array instances instead of ObjectProxy and ArrayCollection instances. HTH, Ben --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Robin Burrer [EMAIL PROTECTED] wrote: Hi there, I have been playing around .net and flex for a while. Primarily I want to send value objects (consisting of strings, intergers and arrays of VOs) back and forth. I could not figure out how to do the following things though: 1. Sending arrays to a webservice works fine. However when I receive an array of the .net data type array flex creates and Array Collection data type. Sending arrays as array collections to a web service causes an error. That's really annoying when you try to keep the VOs consitent on both ends. What's the solution for this? 2. When I receive a complex data type from a .net web service flex creates an Object but when I try to cast this object to the dataType it represents I get a complier error, even though the received object has exactly the same properties as underlying VO. E.g. I get the following error code if I try to cast the result of a webservice call to my custom data Type TelephoneNumber. Note casting to an Object works fine. TypeError: Error #1034: Type Coercion failed: cannot convert mx.utils::[EMAIL PROTECTED] to webserviceClasses.TelephoneNumber. Any help is highly appreciated. Robin
RE: [flexcoders] Re: Flex and .net webservices
Darron's ObjectTranslator works perfectly - thanks for the tip! I still have to do some manual work though since I'm going to have nested VOs R From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Robin Burrer Sent: Tuesday, 12 December 2006 3:32 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Re: Flex and .net webservices Thanks Ben, I tried that. It still does not work ..:-(. I got rid of everything which could cause errors. ... Here's the code. I reckon this is as basic as it gets ... public function onMyResult(event:ResultEvent):void { // this works fine var myObject:Object = Object(event.result); // this causes an error (Error #1034: Type Coercion failed: cannot convert [EMAIL PROTECTED] to webserviceClasses.Employee.) var myEmployee:Employee = Employee(event.result); // does not work trace (myEmployee.employeeName); // does work trace (myObject.employeeName); } ]] /// the web service object /mx:Script mx:WebService showBusyCursor=true wsdl=http://localhost/ComplexDataTypeService/Service1.asmx?WSDL; id=myWebservice makeObjectsBindable=false mx:operation name=getDetails result={ onMyResult (event)} resultFormat=object/ /mx:WebService // the Employee object: public class Employee (AS) { public var employeeName:String; public var employeeID:int; } (c#) public class Employee { public string employeeName; public int employeeID; } Any ideas? Robin From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ben.clinkinbeard Sent: Tuesday, 12 December 2006 2:02 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Flex and .net webservices Hi Robin, I have good news :), both of these issues should go away by setting a single attribute on your WebService object. Try setting makeObjectsBindable = false. This will cause Flex to deserialize your ws responses into regular Object and Array instances instead of ObjectProxy and ArrayCollection instances. HTH, Ben --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Robin Burrer [EMAIL PROTECTED] wrote: Hi there, I have been playing around .net and flex for a while. Primarily I want to send value objects (consisting of strings, intergers and arrays of VOs) back and forth. I could not figure out how to do the following things though: 1. Sending arrays to a webservice works fine. However when I receive an array of the .net data type array flex creates and Array Collection data type. Sending arrays as array collections to a web service causes an error. That's really annoying when you try to keep the VOs consitent on both ends. What's the solution for this? 2. When I receive a complex data type from a .net web service flex creates an Object but when I try to cast this object to the dataType it represents I get a complier error, even though the received object has exactly the same properties as underlying VO. E.g. I get the following error code if I try to cast the result of a webservice call to my custom data Type TelephoneNumber. Note casting to an Object works fine. TypeError: Error #1034: Type Coercion failed: cannot convert mx.utils::[EMAIL PROTECTED] to webserviceClasses.TelephoneNumber. Any help is highly appreciated. Robin