开发自定义sharepoint2010 webservice

开发过程与在VS下开发webservice一致,在此仅仅对sharepoint2010 下webservice部署做简单说明。

1、生成.disco   文件

利用vs 命令行工具 敲入 disco http://localhost/<本地webservice路径>.asmx out:d:

2、修改.disco文件和.wsdl文件 头为:
<%@ Page Language="C#" Inherits="System.Web.UI.Page"    %>
<%@ Assembly Name="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
 <%@ Import Namespace="Microsoft.SharePoint.Utilities" %> <%@ Import Namespace="Microsoft.SharePoint" %>
<% Response.ContentType = "text/xml"; %>

 3、修改.disco文件如下所示:

<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
  <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/diagnostics/" binding="q1:SharePointDiagnosticsSoap" 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/diagnostics/" binding="q2:SharePointDiagnosticsSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>

 4、修改.wsdl文件 soap节

  <wsdl:service name="FileService">
    <wsdl:port name="FileServiceSoap" binding="tns:FileServiceSoap">
      <soap:address location=<% SPEncode.WriteHtmlEncodeWithQuote(Response,SPWeb.OriginalBaseUrl(Request), '"'); %> />
    </wsdl:port>
    <wsdl:port name="FileServiceSoap12" binding="tns:FileServiceSoap12">
      <soap12:address location=<% SPEncode.WriteHtmlEncodeWithQuote(Response,SPWeb.OriginalBaseUrl(Request), '"'); %> />
    </wsdl:port>
  </wsdl:service>

5、修改文件名

     如将FileService.wsdl 重命名为FileServicewsdl.wsdl

  如将FileService.disco 重命名为FileServicewsdisco.disco

6、部署:将三个文件拷贝到...\14\ISAPI路径下。

  对于webservice 的dll部署 有两种方案

  BIN 部署与 GAC部署,BIN部署较简单,不用修改asmx文件,仅需要修改webconfig中的信任级别 <trust level="Full" originUrl="" />(full可能会不安全)

 

  

 

转载于:https://www.cnblogs.com/aimigi/archive/2012/04/28/2475464.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值