• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Happy Sky
博客园    首页    新随笔    联系   管理    订阅  订阅
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.

 

posted on 2015-04-17 15:26  Jenny0810  阅读(205)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3