3.4. Understanding Simple Object Access Protocol and Web Services Basics

Along with using FrontPage RPC Web methods, SharePoint Designer relies on a number of Web methods and functions exposed by SharePoint ASP.NET-based Web Services for the remote authoring of SharePoint sites. SharePoint Designer uses Simple Object Access Protocol (SOAP) to communicate with SharePoint Web Services for performing basic operations on SharePoint sites, including opening Web pages, rendering SharePoint content in the Design view, and implementing advanced features, such as Data Forms and Web Parts.

To be able to understand the background processes involved when working with SharePoint sites in SharePoint Designer, it's important to have some basic understanding of SOAP and ASP.NET Web Services. In this section, I discuss Web Services and SOAP as a communication protocol to converse with Web Services.

3.4.1. Understanding SOAP technology

To put it in simple terms, SOAP allows a client program to remotely execute a method exposed by a Web Service being hosted on a Web server. Unlike the FrontPage RPC methods discussed earlier, the syntax of SOAP-based communication is mostly driven by XML-based messages. These XML messages are sent in the body of the HTTP request to the Web Service on the Web server. The Web Service processes the request based on the information in the HTTP request and formulates an HTML/XML response for use by the client.

Web Services are programs with an .asmx file extension that, once developed by using an application such as Visual Studio, can be installed on the Web server machine to provide the functionality they offer to a Web site. Besides running their isolated server-side tasks, Web Services also provide for a mechanism of Web methods that allows for the invocation of tasks from a remote client. These Web methods are exposed by a Web Service and are discoverable by the client programs by using a Web Services Description Language (WSDL) file.

For example, SharePoint installs a Web Service called Lists.asmx. If you browse to this Web Service in a Web browser (by using the URL http://servername/_vti_bin/lists.asmx), as shown in Figure 3.6, you can see the Web methods that this service exposes.

If you click on any of the Web methods, a sample of the HTTP request and response appears.

Figure 3.6. A description of the Lists.asmx Web Service

3.4.2. Exploring Web Services and Web Methods

When you open a SharePoint site in SharePoint Designer, the client requests a lot of information about the Web site by using a combination of FrontPage RPC methods and SharePoint Web Services. While most of the FrontPage RPC methods are served by the author.dll that SharePoint installs, the Web methods are processed by the corresponding SharePoint Web Service.

To understand the nature of the SOAP HTTP session that SharePoint Designer makes with a SharePoint site, I discuss the GetWebPartPage Web method exposed by the WebPartPages.asmx SharePoint Web Service. This Web method is used when you open a SharePoint Web page for editing in SharePoint Designer. Figure 3.7 shows the HTTP request captured by Fiddler that shows the use of this Web method.

Figure 3.7. The GetWebPartPage SOAP Web method being used by SharePoint Designer

The POST verb is used to post information to the WebPartPages.asmx Web Service:

POST /sites/teamsite/_vti_bin/webpartpages.asmx HTTP/1.1

In the header section is the SOAP action header, which defines the Web method that's being requested for execution by the client:

SOAPAction: http://microsoft.com/sharepoint/webpartpages/
   GetWebPartPage

Later in the body of the HTTP request, the GetWebPartPage Web method was called with the documentName parameter set to default.aspx. This indicates that SharePoint Designer is requesting SharePoint to help it open the default.aspx page for editing:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://
   schemas.xmlsoap.org/soap/envelope/"><soap:Body><GetWebPartPage
   xmlns="http://microsoft.com/sharepoint/webpartpages"><documentNam
   e>default.aspx</documentName></GetWebPartPage></soap:Body></
   soap:Envelope>

The HTTP response to this request has the actual code of the default.aspx page, which is displayed in the Code view of SharePoint Designer and rendered for display in the Design view.

3.4.3. Examining SharePoint Web Services for SharePoint Designer authoring support

SharePoint provides the remote-authoring support for SharePoint sites to SharePoint Designer by using a number of Web Services. While the most used Web Service is WebPartPages.asmx, Table 3.2 lists some of the Web Services that SharePoint Designer uses while working with SharePoint sites.

Table 3.2. SharePoint Web Services for SharePoint Designer Remote Authoring
Web ServiceWeb Method
WebPartPages.asmxProvides a large number of Web methods, such as GetWebPartPage, GetAssemblyMetaInfo, ExecuteProxyUpdates, GetDataFromDataSourceControl, etc. This Web Service provides most of the SharePoint capabilities of SharePoint Designer.
UserGroup.asmxProvides the GetRolesAndPermissionsForCurrentUser method that's used by SharePoint Designer to fetch user permissions from SharePoint
Sites.asmxExposes the GetSiteTemplates used to show the list of available SharePoint site templates in SharePoint Designer
Lists.asmxExposes a number of Web methods for performing various SharePoint lists-related operations

After you become comfortable using Fiddler to understand HTTP requests and responses, you find that many of the SharePoint-related operations of SharePoint Designer use these Web Services. If the Web Services don't properly respond or the HTTP response from SharePoint indicates a failure, SharePoint Designer has no choice but to fail. Understand that these Web methods can help find important clues to troubleshooting SharePoint authoring issues.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.88.241