花蜻宽 发表于 2015-9-25 13:32:30

总结:sharepoint webservice开发常见错误


  How to create custom sharepoint web service, you can see:
  http://www.walisystems.com/articles/SPS/uplservice/v1/creating%20a%20custom%20web%20service.htm
  
1.Disco.exe:
           When using the commond:
  disco http://localhost/_layouts/*.asmx
           There is an error as follow:
  
  

Reason:
  In the *.asmx file,
<%@ WebService Language="C#" Class="CustomWebServiceLib.CustomWebService_GetLists" %>
  
Solution:
  Change to:
<%@ WebService Language="C#" Class="CustomWebServiceLib.CustomWebService_GetLists, CustomWebServiceLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fbe2e565a3b3e37d" %>

2.Add Web Reference:
Error message:
  The document at the url
  http://localhost/_vti_bin/CustomWebServices/CustomWebService_GetLists.asmx
  was not recognized as a known document type.
  The error message from each known type may help you fix the problem:
  - Report from 'XML Schema' is 'The document format is not recognized (the content type
Screenshot:
  
  

  Click “Service Description”:
  
  

Reason:
  When converting *.disco to *disco.aspx and *.wsdl to *wsdl.aspx, there are some errors.
  
Solution:
  You can copy the files of the system services, then rename the files;
  Update the service name in the binding tags to your service name.
  
Notice:
  There are two object models that can use:
  
<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output); %>
  
<% SPEncode.WriteHtmlEncodeWithQuote(Response, SPWeb.OriginalBaseUrl(Request), '"'); %>
  
  
页: [1]
查看完整版本: 总结:sharepoint webservice开发常见错误