Wednesday, February 24, 2010
Tuesday, February 23, 2010
Monday, February 22, 2010
(2)To create an ASP.NET Web service
a)In Visual Studio, click File, point to New, and then select Web Site. b)In the Templates box of the New Web Site dialog box, select ASP.NET Web Service, select File System in the Location box, select a programming language and location for the project, and then click OK.
C) Within the new Web service solution, create a separate class library project to contain the Web service logic.
[ To create the project, click File, point to New, and then select Project.] In the New Project dialog box, select a language in the Project types box, select Class Library in the Templates box, provide a name and location for the project, select Add to Solution in the Solution box, and then click OK.
D)Add a reference to the System.Web.Services namespace in the class library project. And also Microsoft.SharePoint
E)Replace the default class file in the class library project with the default service class file that Visual Studio provides in the App_Code folder of the Web service. [To replace the class file with the service class file ] In Solution Explorer, drag Service.cs or Service.vb to the top node in the class library project. Delete the Class1.cs or Class1.vb file, and also delete the Service.cs or Service.vb file that remains in the App_Code folder.
F)Create a strong name for the class library:
In Solution Explorer, right-click the class library project, and then click Properties.
In the Properties dialog box, click Signing, select Sign the assembly, and then select
G) To build only the class library project, right-click the project in Solution Explorer, and then click Build.
H) To add your assembly to the global assembly cache (GAC), you can either drag the assembly into the % windows%\assembly directory using 2 instances of Windows Explorer, or use the command line utility gacutil.exe that is installed with the Microsoft .NET Framework SDK 2.0.
To use gacutil.exe to copy the class library DLL into the GAC
To open the Visual Studio command prompt, click Start, point to All Programs, point to Microsoft Visual Studio 2005, point to Visual Studio Tools, and click Visual Studio 2005 Command Prompt.
At the command prompt type a command in the following form, and press ENTER:
gacutil.exe -if "
I) Now you are ready to modify the assembly information in the default Service.asmx file of the Web service with information for the DLL from the GAC. To get information from the GAC, open the %windows% \assembly directory in Windows Explorer, right-click your assembly, and click Properties.
J) To open Service.asmx in Solution Explorer, right-click the file and click Open. Remove the CodeBehind attribute from the page directive in Service.asmx, and modify the contents of the Class attribute so that the directive matches the following format, where the assembly name "NewAssembly" and the public key token are values specified in the Properties dialog box that you opened in step 10: <%@ WebService Language="C#" Class="Service,NewAssembly, Version=22.214.171.124, Culture=neutral, PublicKeyToken=8f2dca3c0f2d0131" %>
K)Rename your .asmx file appropriately, and then save your changes.
3)Generate Static discovery and WSDL files.
In Windows Explorer, copy the .asmx file of your Web service to \\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS.
4)Reset IIS for the DLLs in assembly to take effect.
5)Type in http://Server/_layouts/Service.asmx for the Service and its methods in it.