<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Visual Studio</title>
        <link>http://geekswithblogs.net/rashid/category/6048.aspx</link>
        <description>Visual Studio</description>
        <language>en-US</language>
        <copyright>Kazi Manzur Rashid</copyright>
        <managingEditor>kazimanzurrashid@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Asp.net Ajax and VS2003</title>
            <link>http://geekswithblogs.net/rashid/archive/2007/07/21/Asp.net-Ajax-and-VS2003.aspx</link>
            <description>&lt;p&gt;Few days back one of my of ex-colleague called me to know what is the best platform of Ajax to work in VS2003 Project, One of his client wants to implement some Ajax features in his existing application . Is it &lt;a target="_blank" href="http://ajaxpro.info/"&gt;Ajax.net&lt;/a&gt;, &lt;a target="_blank" href="http://www.prototypejs.org/"&gt;Prototype&lt;/a&gt;, &lt;a target="_blank" href="http://jquery.com/"&gt;jQuery&lt;/a&gt; or &lt;a target="_blank" href="http://dojotoolkit.org/"&gt;Dojo&lt;/a&gt;? When I replied him Asp.net Ajax 1.0, he seems bit confused.  Yes we can also use Asp.net Ajax for the older version of VS. However, we will not get the full set of features in those older environment. Let me list those features, which will not be available:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Cannot use Server Side Controls such as ScriptManager, UpdatePanel, UpdateProgress, AjaxControlToolkit etc. &lt;/li&gt;
    &lt;li&gt;Application Service such as Authentication, Profile will not be available. &lt;/li&gt;
    &lt;li&gt;PageMethod will not be available. &lt;/li&gt;
    &lt;li&gt;There will be no Client Side Proxy for the WebServices. &lt;/li&gt;
    &lt;li&gt;The Data will be always transmitted in Xml not in JSON.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Even those missing features we will still able to use rich set of API which includes:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Base Type Extension &lt;/li&gt;
    &lt;li&gt;Able to Send Request and consume Response to any http endpoint which we see will in later section. &lt;/li&gt;
    &lt;li&gt;Able to use Client Side Components, Extenders and Controls. &lt;/li&gt;
    &lt;li&gt;All other Client Side Library API except &lt;font face="Courier New"&gt;Sys.WebForms&lt;/font&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let us see how to consume a VS2003 Web Service in Asp Ajax Framework. First download the &lt;a target="_blank" href="http://ajax.asp.net/downloads/library/default.aspx?tabid=47&amp;amp;subtabid=471"&gt;Microsoft AJAX Library&lt;/a&gt; which only contains the JavaScript files. Once downloaded add the &lt;font face="Courier New"&gt;MicrosoftAjax.js&lt;/font&gt; in your Web Project and then your pages where you want to implement Ajax. Next add a Web Service in your Web Project. For shake of the simplicity I will create some basic functions. First create a &lt;font face="Courier New"&gt;WebMethod&lt;/font&gt; which returns the Server DateTime like the following:&lt;/p&gt;
&lt;pre class="code"&gt;[&lt;span style="COLOR: rgb(43,145,175)"&gt;WebMethod&lt;/span&gt;]
&lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt; GetCurrentTime()
{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;DateTime&lt;/span&gt;.Now.ToString();
}&lt;/pre&gt;
&lt;p&gt;Now lets see how to call this WebMethod from the JavaScript.&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;function&lt;/span&gt; getServerTime()
{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;var&lt;/span&gt; request = &lt;span style="COLOR: rgb(0,0,255)"&gt;new&lt;/span&gt; Sys.Net.WebRequest();

    request.set_url(&lt;span style="COLOR: rgb(163,21,21)"&gt;'SimpleWebService.asmx/GetCurrentTime'&lt;/span&gt;);
    request.set_httpVerb(&lt;span style="COLOR: rgb(163,21,21)"&gt;'POST'&lt;/span&gt;);
    request.add_completed(onGetServerTimeComplete);
    request.invoke()

    $get(&lt;span style="COLOR: rgb(163,21,21)"&gt;'divTime'&lt;/span&gt;).innerHTML = &lt;span style="COLOR: rgb(163,21,21)"&gt;''&lt;/span&gt;;
}

&lt;span style="COLOR: rgb(0,0,255)"&gt;function&lt;/span&gt; onGetServerTimeComplete(executor, eventArgs)
{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;if&lt;/span&gt; (executor.get_responseAvailable())
    {
        $get(&lt;span style="COLOR: rgb(163,21,21)"&gt;'divTime'&lt;/span&gt;).innerHTML = executor.get_xml().documentElement.firstChild.nodeValue;
    }
}&lt;/pre&gt;
&lt;p&gt;First we are creating a &lt;font face="Courier New"&gt;Sys.WebRequest&lt;/font&gt; object and then we are setting the required properties and events such as the end point (The convention is WebServiceUrl/WebMethod), Http Method Post/Get and finally we are binding &lt;font face="Courier New"&gt;onComplete&lt;/font&gt; Handler. In the &lt;font face="Courier New"&gt;onComplete&lt;/font&gt; Handler we are getting the response from the WebRequest's Executor &lt;font face="Courier New"&gt;xml&lt;/font&gt; Property. The Executer is passed in the onComplete Handler and the &lt;font face="Courier New"&gt;xml&lt;/font&gt; property represents an XML DOM Document. You can get more info on WebRequest and Executor from these links &lt;font face="Courier New" color="#000000"&gt;&lt;a target="_blank" href="http://ajax.asp.net/docs/ClientReference/Sys.Net/WebRequestClass/default.aspx"&gt;WebRequest&lt;/a&gt;&lt;/font&gt; and &lt;font face="Courier New" color="#000000"&gt;&lt;a target="_blank" href="http://ajax.asp.net/docs/ClientReference/Sys.Net/XmlHttpExecutorClass/default.aspx"&gt;Executor&lt;/a&gt;&lt;/font&gt;.&lt;/p&gt;
&lt;p&gt;In this section we will see how to pass parameters in the &lt;font face="Courier New"&gt;WebRequest&lt;/font&gt; object when calling a &lt;font face="Courier New"&gt;WebMethod&lt;/font&gt;, For example if your &lt;font face="Courier New"&gt;WebMethod&lt;/font&gt; is like this:&lt;/p&gt;
&lt;pre class="code"&gt;[&lt;span style="COLOR: rgb(43,145,175)"&gt;WebMethod&lt;/span&gt;]
&lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;bool&lt;/span&gt; IsValidEmails(&lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt; emails)
{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt;[] emailArray = emails.Split(&lt;span style="COLOR: rgb(163,21,21)"&gt;','&lt;/span&gt;);

    &lt;span style="COLOR: rgb(0,0,255)"&gt;for&lt;/span&gt; (&lt;span style="COLOR: rgb(0,0,255)"&gt;int&lt;/span&gt; i = 0; i &amp;lt; emailArray.Length; i++)
    {
        &lt;span style="COLOR: rgb(0,0,255)"&gt;if&lt;/span&gt; ((!emailArray[i].Contains(&lt;span style="COLOR: rgb(163,21,21)"&gt;"@"&lt;/span&gt;)) || (!emailArray[i].Contains(&lt;span style="COLOR: rgb(163,21,21)"&gt;"."&lt;/span&gt;)))
        {
            &lt;span style="COLOR: rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;false&lt;/span&gt;;
        }
    }

    &lt;span style="COLOR: rgb(0,0,255)"&gt;return&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;true&lt;/span&gt;;
}&lt;/pre&gt;
&lt;p&gt;You can call it in JavaScript like the following:&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;function&lt;/span&gt; isValidEmail()
{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;var&lt;/span&gt; requestBody = &lt;span style="COLOR: rgb(163,21,21)"&gt;'emails='&lt;/span&gt; + $get(&lt;span style="COLOR: rgb(163,21,21)"&gt;'txtEmails'&lt;/span&gt;).value;
    &lt;span style="COLOR: rgb(0,0,255)"&gt;var&lt;/span&gt; request = &lt;span style="COLOR: rgb(0,0,255)"&gt;new&lt;/span&gt; Sys.Net.WebRequest();

    request.set_url(&lt;span style="COLOR: rgb(163,21,21)"&gt;'SimpleWebService.asmx/IsValidEmails'&lt;/span&gt;);
    request.set_httpVerb(&lt;span style="COLOR: rgb(163,21,21)"&gt;'POST'&lt;/span&gt;);
    request.set_body(requestBody);
    request.get_headers()[&lt;span style="COLOR: rgb(163,21,21)"&gt;'Content-Length'&lt;/span&gt;] = requestBody.length;
    request.add_completed(onIsValidEmailComplete);
    request.invoke()

    $get(&lt;span style="COLOR: rgb(163,21,21)"&gt;'divResult'&lt;/span&gt;).innerHTML = &lt;span style="COLOR: rgb(163,21,21)"&gt;'Loading'&lt;/span&gt;;
}

&lt;span style="COLOR: rgb(0,0,255)"&gt;function&lt;/span&gt; onIsValidEmailComplete(executor, eventArgs)
{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;if&lt;/span&gt; (executor.get_responseAvailable())
    {
        $get(&lt;span style="COLOR: rgb(163,21,21)"&gt;'divResult'&lt;/span&gt;).innerHTML = executor.get_xml().documentElement.firstChild.nodeValue;
    }
}&lt;/pre&gt;
&lt;p&gt;The only difference this time comparing to first example is we are setting the body of the request where we are are passing the comma separated email addresses. If you have mulitple parameter then append it with &amp;amp; (Ampersand) character in the request body for example param1=value1&amp;amp;param2=value2 etc.&lt;/p&gt;
&lt;p&gt;So far we have seen only intrinsic data type transfer, now lets check how to send and receive complex data types. Lets create a dummy &lt;font face="Courier New"&gt;WebMethod&lt;/font&gt; which returns an array of &lt;font face="Courier New"&gt;Employee&lt;/font&gt; object like this:&lt;/p&gt;
&lt;pre class="code"&gt;[&lt;span style="COLOR: rgb(43,145,175)"&gt;WebMethod&lt;/span&gt;]
&lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;Employee&lt;/span&gt;[] GetEmployees()
{
    &lt;span style="COLOR: rgb(43,145,175)"&gt;ArrayList&lt;/span&gt; list = &lt;span style="COLOR: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;ArrayList&lt;/span&gt;();

    &lt;span style="COLOR: rgb(0,0,255)"&gt;for&lt;/span&gt; (&lt;span style="COLOR: rgb(0,0,255)"&gt;int&lt;/span&gt; i = 1; i &amp;lt; 6; i++)
    {
        &lt;span style="COLOR: rgb(43,145,175)"&gt;Employee&lt;/span&gt; emp = &lt;span style="COLOR: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;Employee&lt;/span&gt;();

        emp.Name = &lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt;.Format(&lt;span style="COLOR: rgb(163,21,21)"&gt;"Employee Name #{0}"&lt;/span&gt;, i);
        emp.Address = &lt;span style="COLOR: rgb(0,0,255)"&gt;string&lt;/span&gt;.Format(&lt;span style="COLOR: rgb(163,21,21)"&gt;"Employee Address #{0}"&lt;/span&gt;, i);
        emp.Salary = i * 10000;

        list.Add(emp);
    }

    &lt;span style="COLOR: rgb(0,0,255)"&gt;return&lt;/span&gt; (&lt;span style="COLOR: rgb(43,145,175)"&gt;Employee&lt;/span&gt;[])list.ToArray(&lt;span style="COLOR: rgb(0,0,255)"&gt;typeof&lt;/span&gt;(&lt;span style="COLOR: rgb(43,145,175)"&gt;Employee&lt;/span&gt;));
}&lt;/pre&gt;
&lt;p&gt;Now call this WebMethod from JavaScript like this:&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;function&lt;/span&gt; getEmployeeList()
{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;var&lt;/span&gt; request = &lt;span style="COLOR: rgb(0,0,255)"&gt;new&lt;/span&gt; Sys.Net.WebRequest();

    request.set_url(&lt;span style="COLOR: rgb(163,21,21)"&gt;'SimpleWebService.asmx/GetEmployees'&lt;/span&gt;);
    request.set_httpVerb(&lt;span style="COLOR: rgb(163,21,21)"&gt;'POST'&lt;/span&gt;);
    request.add_completed(getEmployeeListComplete);
    request.invoke()

    $get(&lt;span style="COLOR: rgb(163,21,21)"&gt;'divList'&lt;/span&gt;).innerHTML = &lt;span style="COLOR: rgb(163,21,21)"&gt;'Loading...'&lt;/span&gt;;
}

&lt;span style="COLOR: rgb(0,0,255)"&gt;function&lt;/span&gt; getEmployeeListComplete(executor, eventArgs)
{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;if&lt;/span&gt; (executor.get_responseAvailable())
    {
        &lt;span style="COLOR: rgb(0,0,255)"&gt;var&lt;/span&gt; xndEmployees = executor.get_xml().documentElement.getElementsByTagName(&lt;span style="COLOR: rgb(163,21,21)"&gt;'Employee'&lt;/span&gt;);

        &lt;span style="COLOR: rgb(0,0,255)"&gt;if&lt;/span&gt; (xndEmployees)
        {
            &lt;span style="COLOR: rgb(0,0,255)"&gt;var&lt;/span&gt; output = &lt;span style="COLOR: rgb(163,21,21)"&gt;''&lt;/span&gt;;

            &lt;span style="COLOR: rgb(0,0,255)"&gt;if&lt;/span&gt; (xndEmployees.length &amp;gt; 0)
            {
                &lt;span style="COLOR: rgb(0,0,255)"&gt;for&lt;/span&gt;(&lt;span style="COLOR: rgb(0,0,255)"&gt;var&lt;/span&gt; i = 0; i &amp;lt; xndEmployees.length;i++)
                {
                    &lt;span style="COLOR: rgb(0,0,255)"&gt;var&lt;/span&gt; emp = &lt;span style="COLOR: rgb(0,0,255)"&gt;new&lt;/span&gt; Employee(xndEmployees[i]);
                    output += emp.Name + &lt;span style="COLOR: rgb(163,21,21)"&gt;':'&lt;/span&gt; + emp.Address + &lt;span style="COLOR: rgb(163,21,21)"&gt;':'&lt;/span&gt; + emp.Salary + &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;br/&amp;gt;'
&lt;/span&gt;                }
            }

            $get(&lt;span style="COLOR: rgb(163,21,21)"&gt;'divList'&lt;/span&gt;).innerHTML = output;
        }
    }
}

&lt;span style="COLOR: rgb(0,0,255)"&gt;function&lt;/span&gt; Employee(xndEmployee)
{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;this&lt;/span&gt;.Name = xndEmployee.getElementsByTagName(&lt;span style="COLOR: rgb(163,21,21)"&gt;'Name'&lt;/span&gt;)[0].firstChild.nodeValue;
    &lt;span style="COLOR: rgb(0,0,255)"&gt;this&lt;/span&gt;.Address = xndEmployee.getElementsByTagName(&lt;span style="COLOR: rgb(163,21,21)"&gt;'Address'&lt;/span&gt;)[0].firstChild.nodeValue;
    &lt;span style="COLOR: rgb(0,0,255)"&gt;this&lt;/span&gt;.Salary = parseFloat(xndEmployee.getElementsByTagName(&lt;span style="COLOR: rgb(163,21,21)"&gt;'Salary'&lt;/span&gt;)[0].firstChild.nodeValue);
}&lt;/pre&gt;
&lt;p&gt;The real difference between handling the complex object is that we have to roll our own logic converting to custom object from the xml response like the above. &lt;/p&gt;
&lt;p&gt;In this section we will check how to send a complex object in Asp.net Ajax. Lets create another dummy method which takes an employee object and returns a new id for that employee, like this:&lt;/p&gt;
&lt;pre class="code"&gt;[&lt;span style="COLOR: rgb(43,145,175)"&gt;WebMethod&lt;/span&gt;]
&lt;span style="COLOR: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="COLOR: rgb(0,0,255)"&gt;int&lt;/span&gt; CreateEmployee(&lt;span style="COLOR: rgb(43,145,175)"&gt;Employee&lt;/span&gt; employee)
{
    &lt;span style="COLOR: rgb(0,128,0)"&gt;//Store it in DB
&lt;/span&gt;    &lt;span style="COLOR: rgb(0,0,255)"&gt;int&lt;/span&gt; id = (&lt;span style="COLOR: rgb(0,0,255)"&gt;new&lt;/span&gt; &lt;span style="COLOR: rgb(43,145,175)"&gt;Random&lt;/span&gt;()).Next(1000, 10000);
    &lt;span style="COLOR: rgb(0,0,255)"&gt;return&lt;/span&gt; id;
}&lt;/pre&gt;
&lt;p&gt;Now lets see how to call this method in JavaScript:&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="COLOR: rgb(0,0,255)"&gt;function&lt;/span&gt; createEmployee()
{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;var&lt;/span&gt; requestBody =   &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;?xml version=\"1.0\" encoding=\"utf-8\"?&amp;gt;'&lt;/span&gt; +
                        &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"&amp;gt;'&lt;/span&gt; +
                          &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;soap:Body&amp;gt;'&lt;/span&gt; +
                            &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;CreateEmployee xmlns=\"http://tempuri.org/\"&amp;gt;'&lt;/span&gt; +
                              &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;employee&amp;gt;'&lt;/span&gt; +
                                &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;Name&amp;gt;'&lt;/span&gt; + &lt;span style="COLOR: rgb(163,21,21)"&gt;'Joe Doe'&lt;/span&gt; + &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;/Name&amp;gt;'&lt;/span&gt; +
                                &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;Address&amp;gt;'&lt;/span&gt; + &lt;span style="COLOR: rgb(163,21,21)"&gt;'Nowhere'&lt;/span&gt; + &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;/Address&amp;gt;'&lt;/span&gt; +
                                &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;Salary&amp;gt;'&lt;/span&gt; + &lt;span style="COLOR: rgb(163,21,21)"&gt;'25000'&lt;/span&gt; + &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;/Salary&amp;gt;'&lt;/span&gt; +
                              &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;/employee&amp;gt;'&lt;/span&gt; +
                            &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;/CreateEmployee&amp;gt;'&lt;/span&gt; +
                          &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;/soap:Body&amp;gt;'&lt;/span&gt; +
                        &lt;span style="COLOR: rgb(163,21,21)"&gt;'&amp;lt;/soap:Envelope&amp;gt;'&lt;/span&gt;;

    &lt;span style="COLOR: rgb(0,0,255)"&gt;var&lt;/span&gt; request = &lt;span style="COLOR: rgb(0,0,255)"&gt;new&lt;/span&gt; Sys.Net.WebRequest();

    request.set_url(&lt;span style="COLOR: rgb(163,21,21)"&gt;'SimpleWebService.asmx'&lt;/span&gt;);
    request.set_httpVerb(&lt;span style="COLOR: rgb(163,21,21)"&gt;'POST'&lt;/span&gt;);
    request.set_body(requestBody);
    request.get_headers()[&lt;span style="COLOR: rgb(163,21,21)"&gt;'Content-Length'&lt;/span&gt;] = requestBody.length;
    request.get_headers()[&lt;span style="COLOR: rgb(163,21,21)"&gt;'SOAPAction'&lt;/span&gt;] = &lt;span style="COLOR: rgb(163,21,21)"&gt;'http://tempuri.org/CreateEmployee'&lt;/span&gt;;
    request.get_headers()[&lt;span style="COLOR: rgb(163,21,21)"&gt;'Content-Type'&lt;/span&gt;] = &lt;span style="COLOR: rgb(163,21,21)"&gt;'text/xml; charset=utf-8'&lt;/span&gt;;
    request.add_completed(onCreateEmployeeComplete);
    request.invoke()

    $get(&lt;span style="COLOR: rgb(163,21,21)"&gt;'divID'&lt;/span&gt;).innerHTML = &lt;span style="COLOR: rgb(163,21,21)"&gt;'Loading..'&lt;/span&gt;;
}

&lt;span style="COLOR: rgb(0,0,255)"&gt;function&lt;/span&gt; onCreateEmployeeComplete(executor, eventArgs)
{
    &lt;span style="COLOR: rgb(0,0,255)"&gt;if&lt;/span&gt; (executor.get_responseAvailable())
    {
        &lt;span style="COLOR: rgb(0,0,255)"&gt;var&lt;/span&gt; xndResult = executor.get_xml().documentElement.getElementsByTagName(&lt;span style="COLOR: rgb(163,21,21)"&gt;'CreateEmployeeResult'&lt;/span&gt;);

        $get(&lt;span style="COLOR: rgb(163,21,21)"&gt;'divID'&lt;/span&gt;).innerHTML = xndResult[0].firstChild.nodeValue;
    }
}&lt;/pre&gt;
&lt;p&gt;As you can see there are quite bit of difference in this case, first we are constructing a Soap Message, next in the url we are not specifying the &lt;font face="Courier New"&gt;WebMethod&lt;/font&gt; name instead we are specifying the &lt;font face="Courier New"&gt;WebMethod&lt;/font&gt; name by adding a new header &lt;font face="Courier New"&gt;SOAPAction&lt;/font&gt;, we are also adding a new header for the request content type which is &lt;font face="Courier New"&gt;text/xml&lt;/font&gt;.&lt;/p&gt;
&lt;p&gt;In conclusion, I would like to say that main advantage of implementing Asp.net Ajax Library in older VS projects is that we can easily employ our existing knowledge of Asp.net Ajax, no need to learn any new framework and later on If we decide to upgrade our project in VS2005 or maybe VS2008 we can easily do that without breaking a single line of code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Download&lt;/strong&gt;: &lt;a target="_blank" href="http://www.box.net/shared/gefmkxmjgm"&gt;Complete Code&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a target="_blank" href="http://www.dotnetkicks.com/kick/?url=http://geekswithblogs.net/rashid/archive/2007/07/21/Asp.net-Ajax-and-VS2003.aspx"&gt;&lt;img alt="kick it on DotNetKicks.com" border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://geekswithblogs.net/rashid/archive/2007/07/21/Asp.net-Ajax-and-VS2003.aspx" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=114089"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=114089" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/rashid/aggbug/114089.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Kazi Manzur Rashid</dc:creator>
            <guid>http://geekswithblogs.net/rashid/archive/2007/07/21/Asp.net-Ajax-and-VS2003.aspx</guid>
            <pubDate>Sat, 21 Jul 2007 07:07:57 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/rashid/comments/114089.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/rashid/archive/2007/07/21/Asp.net-Ajax-and-VS2003.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/rashid/comments/commentRss/114089.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/rashid/services/trackbacks/114089.aspx</trackback:ping>
        </item>
        <item>
            <title>My First Article</title>
            <link>http://geekswithblogs.net/rashid/archive/2007/01/14/103526.aspx</link>
            <description>&lt;p&gt;Recently I wrote an article &lt;a href="http://www.codeproject.com/useritems/SecureDataExchange.asp" target="_blank"&gt;"How to exchange data securely with a WebService without HTTPS/SSL"&lt;/a&gt; in &lt;a href="http://www.codeproject.com" target="_blank"&gt;codeproject&lt;/a&gt;. If Cryptography, Public/Private Key, Digital Signature and Web Service are one of your interest, I strongly recommend to read it.&lt;/p&gt; &lt;p&gt;&lt;a target="_blank" href="http://www.dotnetkicks.com/kick/?url=http://www.codeproject.com/useritems/SecureDataExchange.asp"&gt;&lt;img alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.codeproject.com/useritems/SecureDataExchange.asp" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=103526"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=103526" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/rashid/aggbug/103526.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Kazi Manzur Rashid</dc:creator>
            <guid>http://geekswithblogs.net/rashid/archive/2007/01/14/103526.aspx</guid>
            <pubDate>Sat, 13 Jan 2007 18:14:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/rashid/comments/103526.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/rashid/archive/2007/01/14/103526.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/rashid/comments/commentRss/103526.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/rashid/services/trackbacks/103526.aspx</trackback:ping>
        </item>
        <item>
            <title>Posting Code in Blog</title>
            <link>http://geekswithblogs.net/rashid/archive/2007/01/13/103519.aspx</link>
            <description>&lt;p&gt;After struggling for two hours, finally I am able to post codes in my blog. All you need is to install &lt;a target="_blank" href="http://windowslivewriter.spaces.live.com/"&gt;window live writer&lt;/a&gt; and small plugin-&lt;a target="_blank" href="http://gallery.live.com/liveItemDetail.aspx?li=d8835a5e-28da-4242-82eb-e1a006b083b9&amp;amp;l=8"&gt;Paste from Visual Studio&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=103519"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=103519" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/rashid/aggbug/103519.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Kazi Manzur Rashid</dc:creator>
            <guid>http://geekswithblogs.net/rashid/archive/2007/01/13/103519.aspx</guid>
            <pubDate>Sat, 13 Jan 2007 17:44:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/rashid/comments/103519.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/rashid/archive/2007/01/13/103519.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/rashid/comments/commentRss/103519.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/rashid/services/trackbacks/103519.aspx</trackback:ping>
        </item>
    </channel>
</rss>