Integrating with SharePoint by Using Windows Azure
AppFabric
There are several ways of remotely interacting with Microsoft
SharePoint—two of which are being discussed with increasing frequency
in developer circles. One way is to use Microsoft Forefront Unified
Access Gateway (UAG) and forms-based authentication to interact remotely with a
SharePoint site. There is some trickery here with the security handshake with this solution.
You can use the Windows Azure AppFabric service bus to connect
services deployed to Windows Azure (or the cloud in general) so that
they can access and interact with SharePoint. Interacting with
SharePoint can mean reading and writing list data, updating site
information, or creating new sites or content types in SharePoint (or
literally anything you can do with the SharePoint APIs). One way to do
this is by creating an application that executes code against
SharePoint; for example, a Windows Communication Foundation (WCF)
service that resides and executes on the same server (or a connected
edge server) where SharePoint resides. You access this WCF service
code in a secure way by communicating with the service endpoint
directly. This lets you provide a bridge between a cloud-deployed
service and this on-premises application that connects you to
SharePoint.
As an example of this, Figure 1 shows a
remote application accessing a WCF service that is
deployed to Windows Azure. This service then accesses a locally
deployed service (deployed on the SharePoint server) which interacts
with the SharePoint site via the AppFabric service bus. The remote
application could include any number of client applications, such as
Windows Forms applications, Microsoft Silverlight applications, PHP or
Java applications, or Windows Phone 7 (or other phone or device)
applications.
You’ll build an application within this
architecture. You’ll do it in steps rather than all at once, because
Windows Azure AppFabric can be more complex than its
Windows Azure counterparts. The steps you’ll follow will create a
Windows Phone 7 application that will access SharePoint on-premises
list data via the AppFabric service bus. These steps are:
-
Create a service namespace in Windows Azure AppFabric. This
is a unique namespace that you’ll use to connect your two service
endpoints. You’ll use the generic security features of the
namespace (token and shared secret) to secure the connection.
-
Create an on-premises service that can be called from a
remote, cloud-based service. This service executes code against
the SharePoint site. You’ll also create a second on-premises
service to initially test the connection.
-
Create a remote, cloud-deployed WCF service that uses the
AppFabric service bus to interact with SharePoint.
-
Finally, you’ll create two remote client applications. One
is a Windows Forms test application that resides on the same
server. The other is a Windows Phone 7 application, which resides
on a separate client machine and represents a truly remote
application.
Create a Service Bus Namespace
-
Open your browser and navigate to https://windows.azure.com/Default.aspx.
On the left side of the Windows Azure portal, you’ll see
several options you can choose.
-
Click Service Bus, Access Control & Caching as shown
in the following graphic.
-
This displays the Windows Azure AppFabric page, which you
can use to create a new namespace. To do this, click the Service
Bus option (underneath AppFabric) as per the following figure,
and then click New Namespace.
-
This Invokes a new dialog box in which you can provide a
name for your service (such as servicebusexample), a region, and then
the number of connection packs (Connection Pack Size), as shown
in the following graphic. Click Create Namespace to create the
service bus namespace.
You now have a new service namespace that you can use to
connect your WCF service endpoints. As shown in the following
graphic, after you create the new namespace you’ll see your key
name, management key, and service bus endpoints in the main
Windows Azure portal. You can also click the View button to see
the hidden token and key—which is the information you’ll use to
connect your service endpoints.
You can move on to something slightly trickier: connecting two
service endpoints together using the AppFabric service bus. With the
service bus namespace in place, you have the core connection piece
that bridges your service endpoints, so in the next exercise, you’ll
create two services that communicate with one another via your newly
created service namespace—that is, the AppFabric service bus.