Dotnetnuke Services Framework and AjaxWebLinks


The good people at Dotnetnuke have release a new ctp which allows module developers to add external api to their modules. You can view the announcement made by Bob Kruger here and a short tutorial from Scott Schlesier here.

I created a branch of my AjaxWebLinks sample module based on asmx webservices and converted it to use the new framework. I think there are some things that can be improved but my overall experience has been good so far. I like the fact that the services work without any sort of registration. When the Dotnetnuke application starts it searches for all classes which implement the special routing interface and registers the routes to the services.

One thing that wasn’t mentioned in the tutorial (or I somehow missed it) is your request requires a “TabId” and a “ModuleId” header to check permissions successfully.

Here is a sample Ajax request from my converted module:

   $.ajax({
        type: "POST",
        beforeSend: function (xhr) {
            xhr.setRequestHeader("ModuleId", AjaxWebLinksModuleID);
            xhr.setRequestHeader("TabId", AjaxWebLinksTabID);
        },
        
        url: "/DesktopModules/AjaxWebLinks/API/Handler/GetLinks",
        data: {},
        dataType: "json",
        success: function (data) {
           

        },
        error: function () {
            
        }
    });

Download the sample module and source here

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s