So I’ve been playing around with AJAX and Flex quite a bit lately. Seems a lot of people I talk to are interested in these technologies and I must say, they are pretty cool. Especially the ASP.NET AJAX Extensions and Toolkit. I installed a copy of Flex Builder and went through about 16 hours worth of Flex training but it didn’t excite me near as much as watching the AJAX for ASP.NET videos.With all the hype surrounding the whole Web 2.0 craze lately, seeing so many sites with AJAX and Flex popping up, realizing sites you go to everyday are now incorporating more and more “really cool” features…it definitely feels like things are changing quickly. Although Flex is sort of considered to be an alternative to AJAX, I think knowing how to work with both is the smart way to go right now. Obviously the more you know, the more powerful you are but in this case, I can see how each would serve their own unique purpose. Similar to the way technologies like Flash and Java do.
The main thing I’m interested in right now though is getting really knee deep into the inner workings of so-called Web 2.0 applications. When writing ASP.NET applications, Visual Studio has always been great for dragging and dropping controls, auto-generating code, and of course hiding that code from you. Making complex tasks very easy, or seem very easy thus requiring less overall knowledge to accomplish. It’s no different with AJAX for ASP.NET. What requires a click and a drag within Visual Studio might seemingly take hours to code by hand in PHP. But the amount of time spent dealing with it’s quirkiness could be about the same.
I spent the last 6 or so hours fighting with a “simple ASP.NET AJAX” application. Not to be outdone, I spent about 8 hours yesterday fighting with a simple Flex application. I decided to update my MP3 database and create a data access class in C# that I could use with various other applications. For instance, I created a search page in ASP.NET with a datagrid for the results. Then I created a web service that performed the database functions and hooked the ASP.NET page up to that. Finally, I wanted to create a Flex application to connect to the web service. Ran into quite a few snags here and there mainly because I was trying to return a DataSet object from the web service method call.
Flex and Microsoft web services don’t seem to play well together just yet. Retrieving DataSet data in Flex can be a little tricky. For instance, you cannot actually send a true DataSet object. You have to return a DataTable object. Flex then reads it in as an ArrayCollection.
Then again, ASP.NET AJAX and Microsoft web services don’t seem to play that well together either. Using the same web service that I had the ASP.NET page and Flex application working with, I then AJAX enabled the ASP.NET page. This worked beautifully! I was amazed! I thought how can this be so easy?? Well, the problems arose when I decided to add the code to call the web service methods using client side javascript functions. This concept is the true essence of AJAX technology and is at the core of why AJAX is really powerful. So it definitely cannot be overlooked. But it also proves to be the most nerve racking concept! Of course!
What caused such a headache earlier was the fact that when you call a web service using javascript, you have to use a relative path that points to a local copy of the *.asmx file. This means that the web service must be local in order to access it using client side javascript calls. This pretty much defeats the purpose of a web service. Ok not entirely, but web services are essentially meant to be remotely called over the web…or over a network. So for the service to have to be local just didn’t make much sense to me.
Well, come to find out…it is possible to reference a remote *.asmx file via a URL address, but to do so you have to create a bridge between the javascript and the web service. In other words it’s the same as creating a proxy like you would with a PHP implementation. I haven’t had a chance to experiment with this yet but I plan to in the next couple days. There really isn’t a whole lot of information out there yet on this stuff because it’s still so new but I have a few books here that should help.
Ok now, back to the fun…
No Comments Yet so far
Leave a comment
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>