Consuming a Windows Azure-Hosted WCF Service from SharePoint 2010 Using JQuery

Version: 1.0

Description

Any SharePoint Web Part that uses HTML and JavaScript (Ex: HTML forms Web Part or a Visual Web Part) make it easy to consume WCF services using JQuery , including those hosted in Windows Azure, from SharePoint. A Silverlight Web Part may also consume a WCF service by using the HTML DOM Bridge. With this approach, Silverlight Web Parts send and receive data to the hosting SharePoint page. The hosting SharePoint page uses JQuery to communicate with the WCF services. In this lab, you will create a simple WCF service and deploy it to Windows Azure and create a HTML application which consumes the WCF service and deploy it to a SharePoint site as an HTML forms Web Part.

Overview

Any SharePoint Web Part that uses HTML and JavaScript (Ex: HTML forms Web Part or a Visual Web Part) make it easy to consume WCF services using JQuery , including those hosted in Windows Azure, from SharePoint. A Silverlight Web Part may also consume a WCF service by using the HTML DOM Bridge. With this approach, Silverlight Web Parts send and receive data to the hosting SharePoint page. The hosting SharePoint page uses JQuery to communicate with the WCF services.

Objectives

In this lab, you will:

  • Create a simple WCF service and deploy it to Windows Azure.
  • Create a HTML application which consumes the WCF service and deploy it to a SharePoint site as an HTML forms Web Part.

System Requirements

You must have the following items to complete this lab:

Setup

The Windows Azure SDK (included in Windows Azure Tools for Visual Studio) installs a simulation environment on your development machine for testing Azure applications locally before deploying them to the cloud. The simulation environment consists of the development fabric to host web and worker roles, and the development storage which simulates cloud blob, table and queue storage locally.

Development storage uses SQL Server as its underlying storage mechanism, and by default the SDK will attempt to configure it to use SQL Server Express. If you do not have SQL Server Express installed before installing the SDK, or you wish to simply use an existing SQL Server instance to host the development storage database, you must run the dsinit command to select the SQL Server instance where the database will be created.

Please see instructions below for how to run dsinit.

Using dsinit to Configure Development Storage

  1. Open a command prompt.
  2. Edit the following command line as appropriate for your environment, where [AzureSDKInstallDrive] is the drive where you installed the Azure SDK (or Windows Azure Tools for Visual Studio), and [YourSqlInstance] is the SqlServer where you want to create the development storage database.
  3. [AzureSDKInstallDrive]\ Program Files\Windows Azure SDK\v1.4\bin\devstore\dsinit.exe /sqlinstance:[YourSqlInstance]Example Command Line:“C:\Program Files\Windows Azure SDK\v1.4\bin\devstore\dsinit.exe” /sqlinstance:.
  4. Note that the sample command line above uses the value “.” for the sqlinstance argument, which specifies that the local default SQL instance will be used for development storage.

Estimated time to complete this lab: 20 minutes