Click here to Skip to main content
12,758,605 members (34,274 online)
Click here to Skip to main content
Articles » Web Development » Ajax » Samples » Downloads


20 bookmarked
Posted 17 Mar 2008

ASP.NET 3.5, AJAX, and Web Services

, 17 Mar 2008 CPOL
This article explains how to call Web Service methods using AJAX client script.
using System;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml;
using System.Web.Script.Services;

namespace AjaxWebService

    [WebService(Namespace = "http://localhost:49232/AjaxWebService/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class Service : System.Web.Services.WebService
        string myXmlData = @"<?xml version=""1.0"" encoding=""utf-8"" ?>
                    <Title>Programming ASP.NET 3.5, AJAX and Web Services</Title>
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public string getNextBackupDate(int months)
            return DateTime.Now.AddMonths(months).ToShortDateString();
        [ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
        public XmlDocument GetBookTitle()
            XmlDocument xmlDoc = new XmlDocument();
            return xmlDoc;
        [ScriptMethod(UseHttpGet = true)]
        public string HelloWorld()
            return "Hello, world";


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Balamurali Balaji
Founder BB Systems CIT-GPNP
India India
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170217.1 | Last Updated 18 Mar 2008
Article Copyright 2008 by Balamurali Balaji
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid