Walkthrough: Creating a Custom Web Services for SharePoint

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了。

广告哈尔滨特产、红肠、干肠、纯天然籽粉、家居饰品
各位光临到元元小屋的买家祝福您每天都开心!店主已全职网店在线QQ:289439373有事点这里
手机:13945095239(短信)
Tag标签: WebServices
posted @ 2008-08-24 22:03 寂寞的风铃 阅读(524) 评论(1)  编辑 收藏 网摘

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

昵称: [登录] [注册]

主页:

邮箱:(仅博主可见)

评论内容:

  登录  注册

[使用Ctrl+Enter键快速提交评论]

0 1275308




相关文章:

相关链接:
a