Custom Web Servic In MOSS 2007

Tools: Visual Studio 2008,Visual Studio 2008 Command Prompt, Sharepoint Server 2007

  1. Generate .disco and .wsdl files through Visual Studio 2008 Command Prompt in Visual Studio Tools

Run command:

Disco http://sp2007:14908/_vti_bin/PSWebService.asmx

<%@ WebService Language="C#" Class="NameSpace.PSWebService, NameSpace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0c8763d1ab14ce97"  %>

Error occurred as below.

Solution: Please move PSWebService.asmx into layouts folder and try it again. It works fine. Correct screen is as below.

Two files(pswebservice.disco and pswebservice.wsdl) are stored in the path ‘C:\Temp\aa’

Note: You have to rename these two files(pswebservicedisco.aspx and pswebservicewsdl.aspx). You have to move these three files into ISAPI folder. The structure is below.

 

  1. These two files are not able to use and you have to change parts of content.

For pswebservicedisco.aspx, substitute below original for current code

Original Code 1:


<?xml version="1.0" encoding="utf-8"?>

Current Code 1:


<%@ 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";   %>

Original Code 2:


<contractRef ref="http://sp2007:14908/_layouts/pswebservice.asmx?wsdl" docRef="http://sp2007:14908/_layouts/pswebservice.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />

<soap address="http://sp2007:14908/_layouts/pswebservice.asmx" xmlns:q1="http://tempuri.org/" binding="q1:PSWebServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />

<soap address="http://sp2007:14908/_layouts/pswebservice.asmx" xmlns:q2="http://tempuri.org/" binding="q2:PSWebServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />

Current Code 2:


<contractRef ref=<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request) + "?wsdl"),Response.Output); %> docRef=<%   SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output);   %> xmlns="http://schemas.xmlsoap.org/disco/scl/"   />

<soap address=<%   SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output);   %> xmlns:q1="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/"   binding="q1:   PSWebServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/"   />

<soap   address=<%   SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output);   %> xmlns:q2="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/"   binding="q2:PSWebServiceSoap12"   xmlns="http://schemas.xmlsoap.org/disco/soap/"   />

Note: You are able to copy current code from alertsdisco file below.

For pswebservicewsdl.aspx, substitute below original for current code

Original Code 1:


<?xml version="1.0" encoding="utf-8"?>

Current Code 1:


<%@ 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"; %>

Original Code 2:


<soap:address location="http://sp2007:14908/_layouts/pswebservice.asmx" />

Current Code 2:


<soap:address location=<%   SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output);   %> />

Original Code 3:


<soap12:address location="http://sp2007:14908/_layouts/pswebservice.asmx" />

Current Code 3:


<soap12:address location=<%   SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output);   %> />

Note: You are able to copy current code from alertswsdl file below.

Then you are able to deploy pswebservice web service, once done. You have to modify  spdisco.aspx file that is located in %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\12\ISAPI and add the following code, specifying the .asmx file for your Web service.


<contractRef   ref=<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(spWeb.Url + "/_vti_bin/AWebService/PSWebService.asmx?wsdl"),   Response.Output); %>

docRef=<%   SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(spWeb.Url + "/_vti_bin/AWebService/PSWebService.asmx"),   Response.Output); %>

xmlns="   http://schemas.xmlsoap.org/disco/scl/ " />

<discoveryRef   ref=<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(spWeb.Url + "/_vti_bin/AWebService/PSWebService.asmx?disco"),Response.Output);   %>

xmlns="http://schemas.xmlsoap.org/disco/"   />

Your web service is able to be used till now.

时间: 2024-10-30 04:59:01

Custom Web Servic In MOSS 2007的相关文章

Create and Install Timer Job in MOSS 2007

Excute Timerjob public class TriggerLoadCacheTimerJob : SPJobDefinition { string ExceptionFlag = string.Empty; public TriggerLoadCacheTimerJob() : base() { } // Overriding the parameterized constructor public TriggerLoadCacheTimerJob(string jobName,

Web Servic和Web API的区别

Web Service:1.它是基于SOAP协议的,数据格式是XML2.只支持HTTP协议3.它不是开源的,但可以被任意一个了解XML的人使用4.它只能部署在IIS上Web API:1.这是一个简单的构建HTTP服务的新框架2.在.net平台上Web API 是一个开源的.理想的.构建REST-ful 服务的技术3.不像WCF REST Service.它可以使用HTTP的全部特点(比如URIs.request/response头,缓存,版本控制,多种内容格式)4.它也支持MVC的特征,像路由.

MOSS 2007 错误0x80040E14解决

今天公司内网莫名的出现错误,只能新建列表条目,不能创建网站,到后来列表条目也不能创建了,一直报0x80040E14错误.于是Google一把,搜索这个错误号,然后在apearce 的Blog找到了原因.原文如下: HRESULT: 0x80040E14 when adding items to SharePoint If you receive HRESULT: 0x80040E14 when trying to add an item like announcements/webpart/sa

SharePoint【测试】Office 203 Add-in On SharePoint 3.0

听闻Office 2003 Add-in Web parts and Components,即Office 2003增益集:网页组件,可以在SharePoint 3.0上使用,因为SharePoint 3.0向下相容SharePoint 2.0,但对此一直保持怀疑的态度:这几天看到TechNet论坛上有朋友在问在SharePoint 3.0上是否有类似2.0那类可连接OLAP的网页组件:小弟第一个想到的就是Office 203增益集网页组件,索性安装来试试看! 结果无法安装,安装程序响应,要安装

sharepoint 2007 无法自动跳转到default.aspx

环境:moss 2007 sp2 ,server 2003 r2 X64,一台管理中心,四台前端,一台search,一台其他开发功能server. 使用NLB访问正常,域名为http://www.test.com 如果将hosts 中的域名直接指定到管理中心的地址,直接通过管理中心的Web Application 访问时,如果使用http://www.test.com/default.aspx访问正常,使用http://www.test.com访问时,不断弹出输入用户名密码的对话框,并且输入无效

sharepoint 2007 升级到 sharepoint 2013

从moss 2007不能直接升级到moss2013,必须要先升级到moss2010,再升级到moss2013才可以. 一.需要将moss 2007打到sp2补丁(如果已经打过补丁,可以跳过此步骤) 如果还没有打sp1补丁,需要先打sp1补丁,然后再打sp2补丁.打完sp2后,sharepoint的版本号是12.0.0.6421,未打任何补丁之前的版本号是4518或者更小. 按照如下顺序打补丁.如果不想在生产环境上动刀,那么就搭一个虚拟机吧.moss2007环境的搭建可以参照这个:http://w

SharePoint每日小贴士Web部件

SharePoint每日小贴士Web部件 项目描述 此Web部件从指定SP自定义列表或一个选定的 RSS源选择一个随机项目,并显示一张图片.标题和一个Tip. 适用于WSS 3.0,MOSS 2007和SP2010. 属性配置 包含Tip的SP列表: RSS源URL: 对应图片.标题和Tip的列表字段: 一张图片(可选): 刷新或每天显示新的Tip. 这允许你显示包含在任何SP列表的随机数据,只需指定目标SP列表明和列表栏目名. 编辑Web部件 效果截图 WSP下载地址--免积分 http://

关于java web开发需要哪些技术要求(简单的web界面管理系统)

目前, 国内外信息化建设已经进入基于Web应用为核心的阶段, Java作为应用于网络的最好语言,前景无限看好.然而,就算用Java建造一个不是很烦琐的web应用,也不是件轻松的事情.概括一下,实施Java的WEB项目需要掌握的技术如下: lJava语言 l面向对象分析设计思想 l设计模式和框架结构 lXML语言 l网页脚本语言 l数据库 l应用服务器 l集成开发环境 下面我们具体地看每个技术. 1.Java语言 Java语言体系比较庞大,包括多个模块.从WEB项目应用角度讲有JSP.Servle

ASP.NET Web API是什么?

[翻译]ASP.NET Web API是什么? 说明:随微 软ASP.NET MVC 4一起发布的还有一个框架,叫做ASP.NET Web API.目前国内关注这项技术的人似乎还很少,这方面的文章也不多见.开发Web应用程序也许可以只用MVC这样的技术,而不用这项Web API技术,但如果用了,会给你的应用程序带来极大的好处.为此,本人转载并翻译了以下这篇文章,后面还会陆续翻译该项技术的一些官方教程.大家一起学 习,共同提高. Microsoft ASP.NET: What's This New