- Create a web service assembly and build it,
- Set it's 5-part strong name as class attribute in the asmx file (right-click > View Markup),
- Install the signed assembly in the GAC,
- Put the asmx in the 12\TEMPLATE\LAYOUTS folder,
- Copy disco.exe (the tool) to the same location,
- Run a command prompt and cd to that location,
- Run the command disco http://<server>/_layouts/<service>.asmx,
- Include the 2 generated files *.disco and *.wsdl in the web service project,
- Remove the '.' preceding their extensions and append ".aspx" to their names,
- In the *disco.aspx file, replace everything by the following. Don't change anything to the headers, not even put them on new lines, as SharePoint won't find the file anymore. The same goes for the WSDL that comes next.
<%@ 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"; %>
<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="http://www.syneton.be/_layouts/SynetonService.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address=<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output); %> xmlns:q1="http://www.syneton.be/services/" binding="q1:SynetonServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address=<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output); %> xmlns:q2="http://www.syneton.be/services/" binding="q2:SynetonServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery> - In the *wsdl.aspx file, add the following to the top of the file:
<%@ 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"; %>
And at the bottom, replace the location attribute of <soap:address... and <soap12:address... both as follows:
location=<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output); %> - Now put those 2 files and the asmx under 12\ISAPI and it's done.
- The service is now available from http://<server>/_vti_bin/<service>.asmx.
07 January 2011
SharePoint - Install custom web service
To install a custom web service in SharePoint (2007):
Labels:
SharePoint
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment