Wednesday, September 16, 2009

Publish ASP.net WebService to SharePoint Web Server

Click on File / New Web Site

o Select ASP.NET Web Service

o Select Language = Visual C#

o Select Location Type = File System

o Specify Location = Directory of your choice.

A suggestion would be: C:\Documents and Settings\-username-\My Documents\Visual Studio 2005\Projects\Webservice\YourWebServiceName

Visual Studio will create the files for the template “Hello World” web service in the directory path.

The Folder named YourWebServiceName will contain a Service.Asmx page and an App_Code subfolder.

The App_Code subfolder will contain a file named Service.cs

o Create a virtual server on the Web Server doing the following:

o Copy the following code and create an Install_Webservice.Bat file in the \WebService folder.

o Edit this file to replace “YourWebServiceName” with the name of the subfolder you created above

o Execute the file with a parameter of your Sharepoint Port 80 Web Site Name (typically “Sharepoint – 80”)

I NSTALL_WEBSERVICE “SharePoint – 80”

o Goto http://servername/wshelloworld/service.asmx and hopefully the webservice will display

:----------------------------------------------------------------------

: Install_Webservice.Bat

:

:

: This file was created by copying the Install.Bat file in this folder

: and removing all of the logic that dealt with the creation/loading

: of the BDC Applciation. This batch file just creates the virtual

: directory on the Sharepoint Web Server for the HelloWorld Webservice

:----------------------------------------------------------------------

@echo on

iisvdir /create %1 WSHelloWorld "%CD%\YourWebServiceName"

goto end

:usage

@echo.

@echo Syntax: INSTALL_WEBSERVICE website

@echo.

@echo Parameters:

@echo.

@echo Value Description

@echo ------------ ------------------------------------------------

@echo website Use either the site name or metabase path of

@echo site you want the webservice deployed

@echo.

@echo Example:

@echo.

@echo INSTALL_WEBSERVICE "SharePoint - 80"

goto end

No comments:

Post a Comment