Web service calls from javascript using ATLAS (part 1)

ATLAS provides a fantastic mechanism for making web service calls from javascript code.

Take the simple web service below...

public class myWebService : System.Web.Services.WebService
    public myWebService () {

    public string myWebMethod() {
        return "Hello World";

You need to add reference to this web service to your ASP.NET page. This is achieved using the ScriptManager tag as in the example below...

<atlas:ScriptManager ID="myScriptManager" runat="server" EnablePartialRendering="true" >  
    <atlas:ServiceReference Path="~/myWebServiceURL.asmx" />    

Infact only the Services and ServiceReference elements are added to the basic scriptManager tag. Note taht there seems to be a limitation in the CTP that I am using where the web service needs to be in the same web site as your project. This is a serious limitation but it shouldn't be too hard to create a proxy for any web service runing elsewhere until this is fixed in the next CTP.

You can now make JavaScript calls to the web service as shown below...

<SCRIPT language='javascript'>

  function myWebMethod_callback(result)

I hope you find the example useful in your own applications.

Author Dave Howard

I have been involved in IT development for the last 10 years - a lot of it around desktop applications and telecoms.

Add Comment


Your comment has been received and will be shown once it passes moderation.