Oct 25, 2007

Introducing Basic Back-End Services: From AJAX to Silverlight

My previous post describes the overall problem of communicating with services from Silverlight. Let's now concentrate on one specific but very important part of it: "basic back-end services" (and by the way, if you can think of a better name for this please let me know :)

What I mean by "basic back-end services" is services that you write specifically for your Silverlight app.

Let's take an example: Suppose you want to create an interactive shopping application (something like this or even this). Your users will search for products, add them to a shopping cart, enter payment information, and so on. Clearly some information needs to flow between the browser and the back-end server for this to work.

Traditionally (in the pre-AJAX world) if you wanted to do this on the Microsoft platform, you would create a bunch of .aspx pages in ASP.NET that would communicate with the server using postbacks. When a user entered a search string and hit "Search", it would generate a POST to the server, which would then respond with a newly-generated page.

AJAX eliminated the need for page refreshes, and introduced the notion of "back-end services". These services process very specific information and return very specific replies instead of resending the entire page after every request. In this model, when the user hits "Search", a request is sent to the back-end service which replies with just the search results (instead of an entire HTML page that happens to contain the results). It is the job of JavaScript code to then integrate these results with the rest of the page.

Again, if we look at the Microsoft platform, ASP.NET AJAX makes this very easy with the UpdatePanel control: you don't need to write any code and you don't have to even know that these back-end services are there - you can think of them as being created automatically for you.

There are limits to what the UpdatePanel can do, and so to get more flexibility you will need to write custom services (and the JavaScript code that uses them) yourself. With ASP.NET AJAX, there are different options to write them (page methods, .asmx services, WCF services), but it all essentially boils down to the same thing: you are using JavaScript to remotely call a method. The "Search" button on your shopping site will essentially call something like GetProductList("searchString") on your back-end server, "Add To Cart"will call something like AddToCart(productId), and so on.

Notice that these back-end methods are very specific to your particular application - they are normally written specifically for this purpose and not reused for anything else. This is exactly the basic back-end services that this post is about. The opposite of this case is the interoperability problem - talking to services that have already been established for purposes other than your specific application and that you cannot change - but I will cover that separately.

So how do basic back-end services work in Silverlight? Well, in 1.0 you cannot call them from within the Silverlight app itself - your only option is to use JavaScript on the page that hosts your Silverlight control and use all of the AJAX techniques I described above.

In 1.1, you will be able to call services directly from .NET code in your Silverlight application. I will explain how in the next post.

45 comments:

Railroads said...

You do have a point here :) I admire the stuff you post and the quality information you offer in your blog! Keep up the good work dude. Please come visit my site Transportation companies when you got time.

Security guards said...

Me and my friend were arguing about an issue similar to this! Now I know that I was right. lol! Thanks for the information you post. Please come visit my site Security systems when you got time.

Anonymous said...

love your blog! Very cool! Please come visit my site Fresno Business Directory when you got time.

Anonymous said...

You owe a very nice and interesting blog. Please come visit my site Sacramento Business Directory when you got time.

Steel Roofing said...

I really liked your blog! You have some great content. Please come visit my site Roofing when you got time.

Signs said...

Thanks for posting, definitely going to subscribe! See you on my reader. Please come my site Signage when you got time.

Anonymous said...

I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business Thanks for all your help and wishing you all the success in your business Please come visit my site Cincinnati Yellow Page Business Directory when you got time.

amateur porn said...

It is very interesting article and quite impressive and more informative and looking forward to read such article. Please come visit my site deleted youtube videos when you got time.

rr8004 said...

I always look forward to your new posts, I learn more compared to school. Always looking forward. Thank you. Please come visit my site Alberta facts when you got time.

touchscreen point of sale software said...

You share valuable information and excellent design you got here! I would like to thank you for sharing your thoughts and time into the stuff you post!! Thumbs up. Please come visit my site point of sale cash register
give me any valuable feedbacks.

time management plan said...

I was thinking of looking up some of them newspaper websites, but am glad I came here instead. Although glad is not quite the right word… let me just say I needed this after the incessant chatter in the media, and am grateful to you for articulating something many of us are feeling - even from distant shores. Please come visit my site time management techniques give me any valuable feedbacks.

trucking companies said...

You owe a very nice and interesting blog. Feel free to check out my site trucks when you got time.

trucks said...

Such interesting read and information, thanks for sharing this post. I will check back to read your other new posts. Please come visit my site storage when you got time.

social anxiety disorder treatment said...

As a Newbie, I am always searching online for information that can help me. Thank you. Please come visit my site social anxiety disorder when you got time.

generalized anxiety disorder said...

As a Newbie, I am always searching online for information that can help me. Thank you. Please come visit my site generalized anxiety when you got time.

rr8004 said...

I found your blog on google and read a few of your other posts. I just added you to my Google News Reader. Keep up the good work. Look forward to reading more from you in the future. Please come visit my site Local Business Directory Of Wichita U.S.A. when you got time.

rr8004 said...

Really great work. Congrats to everyone who are involved with this project. The website layout and graphics are really cool. Please come visit my site Local Business Directory Of Newark U.S.A. when you got time.

math tutoring said...

You share valuable information and excellent design you got here! I would like to thank you for sharing your thoughts and time into the stuff you post!! Thumbs up. Please come visit my site high school give me any valuable feedbacks.

accountants said...

I was thinking of looking up some of them newspaper websites, but am glad I came here instead. Although glad is not quite the right word… let me just say I needed this after the incessant chatter in the media, and am grateful to you for articulating something many of us are feeling - even from distant shores. Please come visit my site irs give me any valuable feedbacks.

Anonymous said...

that your great job is clearly identifed. I was wondering if you offer any subscription to your RSS feeds as I would be very interested and can’t find any link to subscribe here. Please come visit my site Phone Directory Of Indiana when you got time.

Anonymous said...

that your great job is clearly identifed. I was wondering if you offer any subscription to your RSS feeds as I would be very interested and can’t find any link to subscribe here. Please come visit my site Iowa Yellow Page Business Directory when you got time.

funny video's said...

I can see that you are putting a lot of time and effort into your blog and detailed articles! I am deeply in love with every single piece of information you post here. Will be back often to read more updates! Please come visit my site funny video's when you got time.

Wholesale Distributor said...

Wow! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog? Please come visit my site jewelry give me any valuable feedbacks.

wholesale gift said...

I usually don’t leave comments!!! Trust me! But I liked your blog…especially this post! Would you mind terribly if I put up a backlink from my site to your site? Please come visit my site home accent give me any valuable feedbacks.

Anonymous said...

This is just another reason why I like your website. I like your style of writing you tell your stories without out sending us to 5 other sites to complete the story. Please come visit my site Services Business Directory Memphis when you got time.

Anonymous said...

This is just another reason why I like your website. I like your style of writing you tell your stories without out sending us to 5 other sites to complete the story. Please come visit my site Memphis Directory Businesses when you got time.

Anonymous said...

What a facinating article. I’m looking for a marketing expert to help with a project, could you help? Please come visit my site San Diego Phone Numbers when you got time.

Anonymous said...

What a facinating article. I’m looking for a marketing expert to help with a project, could you help? Please come visit my site San Diego Business Search when you got time.

Divorce Advice said...

You owe a very nice and interesting blog. Feel free to check out my site Divorce Advice when you got time.

Document Shredding said...

Such interesting read and information, thanks for sharing this post. I will check back to read your other new posts. Please come visit my site Document Shredding when you got time.

Antique Guide said...

Thank you for your good humor and for allowing yourself to be convinced that this was the right show for you to work on. Please come visit my site Antique guide when you got time.

Wills, Trusts & Estate Planning said...

Oh Pat, you’ve got friends! Don’t give me that. Your blog looks great and has good info. You can be friends with me. Please come visit my site Wills when you got time. Thanks.

Anonymous said...

I really liked your post on home financing! if you have more information elsewhere let me know. Please come visit my site Business Resources Comprehensive Listings when you got time.

Anonymous said...

I really liked your post on home financing! if you have more information elsewhere let me know. Please come visit my site Arlington Business Phone Numbers when you got time.

Anonymous said...

It is very interesting article and quite impressive and more informative and looking forward to read such article. Please come visit my site City Guide Corpus Christi when you got time.

Anonymous said...

It is very interesting article and quite impressive and more informative and looking forward to read such article. Please come visit my site Corpus Christi City Business Listings when you got time.

Anonymous said...

Symptoms bronchitis, bronchitis chronic, bronchitis treatment.bronchitis natural

rr8004 said...

Awesome! I have read a lot on this topic, but you definitely give it a good vibe. This is a great post. Will be back to read more! Please come visit my site Louisville Business Directory when you got time.

rr8004 said...

Awesome! I have read a lot on this topic, but you definitely give it a good vibe. This is a great post. Will be back to read more! Please come visit my site Louisville Yellow Page Business Directory when you got time.

rr8004 said...

Excellent article , i just share it with my friend of Italy. I Stumble UP your blog post , you will notice an increase of traffic within 24 hours for targeted people. Cheers . Please come visit my site Fresno Yellow Pages when you got time.

rr8004 said...

Excellent article , i just share it with my friend of Italy. I Stumble UP your blog post , you will notice an increase of traffic within 24 hours for targeted people. Cheers . Please come visit my site American Fresno online business directory when you got time.

rr8004 said...

Couldn't be written any better. Reading this post reminds me of my old room mate! He always kept talking about this. I will forward this article to him. Pretty sure he will have a good read. Thanks for sharing! Please come visit my site Business Yellow Pages Scottsdale when you got time.

rr8004 said...

Couldn't be written any better. Reading this post reminds me of my old room mate! He always kept talking about this. I will forward this article to him. Pretty sure he will have a good read. Thanks for sharing! Please come visit my site Free Business Listing of Scottsdale when you got time.

rr8004 said...

Wow, loving the two photos you posted. You got potential. Please come visit my site Raleigh City Business Listings when you got time.

rr8004 said...

Wow, loving the two photos you posted. You got potential. Please come visit my site Directory Raleigh City when you got time.