views:

16

answers:

1

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 service to run in sharepoint 2007 as well as outside sharepoint.

A: 

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); %>
Steve Danner
I am really new at web services and sharepoint. So I simply create the service on a development machine then run disco.exe against it while it is still on the dev machine? To deploy to the server do I just copy the wsdl and disco files to the server
Peggy A
Well, you will create the service on a development machine AND run disco.exe on it, but you will have to modify and rename the files generated (<myservice>.disco and <myservice>.wsdl) as described before you deploy them.
Steve Danner