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.

Custom Web Servic In MOSS 2007的更多相关文章

  1. Create and Install Timer Job in MOSS 2007

    Excute Timerjob public class TriggerLoadCacheTimerJob : SPJobDefinition { string ExceptionFlag = str ...

  2. sharepoint custom web service

    创建自定义 ASP.NET Web 服务 http://msdn.microsoft.com/zh-cn/library/ms464040.aspx

  3. Web Servic和Web API的区别

    Web Service:1.它是基于SOAP协议的,数据格式是XML2.只支持HTTP协议3.它不是开源的,但可以被任意一个了解XML的人使用4.它只能部署在IIS上Web API:1.这是一个简单的 ...

  4. How to upgrade workflow assembly in MOSS 2007

    This problem generally start when you are having an existing custom workflow and there are instances ...

  5. MOSS 2007 错误0x80040E14解决

    今天公司内网莫名的出现错误,只能新建列表条目,不能创建网站,到后来列表条目也不能创建了,一直报0x80040E14错误.于是Google一把,搜索这个错误号,然后在apearce 的Blog找到了原因 ...

  6. SharePoint 2007 页面定制(一)

    转:http://www.nanmu.net/SharePoint-MOSS-WSS-Silverlight/Lists/Posts/Post.aspx?ID=74 本文主要包括以下几方面内容: 1. ...

  7. Add custom and listview web part to a page in wiki page using powershell

    As we know, Adding list view web part is different from custom web part using powershell, what's mor ...

  8. Developing a Custom Membership Provider from the scratch, and using it in the FBA (Form Based Authentication) in SharePoint 2010

    //http://blog.sharedove.com/adisjugo/index.php/2011/01/05/writing-a-custom-membership-provider-and-u ...

  9. SharePoint每日小贴士Web部件

    SharePoint每日小贴士Web部件 项目描写叙述         此Web部件从指定SP自己定义列表或一个选定的 RSS源选择一个随机项目.并显示一张图片.标题和一个Tip.         适 ...

随机推荐

  1. mysql 修改密码

    安装完成后,默认本地登录超级管理员root,密码为空连接服务后(先停止服务,在wamp中运行mysql控制台enterpass:直接回车),执行set password for root@localh ...

  2. 【转】Tomcat 的三种(bio,nio.apr) 高级 Connector 运行模式

    转载地址:http://www.oschina.net/question/54100_16195   tomcat的运行模式有3种.修改他们的运行模式.3种模式的运行是否成功,可以看他的启动控制台,或 ...

  3. JS写随机数

    使用JS编写一个方法 让数组中的元素每次刷新随机排列(不得使用sort方法:需注明步骤思路).例如:初始数组:a,b,c,d 每次刷新页面都会显示不同:b,c,d,a….a,d,c,b…等等 代码: ...

  4. 按年、季度、月分组&&计算日期和时间的函数

    Mysql 按年.季度.月分组 按月度分组: select DATE_FORMAT(i.created_at, '%Y-%m月')...................GROUP BY DATE_FO ...

  5. Navicat for mysql 远程连接 mySql数据库10061、1045错误

    原文地址:http://www.111cn.net/database/mysql/46377.htm 有朋友可能会碰到使用Navicat for mysql 远程连接 mySql数据库会提示10061 ...

  6. getopt()和getopt_long()用法

    参考链接: http://home.eeworld.com.cn/home.php?mod=space&do=blog&id=43897&uid=101752 http://b ...

  7. 关于node.js杂记

    https://gitlore.com/page/gitlore-git/nodejs/index.html[node.js中文文档] //////    https://gitlore.com/in ...

  8. SQL-Server使用点滴(一)

    前言 SQL的语法比较简单,学起来相比界面UI控制要简单得多,但是SQL在企业级应用中又是如此的重要,以至于很多开发人员都把重点放在SQL上. SQL并没有面向对象的概念,最复杂的设计也不过是表值函数 ...

  9. VB类模块中属性的参数——VBA中Range对象的Value属性和Value2属性的一点区别

    在VB中,属性是可以有参数的,而VBA中属性使用参数非常常见.比如最常用的:Worksheet.Range("A1:A10")  VB的语法,使用参数的不一定是方法,也有可能是属性 ...

  10. 使用 Babel + React + Webpack 搭建 Web 应用

    话不说直接上正题. 环境搭建 Babel--目前浏览器对于ES6的语法解析支持度还不高,所以要通过转码在编译,所以在使用ES6之前要安装Babel,之前安装的时候遇到了一些问题但是没有全部记录下来,现 ...