Creating the ASP.NET Web Service
We will now create an ASP.NET Web service (.asmx
) to encapsulate our Web methods. The first Web method, GetPosting()
, will return a serialized LightweightPosting
object and during serialization the properties and public fields will be serialized and nested in the XML. The second Web method, SavePosting()
, will accept a LightweightPosting
and call the Save()
method to update MCMS.
To create the ASP.NET Web service, perform the following steps:
1. In Visual Studio .NET, right-click on the
McmsAuthoringWebService
project and select Add | Add Web Service.2. Name this Web service
Authoring.asmx
and click OK.3. Click on the Click Here link to switch to code view.
4. Add the following namespaces to the file:
using System.Security.Principal; using Microsoft.ContentManagement.Publishing;
5. Delete the following code as we will not be needing it:
// WEB SERVICE EXAMPLE // The HelloWorld() example service returns the string Hello World // To build, uncomment the following...