Exploring the depths and potentials of ASP.NET RSS 2.0 or Subscribe to .BenRush by Email
 Thursday, May 04, 2006

Alright, you saw in the last blog entry how to get the Atlas client framework to download script that wraps a webservice reference: 

    <atlas:ScriptManager ID="scriptManager" runat="server" EnableScriptComponents="true" >
        <Services>
            <atlas:ServiceReference Path="SimpleService.asmx" />
        </Services>
    </atlas:ScriptManager>

The question now is how does everything tie together? We have  reference to a web service here, but that's about it. Bare in mind that the <atlas:ScriptManager> tag is processed server-side instead of client-side, so the ASP.Net runtime is responsible for processing it and not the clientside Atlas framework. What the clientside Atlas framework gets looks like this:

<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
  <references>
    <add src="SimpleService.asmx/js" />
  </references>
  <components />
</page>

...this is what the Atlas framework sees. Now, in a later blog post I'll go into the details of how the client framework parses and builds the script out of the XML script block in general, but for now I'll lightly touch on the topic enough to answer how the JavaScript gets downloaded to the client.

There is a class called Sys.MarkupParser whose responsibility is to deal with markup and, well, parse it. It has a method called _processXMLScript whose responsibility it is to, well, processXMLScript. The method is relatively simple (suprisingly) and looks like this:

this._processXMLScript = function(markupContext, references, componentNodes, completionHandler) {
   var xmlScriptContext =
   {
      markupContext: markupContext,
      references: references,
      componentNodes: componentNodes,
      completionHandler: completionHandler
   };

   if (references && references.length) {
      var scriptLoader = new Sys.ScriptLoader();
      scriptLoader.load(references,
         Function.createDelegate(this, this._processXMLScriptComponents),
         xmlScriptContext);
   }
   else {
      this._processXMLScriptComponents(xmlScriptContext);
   }
}

...the section to take note of is, obviously, the one that instantiates the class Sys.ScriptLoader(). It takes all references parsed out of the references block above and snags them. The most pertinent chunk of code from the .load() method above looks like this:

if (_references.length) {
   var reference = _references.dequeue();
   var scriptElement = document.createElement('script');
   _currentLoadingReference = scriptElement;

   if (Sys.Runtime.get_hostType() != Sys.HostType.InternetExplorer) {
      scriptElement.readyState = 'loaded';
      scriptElement.onload = loadReferences;
   }
   else {
      scriptElement.onreadystatechange = loadReferences;
   }
   scriptElement.type = 'text/javascript';
   scriptElement.src = reference;

   var headElement = document.getElementsByTagName('head')[0];
   headElement.appendChild(scriptElement);

   return;
}

See that the scriptElement.src is set to the 'reference' object, which is a string in this case that points to the web service URI with the "/js" appended. What this means is that the browser references this script as a "src" and therefore is responsible for downloading and loading the script into the script runtime, not the Atlas framework itself. When this URI is hit, the Atlas runtime on the server generates the script and everything links up appropriately.

Happy coding.  


kick it on DotNetKicks.com
Thursday, May 04, 2006 1:31:02 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Computing
Tracked by:
http://freewebs.com/aspxfaq/00/sitemap8.html [Pingback]
http://freewebs.com/toltom/08/sitemap13.html [Pingback]
http://freewebs.com/toltom/02/syracuse-university.html [Pingback]
http://freewebs.com/toltom/09/sitemap19.html [Pingback]
http://freewebs.com/toltom/14/confirmation-gifts.html [Pingback]
"http://fartooblog.tripod.com/21.html" (http://fartooblog.tripod.com/21.html) [Pingback]
"http://fartooblog.tripod.com/72.html" (http://fartooblog.tripod.com/72.html) [Pingback]
"http://mxfb9a.org/sitemap24.html" (http://mxfb9a.org/sitemap24.html) [Pingback]
"http://lpf7rt.org/pussy-spreading.html" (http://lpf7rt.org/pussy-spreading.html... [Pingback]
"http://topslots.nl.eu.org/10/sitemap17.html" (http://topslots.nl.eu.org/10/site... [Pingback]
"http://freewebs.com/amexa/44/lewis-black.html" (http://freewebs.com/amexa/44/le... [Pingback]
"http://freewebs.com/amexa/34/www-apartment-guide-com.html" (http://freewebs.com... [Pingback]
"http://freewebs.com/amexa/13/home-and-garden.html" (http://freewebs.com/amexa/1... [Pingback]
"http://pinofranc.homestead.com/00/winchester-house.html" (http://pinofranc.home... [Pingback]
"http://pinofranc.homestead.com/05/blue-book-value-for-boats.html" (http://pinof... [Pingback]
"http://pinofranc.homestead.com/01/index.html" (http://pinofranc.homestead.com/0... [Pingback]
"http://wdall-xxx.com/dogfart-vidz.html" (http://wdall-xxx.com/dogfart-vidz.html... [Pingback]
"http://qkzei-www.com/free-horse-sex-movies.html" (http://qkzei-www.com/free-hor... [Pingback]
"http://pasbeenews.tripod.com/94.html" (http://pasbeenews.tripod.com/94.html) [Pingback]
"http://tadguunews.netfirms.com/183.html" (http://tadguunews.netfirms.com/183.ht... [Pingback]
"http://vaztuunews.tripod.com/140.html" (http://vaztuunews.tripod.com/140.html) [Pingback]
"http://lkhhy-ooo.com/free-max-hardcore.html" (http://lkhhy-ooo.com/free-max-har... [Pingback]
"http://nabkoonews.tripod.com/92.html" (http://nabkoonews.tripod.com/92.html) [Pingback]
"http://njq8l-hhh.com/pierced-clits.html" (http://njq8l-hhh.com/pierced-clits.ht... [Pingback]
"http://xxx3t-xxx.biz/best-breast-exposed.html" (http://xxx3t-xxx.biz/best-breas... [Pingback]
"http://fnb2d-www.biz/ash-and-misty-sex.html" (http://fnb2d-www.biz/ash-and-mist... [Pingback]
"http://l6u7u-eee.com/incredibles-naked.html" (http://l6u7u-eee.com/incredibles-... [Pingback]
"http://freewebs.com/amexa/35/bank-online.html" (http://freewebs.com/amexa/35/ba... [Pingback]
"http://freewebs.com/niret/07/honda-parts.html" (http://freewebs.com/niret/07/ho... [Pingback]
"http://freewebs.com/amexa/10/online-surveys.html" (http://freewebs.com/amexa/10... [Pingback]
"http://freewebs.com/tferma/12/colorado-springs-commercial-properties.html" (htt... [Pingback]
"http://freewebs.com/tferma/04/year-round-schools.html" (http://freewebs.com/tfe... [Pingback]
"http://fkdvh-rrr.com/jersey-girl.html" (http://fkdvh-rrr.com/jersey-girl.html) [Pingback]
"http://unistarkom.mycv.tv/00616-blog.html" (http://unistarkom.mycv.tv/00616-blo... [Pingback]
"http://ramambo.nl.eu.org/07/pron.html" (http://ramambo.nl.eu.org/07/pron.html) [Pingback]
"http://harum.nl.eu.org/elizabeth-bishop.html" (http://harum.nl.eu.org/elizabeth... [Pingback]
"http://harum.nl.eu.org/bermuda-grass-seed.html" (http://harum.nl.eu.org/bermuda... [Pingback]
"http://nfdi1ek.biz/facesitter.html" (http://nfdi1ek.biz/facesitter.html) [Pingback]
"http://voretom.nl.eu.org/enema-fun.html" (http://voretom.nl.eu.org/enema-fun.ht... [Pingback]
"http://xw6t8yk.com/voluptuous-big-boobs.html" (http://xw6t8yk.com/voluptuous-bi... [Pingback]
"http://verotokom.nl.eu.org/country-animal-haven.html" (http://verotokom.nl.eu.o... [Pingback]
"http://cm8utr4.biz/adult-comic-strips.html" (http://cm8utr4.biz/adult-comic-str... [Pingback]
"http://nasferablog.netfirms.com/34.html" (http://nasferablog.netfirms.com/34.ht... [Pingback]
"http://yifpmuu.com/anal-trannys.html" (http://yifpmuu.com/anal-trannys.html) [Pingback]
"http://yoro--blog.nl.eu.org/real-butt.html" (http://yoro--blog.nl.eu.org/real-b... [Pingback]
"http://zotd7rb.biz/www-888tuffshed-com.html" (http://zotd7rb.biz/www-888tuffshe... [Pingback]
"http://lnnv9gk.biz/jane-kaczmarek-nude.html" (http://lnnv9gk.biz/jane-kaczmarek... [Pingback]
"http://nasferablog.netfirms.com/217.html" (http://nasferablog.netfirms.com/217.... [Pingback]
"http://toh--blog.nl.eu.org/ortho-tri-cyclen-lo.html" (http://toh--blog.nl.eu.or... [Pingback]
"http://nasferablog.netfirms.com/270.html" (http://nasferablog.netfirms.com/270.... [Pingback]
"http://qcdals1.biz/www-universityofmaryland-edu.html" (http://qcdals1.biz/www-u... [Pingback]
"http://tpoaef7.biz/tnlottery.html" (http://tpoaef7.biz/tnlottery.html) [Pingback]
"http://gada--mene.nl.eu.org/hot-teachers-naked.html" (http://gada--mene.nl.eu.o... [Pingback]
"http://xrxgvm0.biz/download-aol-firewall.html" (http://xrxgvm0.biz/download-aol... [Pingback]
"http://nasferablog.netfirms.com/496.html" (http://nasferablog.netfirms.com/496.... [Pingback]
"http://zf1y1fs.biz/airplanetikets.html" (http://zf1y1fs.biz/airplanetikets.html... [Pingback]
"http://hjftsic.biz/pennsylvialottery.html" (http://hjftsic.biz/pennsylvialotter... [Pingback]
"http://derfoblog.ifrance.com/sitemap3.html" (http://derfoblog.ifrance.com/sitem... [Pingback]
"http://freewebs.com/sruone/newport-news-va.html" (http://freewebs.com/sruone/ne... [Pingback]
"http://freewebs.com/sruone/sitemap228.html" (http://freewebs.com/sruone/sitemap... [Pingback]
"http://lopbafrea.homestead.com/59.html" (http://lopbafrea.homestead.com/59.html... [Pingback]
"http://aqupofot.nl.eu.org/baltimore-examiner.html" (http://aqupofot.nl.eu.org/b... [Pingback]
"http://freewebs.com/vuter/07/bilo-center.html" (http://freewebs.com/vuter/07/bi... [Pingback]
"http://buter.homestead.com/01/high-school-diploma-on-line.html" (http://buter.h... [Pingback]
"http://cuter.homestead.com/00/sitemap18.html" (http://cuter.homestead.com/00/si... [Pingback]
"http://duter.homestead.com/00/hotels-in-north-myrtle-beach.html" (http://duter.... [Pingback]
"http://freewebs.com/datingblogger/1265.html" (http://freewebs.com/datingblogger... [Pingback]
"http://freewebs.com/datingblogger/1837.html" (http://freewebs.com/datingblogger... [Pingback]
"http://fasxen.netfirms.com/16.html" (http://fasxen.netfirms.com/16.html) [Pingback]

Computers Blogs - Blog Top Sites

Archive
<January 2009>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567
Blogroll
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2009
Benjamin Rush
Sign In
Statistics
Total Posts: 444
This Year: 0
This Month: 0
This Week: 0
Comments: 128
Themes
Pick a theme:
All Content © 2009, Benjamin Rush
DasBlog theme 'Business' created by Christoph De Baene (delarou)