How do I create wsdl and disco files for a web service using visual studio 2008? I can create the service and run it through VS but when I try to create the files nothing happens. I also need this se开发者_JAVA百科rvice to run in sharepoint 2007 as well as outside sharepoint.
Creating wsdl and disco files in sharepoint is a pain. You will have to run your project from visual studio's development server and run disco.exe against the asmx before deploying it to a SharePoint context. Additionally, you will have to rename your files wsdl.aspx and disco.aspx when you deploy it to a SharePoint context.
Finally, inside of a SharePoint context, you will have to manually modify the wsdl (see the out of the box SharePoint wsdl's for more on this). You have to replace all of your xml above node with this.
<%@ 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"; %>
And you will have to replace your SOAP address location attributes with this:
<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output); %>
精彩评论