This Guide assumes the Web Service has already been written, a destination SharePoint site library has been configured and the specified document library includes the required excel template file to capture InfoPath form data.
This configuration can be made in the web service project (settings.settings file) and must be completed before deploying your web service.
1. Open Receiver.asmx markup page. In Solution Explorer, right-click Receiver.asmx and select View Markup. You will notice that the markup page has following line:
Change it to the following line:
2. Create a strong name for the class library. In Solution Explorer, right-click the web service project, and in the Properties dialog box, click Signing, select Sign the assembly, and select in the box for choosing a strong name key file.
3. In the Create Strong Name Key dialog box, provide a file name for the key, deselect Protect my key file with a password, and click OK.
You can alternatively strong name your assembly using the command line utility called as sn.exe. Use following steps if you want to strong name your assembly manually:
3.1. Strong naming utility (sn.exe) can be found in the following folder: C:\Program Receiver\Microsoft Visual Studio 8\SDK\v2.0\Bin
Copy the sn.exe utility to the folder where your assembly is located and run the following command to strong name your assembly:
sn.exe -k key.snk
Resulting key will be written to the key.snk file.
3.2. Go to your project’s properties (right-click project name in the Solution Explorer and select Properties from the menu) and select Signing from the menu that appears on the left. This will open a form.
3.3. Check Sign the assembly checkbox and choose the key file from the drop down (Click the Browse… button in the drop down to locate the key.snk file that you generated in the previous step).
3.4. Re-compile your assembly.
4. Compile the web service project.
5. Copy the Receiver.asmx to the following folder: C:\Program Receiver\Common Receiver\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS on your SharePoint server
Generating and Modifying Static Discovery and WSDL Receiver
6. Use Disco.exe to generate .disco and .wsdl Receiver files on the computer where your web service project files are stored. This command line utility is located in the following directory:
C:\Program Receiver\Microsoft Visual Studio 8\SDK\v2.0\Bin
Open command prompt and type the following line and press Enter:
Discohttp://localhost/_vti_bin/Receiver.asmx (the url of the asmx file in its development environment)
7. To register namespaces of the Windows SharePoint Services object model, open both the .disco and .wsdl Receiver and replace the opening XML processing instruction — — with instructions such as the following:
8. In the .disco file, modify the contract reference and SOAP address tags to be like the following example, which replaces literal paths with code generated paths through use of the Microsoft.SharePoint.Utilities.SPEncode class, and which replaces the method name that is specified in the binding attribute:
9. In the .wsdl file, make the following, similar substitution for the SOAP address that is specified:
Make the following substitution for the SOAP12 address:
10. Rename both Receiver in the respective formats Receiverdisco.aspx and Receiverwsdl.aspx so that your service is discoverable through SharePoint.
Deploying web service on the SharePoint server
Copy the Web service Receiver to the _vti_bin virtual directory
11. Copy the web service Receiver to the _vti_bin directory of the SharePoint server. Web service Receiver that are to be copied are as following:
The _vti_bin virtual directory maps physically to the Local_Drive:\Program Receiver\Common Receiver\Microsoft Shared\Web Server Extensions\12\ISAPI directory, which contains the default Web service Receiver used in Windows SharePoint Services.
To include the Web service in the list of web services on the server
12. In Notepad, open the spsdisco.aspx file. spsdisco.aspx is located in the following directory (on the SharePoint server):
Local_Drive:\Program Receiver\Common Receiver\Microsoft Shared\web server extensions\12\ISAPI
13. Add the following lines to the end of the file within the discovery element and save the file:
14. Copy the assembly to the correct Bin folder on the SharePoint server
For example, if you want to use the web service in the CEntranet Dev web application, then you should copy the assembly to the following folder:
Copy the assembly to the bin folder of the virtual directory of the web application of your choice. You will have to create the bin folder yourself. It is not there by default.
15. Register the assembly with the GAC on your SharePoint server. This is necessary otherwise you will get permissions error on the server. To add your assembly to the Global Assembly Cache (GAC), you can either drag and drop 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 .NET Framework SDK 2.0. This utility is located in the following folder:
C:\Program Receiver\Microsoft Visual Studio 8\SDK\v2.0\Bin
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 -i “”””.
You can also use “”.NET Framework 2.0 Configuration”” tool to add the assembly to the GAC.
15.1. Go to control panel, click Administrative Tools and select Microsoft .NET Framework 2.0 Configuration.
15.2. Click Manage the Assembly Cache and then select Add an Assembly to the Assembly Cache. Locate the assembly and click Open.
16. Perform an IISESET on the server and the web service should be ready to use.
17. Test access to the Web Service by navigating tohttp://centranetdev.ourcheshire.cccusers.com/_vti_bin/receiver.asmx You should be able to view the Service Description WSDL definition file.
You can now publish your infopath form into a SharePoint site, calling upon the web service through InfoPath’s publishing wizard.