Spiga

Walkthrough: Creating a Custom Web Services for SharePoint

2008-08-24 22:03 by 寂寞的风铃, 542 visits, 网摘, 收藏, 编辑

1、在Visual Studio 2008中创建 ASP.NET Web 服务应用程序。

2、在项目中添加新建项:[web服务]:Profile.asmx

3、编码:

Code

4、编译(F5),预览一下 Profile Web 服务。PS:不要关闭ASP.NET Development Server。

5、在Visual Studio 2008 命令行中输入:

disco http://localhost:15233/Profile.asmx

PS:15233是您Visual Studio开发服务器随即自动分配的端口号。

6、将生成的Profile.disco、Profile.wsdl改名为Profiledisco.aspx、Profilewsdl.aspx

7、打开Profiledisco.aspx、Profilewsdl.aspx,在两个页面中将:

<?xml version="1.0" encoding="utf-8"?>
更改为:
<%@ Page Language="C#" Inherits="System.Web.UI.Page"    %> 
<%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Import Namespace="Microsoft.SharePoint.Utilities" %> 
<%@ Import Namespace="Microsoft.SharePoint" %>
<% Response.ContentType = "text/xml"%>
将所有:
"http://localhost:15233/Profile.asmx"
更改为:
<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output); %>
在Profilewsdl.aspx中,将:
"http://localhost:15233/Profile.asmx?wsdl"
更改为:
<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request) + "?wsdl"),Response.Output); %>
8、在Profile.asmx上点击右键,查看标记,去掉: 
CodeBehind="Profile.asmx.cs"

9、在_layouts文件夹中创建WebService文件夹,将Profile.asmx、Profiledisco.aspx、Profilewsdl.aspx复制到此文件夹。将Simone.SharePoint.WebService.dll复制到C:\inetpub\wwwroot\wss\VirtualDirectories\[端口]\bin文件夹中。

10、在[端口]下的应用程序创建的网站集及网站中访问_layouts/WebService/Profile.asmx,我们就可以访问我们创建的WebService了。

0
0
(请您对文章做出评价)
« 上一篇:风铃归来:Organization Chart(Graphic JavaScript Tree):Microsoft.GroupBoard.EnhancedGroup
» 下一篇:Take it easy:Install Visual Studio 2008 Team Foundation Server (SP1) on [Windows 2008 + SQL Server 2008 + MOSS 2007]
Add your comment

1 条回复

  1. #1楼 Greenliu[未注册用户]2008-10-14 19:42
    请问博主用disco 命令生成 的东西保存在哪里呢?我好像找不到
      回复  引用