Calling a WebService (from JavaScript) with Atlas

This is too easy and damn powerful! WebServices can be called from JavaScript directly once the service is registered in the Script Manager.

Script Manager

Add your service to the manager as seen below:

<atlas:ScriptManager runat="server" ID="sb1" EnablePartialRendering="true" >
    <Services>
        <atlas:ServiceReference Path="~/YourService.asmx" />
    </Services>
</atlas:ScriptManager>

JavaScript

Once the ScriptManager has discovered the web service, it creates all the objects for you..

<script language="javascript">
//<!--
function callYourService(){

    // call ClassName.MethodName();
    YourService.HelloWorld();

}
//-->
</script>

The above example is a very simple one.. It is possible to return an AtlasDataSet or your own object.

Author Paul Hayman

Paul is the COO of kwiboo ltd and has more than 20 years IT consultancy experience. He has consulted for a number of blue chip companies and has been exposed to the folowing sectors: Utilities, Telecommunications, Insurance, Media, Investment Banking, Leisure, Legal, CRM, Pharmaceuticals, Interactive Gaming, Mobile Communications, Online Services.

Paul is the COO and co-founder of kwiboo (http://www.kwiboo.com/) and is also the creator of GeekZilla.

Add Comment

Name
Comment
 

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