[Flashcoders] Flash + Array + Web Service
I read the following post and have the same exact problem. How did you construct the .net web service to allow the web service to grab the value of the complex array from Flash: This is an old thread I started back in May which I am following up on with a question. Muzak had replied to me with this: If you'll be using webservices that you can control (which it sounds like is the case), don't send XML back and forth. When using webservices, you can send Array of Objects back and forth, which is alot easier to work with. There should be a list of data type conversions in the docs somewhere. I am using the Web service classes to load in a wsdl from a .NET developer using C#. We have the basics working, I can receive a simple string from him no problem by calling the SOAP method. However, since Muzak (in the quote above) and the docs say the Web service classes supports complex object types, we are now trying to read in a complex object in Flash. The C# developer created a method for me, called GetProject() that returns a complex object he created (the complex object is simple - it just has a property that contains a simple string - i.e. objProj.Title). However, when I trace the result on the method, it returns null. Neither the C# developer or myself can figure out where we are going wrong. Any ideas? One of us has something wrong with this object and we're not sure who. Also, for a second related question, once I can read the object in Flash (it would contain arrays and properties, etc.) - we want to just send that object back to the webservice to update the object in C#. Any issues with that? The Help docs only say this about objects: Web Service classes Supported Types Object Types Object Types: Complex Type - ActionScript object composed of properties of any supported type Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] Flash + Array + Web Service
I guess it depends on how much you know about C# and .NET and creating the Webservice in .NET. I asked my .NET developer and he sent me this simple example of creating an object in .NET and how to call the method via Webservices. As for setting up the webservice, there is a menu option in .NET called webreference, and a wizard where you put the URL of the aspx WSDL, but beyond that, I dunno. Here is what he sent me: //Your object (file name would be AvailImage.cs): public class AvailImage { public string FileName; public AvailImage() { // // Add constructor logic here // } public string GetSomething() { return myImage.jpg; } } //Then, in some other class you can use it by typing: AvailImage oImage = new AvailImage(); //instanciate object string sTemp = oImage.GetSomething(); //call a method So in Flash, you should be able to call the method in the Webservice you would do: var myImage:String = oImage.GetSomething(); Anyway, beyond that, I don't know if I could be of more help. Hope this helps. Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Flash + Array + Web Service
Here is an example that seems to work for me. Inside an .asmx file: using System; using System.Web; using System.Collections; using System.Collections.Generic; using System.Web.Services; using System.Web.Services.Protocols; [WebService(Namespace = http://domain.com/;)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class service : System.Web.Services.WebService { public service () { //Uncomment the following line if using designed components //InitializeComponent(); } /// summary /// Some web method /// /summary /// param name=param1The first parameter/param /// param name=param2The second parameter/param /// returns/returns [WebMethod] public ListYourTypeOrBuiltInTypeLikeString GetProductsByCategoryAndType (int paramOne, string paramTwo) { return Your.Internal.MethodToCall(paramOne, paramTwo); } } In config.xml all I see is this: webServices protocols add name=HttpGet/ add name=HttpPost/ /protocols /webServices Hopefully something in that example will be useful to you.. We are running ASP.NET 2.0 and have no problem with complex objects with Lists (Arrays) - if I remember correctly, some .NET data objects will not be serialized into standard SOAP objects, but into MS extensions (embrace and extend) - so you have to make sure you are not using those Types on property nodes in your complex object (I think the one we found that out with was a DataGrid). Kevin N. Brake, Stephen wrote: I read the following post and have the same exact problem. How did you construct the .net web service to allow the web service to grab the value of the complex array from Flash: This is an old thread I started back in May which I am following up on with a question. Muzak had replied to me with this: If you'll be using webservices that you can control (which it sounds like is the case), don't send XML back and forth. When using webservices, you can send Array of Objects back and forth, which is alot easier to work with. There should be a list of data type conversions in the docs somewhere. I am using the Web service classes to load in a wsdl from a .NET developer using C#. We have the basics working, I can receive a simple string from him no problem by calling the SOAP method. However, since Muzak (in the quote above) and the docs say the Web service classes supports complex object types, we are now trying to read in a complex object in Flash. The C# developer created a method for me, called GetProject() that returns a complex object he created (the complex object is simple - it just has a property that contains a simple string - i.e. objProj.Title). However, when I trace the result on the method, it returns null. Neither the C# developer or myself can figure out where we are going wrong. Any ideas? One of us has something wrong with this object and we're not sure who. Also, for a second related question, once I can read the object in Flash (it would contain arrays and properties, etc.) - we want to just send that object back to the webservice to update the object in C#. Any issues with that? The Help docs only say this about objects: Web Service classes Supported Types Object Types Object Types: Complex Type - ActionScript object composed of properties of any supported type Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com