<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Justin Smith's Blog : ASP.NET AJAX</title><link>http://blogs.msdn.com/justinjsmith/archive/tags/ASP.NET+AJAX/default.aspx</link><description>Tags: ASP.NET AJAX</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>enableWebScript, UriTemplate, and HTTP methods</title><link>http://blogs.msdn.com/justinjsmith/archive/2008/02/15/enablewebscript-uritemplate-and-http-methods.aspx</link><pubDate>Sat, 16 Feb 2008 02:55:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7724901</guid><dc:creator>justinjsmith</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/justinjsmith/comments/7724901.aspx</comments><wfw:commentRss>http://blogs.msdn.com/justinjsmith/commentrss.aspx?PostID=7724901</wfw:commentRss><wfw:comment>http://blogs.msdn.com/justinjsmith/rsscomments.aspx?PostID=7724901</wfw:comment><description>&lt;p&gt;A little while ago I ran into an interesting set of errors that may be of interest to you. Consider the following service contract snippet:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;[OperationContract]
[WebGet(UriTemplate=&lt;span class="str"&gt;&amp;quot;foobar/{value}&amp;quot;&lt;/span&gt;)]
&lt;span class="kwrd"&gt;String&lt;/span&gt; GetData(String &lt;span class="kwrd"&gt;value&lt;/span&gt;);&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;If you add the enableWebScript behavior to an endpoint that is using the WebHttpBinding, you will see this exception when the ServiceHost starts:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;System.InvalidOperationException: Endpoints using 'UriTemplate' cannot be used with 'System.ServiceModel.Description.WebScriptEnablingBehavior'.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The reason for this error is rooted in the origin of the enableWebScript behavior. One of it's design objectives was to simplify working with the ASP.NET AJAX stack (Javascript proxy, JSON messages, etc). The AJAX stack doesn't have the equivalent of the UriTempalte type. It simply puts parameters in query strings (gets) and constructs entity bodies (posts). This is the default behavior of the WCF stack when the WebGet / WebInvoke annotations do not have a value for UriTemplate. Since any value of UriTemplate would be incompatible with the ASP.NET AJAX stack, we throw when it's present.&lt;/p&gt;

&lt;p&gt;If you want JSON messages from a contract and you want to use the UriTemplate niceness, you can change your contract to:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;[OperationContract]
[WebGet(UriTemplate=&lt;span class="str"&gt;&amp;quot;foobar/{value}&amp;quot;&lt;/span&gt;, ResponseFormat=WebMessageFormat.Json)]
&lt;span class="kwrd"&gt;String&lt;/span&gt; GetData(S&lt;span class="kwrd"&gt;tring&lt;/span&gt; &lt;span class="kwrd"&gt;value&lt;/span&gt;);&lt;/pre&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Then, instead of using the enableWebScript behavior, use the WebHttpBehavior. You'll lose compat with the ASP.NET AJAX client stack (and the JS proxy), but you have the URI you are looking for.&lt;/p&gt;

&lt;p&gt;The same is true if you are using the WebInvoke attribute and any HTTP method other than POST. The AJAX client stack only knows GET and POST...&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7724901" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/justinjsmith/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/justinjsmith/archive/tags/REST/default.aspx">REST</category><category domain="http://blogs.msdn.com/justinjsmith/archive/tags/Web+Programming+with+WCF/default.aspx">Web Programming with WCF</category><category domain="http://blogs.msdn.com/justinjsmith/archive/tags/JSON/default.aspx">JSON</category><category domain="http://blogs.msdn.com/justinjsmith/archive/tags/ASP.NET+AJAX/default.aspx">ASP.NET AJAX</category></item><item><title>WCF, ASP.NET AJAX, and JavaScript Proxies</title><link>http://blogs.msdn.com/justinjsmith/archive/2007/07/23/wcf-asp-net-ajax-and-javascript-proxies.aspx</link><pubDate>Tue, 24 Jul 2007 07:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:4021518</guid><dc:creator>justinjsmith</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/justinjsmith/comments/4021518.aspx</comments><wfw:commentRss>http://blogs.msdn.com/justinjsmith/commentrss.aspx?PostID=4021518</wfw:commentRss><wfw:comment>http://blogs.msdn.com/justinjsmith/rsscomments.aspx?PostID=4021518</wfw:comment><description>&lt;P&gt;I spent this weekend tinkering around with the JSON messaging capabilities of WCF new in the .NET Framework 3.5 (Orcas). The object model is changing substantially between Beta1 and Beta2, and I think the changes make for an easier to use system.&lt;/P&gt;
&lt;P&gt;To better understand the JSON messaging features of WCF, check out some of the general requirements they were built to:&lt;/P&gt;
&lt;P&gt;1) Config-free deployment for JSON endpoints&lt;/P&gt;
&lt;P&gt;2) ASP.NET AJAX developer experience consistent with ASMX endpoints&lt;/P&gt;
&lt;P&gt;3) Give service developers the same WCF developer experience as WCF v1&lt;/P&gt;
&lt;P&gt;I am sure there were more, but these were the big ones related to developer experience.&lt;/P&gt;
&lt;P&gt;Now, lets look at some code. A good place to start is the contract.&lt;/P&gt;
&lt;H3&gt;The Service&amp;nbsp;Contract&lt;/H3&gt;
&lt;DIV class=wlWriterSmartContent id=57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:2e6aa3e9-cad1-4bf3-8bc2-eacf16ad5ca3 contentEditable=false style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;&lt;PRE style="BACKGROUND-COLOR: white"&gt;&lt;DIV&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;SPAN style="COLOR: #000000"&gt;[ServiceContract]
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;interface&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; IWCFAjaxService {
    [OperationContract]
    [WebInvoke(Method &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;POST&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;, UriTemplate &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;ShowServerDate&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;)]
    String ShowServerDate();
}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;The only thing that is different in this contract from a WCF contract from WCF v1 is the presence of the WebInvoke attribute. Simply put (almost pun intended), this attribute indicates that the operation will be accessible via the HTTP verb indicated by the Method instance property. In this case, the HTTP verb is POST.&lt;/P&gt;
&lt;H4&gt;The Service Type&lt;/H4&gt;
&lt;P&gt;This is pretty straightforward, so I'll just show it for completeness:&lt;/P&gt;
&lt;DIV class=wlWriterSmartContent id=57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:ece75418-9fbe-48c4-9fae-ddb454942fda contentEditable=false style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;&lt;PRE style="BACKGROUND-COLOR: white"&gt;&lt;DIV&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;class&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; WCFAjaxService : IWCFAjaxService {
    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;public&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;string&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; ShowServerDate()    {
        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;return&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt; DateTime.Now.ToString();
    }
}
&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;H4&gt;The SVC file&lt;/H4&gt;
&lt;P&gt;SVC files are an activation target for WCF services hosted in IIS. Since this example is showing a web page that calls a WCF service, IIS is the natural host.&amp;nbsp;The svc file is simple:&lt;/P&gt;
&lt;DIV class=wlWriterSmartContent id=57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:5ff3a33e-a12e-4e44-9145-c06e9b8c55b5 contentEditable=false style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;&lt;PRE style="BACKGROUND-COLOR: white; WORD-WRAP: break-word"&gt;&lt;DIV&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #ffff00"&gt;&amp;lt;%&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;@ ServiceHost Language&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;C#&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; Debug&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;true&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; Service&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;WCFAjaxService&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; Factory&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;System.ServiceModel.Activation.WebScriptServiceHostFactory&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #ffff00"&gt;%&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;Notice the presence of the Factory part of the directive. This indicates that the ServiceHostFactory to be used is the WebScriptServiceHostFactory. This is a new type that ships with .NET Framework 3.5.&amp;nbsp;It creates a ServiceHost that has the right endpoint (behaviors, binding, etc) that will work for AJAX integration.&lt;/P&gt;
&lt;H4&gt;The ASPX file&lt;/H4&gt;
&lt;DIV class=wlWriterSmartContent id=57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:c72788c3-043d-4a04-a1c9-5d8aa669eee4 contentEditable=false style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;&lt;PRE style="BACKGROUND-COLOR: white"&gt;&lt;DIV&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;SPAN style="COLOR: #008080"&gt; 1&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #ffff00"&gt;&amp;lt;%&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;@ Page Language&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;C#&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; AutoEventWireup&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;true&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; CodeFile&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;Default.aspx.cs&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; Inherits&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;_Default&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #ffff00"&gt;%&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt; 2&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt; 3&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;!&lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff00ff"&gt;DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt; 4&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff00ff"&gt;                    Transitional//EN" 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt; 5&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff00ff"&gt;                    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt; 6&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;html &lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt;xmlns&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="http://www.w3.org/1999/xhtml"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt; 7&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;head &lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt;id&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="Head1"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt; runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="server"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt; 8&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;title&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;WCF Ajax Demo&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;title&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt; 9&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;10&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;script &lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt;type&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="text/javascript"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;11&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;    
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;12&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;      &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5"&gt;function&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; GetServerTime(){
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;13&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5"&gt;var&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; proxy &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5"&gt;new&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; tempuri.org.IWCFAjaxService();
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;14&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;        proxy.ShowServerDate(OnSucceeded, &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5"&gt;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;, &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5"&gt;null&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;);
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;15&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;      }
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;16&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;  
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;17&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;      &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5"&gt;function&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; OnSucceeded(result)
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;18&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;      {
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;19&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5"&gt;var&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; RsltElem &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; document.getElementById(&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;Results&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;);
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;20&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;        RsltElem.innerHTML &lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; result;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;21&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;      }
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;22&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;    
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;23&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;script&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;24&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;25&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;head&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;26&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;body&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;27&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;form &lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt;id&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="form1"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt; runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="server"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;28&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;29&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;asp:ScriptManager &lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="scriptManager"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt; runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="server"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;30&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;            &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;Services&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;31&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;                &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;asp:ServiceReference &lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt;Path&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="~/Service.svc"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;32&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;            &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;Services&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;33&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;asp:ScriptManager&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;34&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;h2&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;35&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;            Server Time&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;h2&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;36&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;p&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;37&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;            Calling a service that returns the current server time.&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;p&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;38&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;input &lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt;id&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="DateButton"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt; type&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="button"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt; value&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="GetTime"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt; 
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;39&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;                   onclick&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="GetServerTime()"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;40&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;41&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;42&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;br &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;43&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;        &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;span &lt;/SPAN&gt;&lt;SPAN style="COLOR: #ff0000"&gt;id&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="Results"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;span&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;44&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;45&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;    &lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;form&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;46&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;body&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;47&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;html&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #000000"&gt;
&lt;/SPAN&gt;&lt;SPAN style="COLOR: #008080"&gt;48&lt;/SPAN&gt; &lt;SPAN style="COLOR: #000000"&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/PRE&gt;&lt;/DIV&gt;The important parts of this code snippet are lines 29-33 (ScriptManager) and lines 12-15 (proxy call). In you are new to AJAX development, I encourage you to visit &lt;A href="http://www.asp.net/" mce_href="http://www.asp.net"&gt;http://www.asp.net&lt;/A&gt; for more info. 
&lt;P&gt;The ScriptManager is the main integration point for web services and ASP.NET AJAX. Adding a Service node in the Services collection will create a JavaScript proxy, and you can all that JavaScript proxy from other functions in your page.&lt;/P&gt;
&lt;H4&gt;See the JavaScript Proxy&lt;/H4&gt;
&lt;P&gt;When I first tackled this, I could not get the proxy to generate, and I could not seem to find out the name of the proxy. The trick is to navigate to the svc url, then add a JS to the URL.&lt;/P&gt;
&lt;P&gt;If your starting URL is &lt;A href="http://localhost/WCFAjaxService/Service.svc" mce_href="http://localhost/WCFAjaxService/Service.svc"&gt;http://localhost/WCFAjaxService/Service.svc&lt;/A&gt;, then the JavaScript proxy URL is &lt;A href="http://localhost/WCFAjaxService/Service.svc/js" mce_href="http://localhost/WCFAjaxService/Service.svc/js"&gt;http://localhost/WCFAjaxService/Service.svc/js&lt;/A&gt;. When you download that file, you'll see that the name of the proxy follows the naming convention of your service contract's XML namespace (hence tempuri.org in lines 12-15)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;The complete sample is below.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=4021518" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/justinjsmith/attachment/4021518.ashx" length="4352" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/justinjsmith/archive/tags/Orcas/default.aspx">Orcas</category><category domain="http://blogs.msdn.com/justinjsmith/archive/tags/WCF/default.aspx">WCF</category><category domain="http://blogs.msdn.com/justinjsmith/archive/tags/.NET+Framework+3.5/default.aspx">.NET Framework 3.5</category><category domain="http://blogs.msdn.com/justinjsmith/archive/tags/REST/default.aspx">REST</category><category domain="http://blogs.msdn.com/justinjsmith/archive/tags/Web+Programming+with+WCF/default.aspx">Web Programming with WCF</category><category domain="http://blogs.msdn.com/justinjsmith/archive/tags/JSON/default.aspx">JSON</category><category domain="http://blogs.msdn.com/justinjsmith/archive/tags/ASP.NET+AJAX/default.aspx">ASP.NET AJAX</category></item></channel></rss>