Move web service builder to the appropriate place in integration.

git-svn-id: https://svn.apache.org/repos/asf/incubator/lcf/integration/sharepoint-3.0/trunk@1178606 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webservice/ISAPI/MCPermissions.asmx b/webservice/ISAPI/MCPermissions.asmx
new file mode 100644
index 0000000..06cffe9
--- /dev/null
+++ b/webservice/ISAPI/MCPermissions.asmx
@@ -0,0 +1,16 @@
+<% // Licensed to the Apache Software Foundation (ASF) under one or more      %>
+<% // contributor license agreements. See the NOTICE file distributed with    %>
+<% // this work for additional information regarding copyright ownership.     %>
+<% // The ASF licenses this file to You under the Apache License, Version 2.0 %>
+<% // (the "License"); you may not use this file except in compliance with    %>
+<% // the License. You may obtain a copy of the License at                    %>
+<% //                                                                         %>
+<% // http://www.apache.org/licenses/LICENSE-2.0                              %>
+<% //                                                                         %>
+<% // Unless required by applicable law or agreed to in writing, software     %>
+<% // distributed under the License is distributed on an "AS IS" BASIS,       %>
+<% // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%>
+<% // See the License for the specific language governing permissions and     %>
+<% // limitations under the License.                                          %>
+
+<%@ WebService Language="C#" Class="MetaCarta.SharePoint.SoapServer.Permissions, MetaCarta.SharePoint, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3e4387af946c55c8" %>
\ No newline at end of file
diff --git a/webservice/ISAPI/MCPermissionsdisco.aspx b/webservice/ISAPI/MCPermissionsdisco.aspx
new file mode 100644
index 0000000..bd14f8c
--- /dev/null
+++ b/webservice/ISAPI/MCPermissionsdisco.aspx
@@ -0,0 +1,29 @@
+<% // Licensed to the Apache Software Foundation (ASF) under one or more      %>

+<% // contributor license agreements. See the NOTICE file distributed with    %>

+<% // this work for additional information regarding copyright ownership.     %>

+<% // The ASF licenses this file to You under the Apache License, Version 2.0 %>

+<% // (the "License"); you may not use this file except in compliance with    %>

+<% // the License. You may obtain a copy of the License at                    %>

+<% //                                                                         %>

+<% // http://www.apache.org/licenses/LICENSE-2.0                              %>

+<% //                                                                         %>

+<% // Unless required by applicable law or agreed to in writing, software     %>

+<% // distributed under the License is distributed on an "AS IS" BASIS,       %>

+<% // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%>

+<% // See the License for the specific language governing permissions and     %>

+<% // limitations under the License.                                          %>

+

+<%@ Page Language="C#" Inherits="System.Web.UI.Page" %> 

+<%@ Assembly Name="Microsoft.SharePoint, Version=11.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=<% 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://microsoft.com/sharepoint/webpartpages/" binding="q1:PermissionsSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />

+  <soap address=<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output); %> 

+    xmlns:q2="http://microsoft.com/sharepoint/webpartpages/" binding="q2:PermissionsSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />

+</discovery>
\ No newline at end of file
diff --git a/webservice/ISAPI/MCPermissionswsdl.aspx b/webservice/ISAPI/MCPermissionswsdl.aspx
new file mode 100644
index 0000000..6abec65
--- /dev/null
+++ b/webservice/ISAPI/MCPermissionswsdl.aspx
@@ -0,0 +1,91 @@
+<% // Licensed to the Apache Software Foundation (ASF) under one or more      %>

+<% // contributor license agreements. See the NOTICE file distributed with    %>

+<% // this work for additional information regarding copyright ownership.     %>

+<% // The ASF licenses this file to You under the Apache License, Version 2.0 %>

+<% // (the "License"); you may not use this file except in compliance with    %>

+<% // the License. You may obtain a copy of the License at                    %>

+<% //                                                                         %>

+<% // http://www.apache.org/licenses/LICENSE-2.0                              %>

+<% //                                                                         %>

+<% // Unless required by applicable law or agreed to in writing, software     %>

+<% // distributed under the License is distributed on an "AS IS" BASIS,       %>

+<% // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%>

+<% // See the License for the specific language governing permissions and     %>

+<% // limitations under the License.                                          %>

+<%@ Page Language="C#" Inherits="System.Web.UI.Page" %> 

+<%@ Assembly Name="Microsoft.SharePoint, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 

+<%@ Import Namespace="Microsoft.SharePoint.Utilities" %> 

+<%@ Import Namespace="Microsoft.SharePoint" %> 

+<% Response.ContentType = "text/xml"; %>

+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://microsoft.com/sharepoint/webpartpages/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://microsoft.com/sharepoint/webpartpages/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

+  <wsdl:types>

+    <s:schema elementFormDefault="qualified" targetNamespace="http://microsoft.com/sharepoint/webpartpages/">

+      <s:element name="GetPermissionCollection">

+        <s:complexType>

+          <s:sequence>

+            <s:element minOccurs="0" maxOccurs="1" name="objectName" type="s:string" />

+            <s:element minOccurs="0" maxOccurs="1" name="objectType" type="s:string" />

+          </s:sequence>

+        </s:complexType>

+      </s:element>

+      <s:element name="GetPermissionCollectionResponse">

+        <s:complexType>

+          <s:sequence>

+            <s:element minOccurs="0" maxOccurs="1" name="GetPermissionCollectionResult">

+              <s:complexType mixed="true">

+                <s:sequence>

+                  <s:any />

+                </s:sequence>

+              </s:complexType>

+            </s:element>

+          </s:sequence>

+        </s:complexType>

+      </s:element>

+    </s:schema>

+  </wsdl:types>

+  <wsdl:message name="GetPermissionCollectionSoapIn">

+    <wsdl:part name="parameters" element="tns:GetPermissionCollection" />

+  </wsdl:message>

+  <wsdl:message name="GetPermissionCollectionSoapOut">

+    <wsdl:part name="parameters" element="tns:GetPermissionCollectionResponse" />

+  </wsdl:message>

+  <wsdl:portType name="PermissionsSoap">

+    <wsdl:operation name="GetPermissionCollection">

+      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Returns the collection of permissions for a site, list, or list item.</wsdl:documentation>

+      <wsdl:input message="tns:GetPermissionCollectionSoapIn" />

+      <wsdl:output message="tns:GetPermissionCollectionSoapOut" />

+    </wsdl:operation>

+  </wsdl:portType>

+  <wsdl:binding name="PermissionsSoap" type="tns:PermissionsSoap">

+    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />

+    <wsdl:operation name="GetPermissionCollection">

+      <soap:operation soapAction="http://microsoft.com/sharepoint/webpartpages/GetPermissionCollection" style="document" />

+      <wsdl:input>

+        <soap:body use="literal" />

+      </wsdl:input>

+      <wsdl:output>

+        <soap:body use="literal" />

+      </wsdl:output>

+    </wsdl:operation>

+  </wsdl:binding>

+  <wsdl:binding name="PermissionsSoap12" type="tns:PermissionsSoap">

+    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />

+    <wsdl:operation name="GetPermissionCollection">

+      <soap12:operation soapAction="http://microsoft.com/sharepoint/webpartpages/GetPermissionCollection" style="document" />

+      <wsdl:input>

+        <soap12:body use="literal" />

+      </wsdl:input>

+      <wsdl:output>

+        <soap12:body use="literal" />

+      </wsdl:output>

+    </wsdl:operation>

+  </wsdl:binding>

+  <wsdl:service name="Permissions">

+    <wsdl:port name="PermissionsSoap" binding="tns:PermissionsSoap">

+      <soap:address location=<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output); %> />

+    </wsdl:port>

+    <wsdl:port name="PermissionsSoap12" binding="tns:PermissionsSoap12">

+      <soap12:address location=<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(SPWeb.OriginalBaseUrl(Request)),Response.Output); %> />

+    </wsdl:port>

+  </wsdl:service>

+</wsdl:definitions>
\ No newline at end of file
diff --git a/webservice/MCPermissions.cs b/webservice/MCPermissions.cs
new file mode 100644
index 0000000..8f9ce13
--- /dev/null
+++ b/webservice/MCPermissions.cs
@@ -0,0 +1,219 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more

+// contributor license agreements. See the NOTICE file distributed with

+// this work for additional information regarding copyright ownership.

+// The ASF licenses this file to You under the Apache License, Version 2.0

+// (the "License"); you may not use this file except in compliance with

+// the License. You may obtain a copy of the License at

+//

+// http://www.apache.org/licenses/LICENSE-2.0

+//

+// Unless required by applicable law or agreed to in writing, software

+// distributed under the License is distributed on an "AS IS" BASIS,

+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+// See the License for the specific language governing permissions and

+// limitations under the License.

+

+// Read the file "readme.txt" in this directory for a description of what this

+// web service does and why it is needed.

+using System;

+using System.Data;

+using System.Web;

+using System.Collections;

+using System.Web.Services;

+using System.Web.Services.Protocols;

+using System.ComponentModel;

+using System.Security.Permissions;

+using System.Xml;

+using System.Diagnostics;

+using Microsoft.SharePoint;

+using System.Net;

+using System.Security.Cryptography.X509Certificates;

+using System.Net.Security;

+

+namespace MetaCarta.SharePoint.SoapServer

+{

+    [WebService(Namespace = "http://microsoft.com/sharepoint/webpartpages/"),

+     WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1),

+     PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust"),

+     PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]

+    public class Permissions : System.Web.Services.WebService

+    {

+        #region Private Fields

+

+        private readonly string itemType = "item";

+

+        #endregion

+

+        #region Public Methods

+

+        [WebMethod(Description = "Returns the collection of permissions for a site, list, or list item.")]

+        public XmlNode GetPermissionCollection(string objectName, string objectType)

+        {

+            XmlNode retVal = null;

+

+            try

+            {

+                // Only handle requests for "item".  Send all other requests to the SharePoint web service.

+                if (objectType.ToLower().Equals(itemType))

+                {

+                    retVal = GetItemPermissions(objectName);

+                }

+                else

+                {

+                    ServicePointManager.ServerCertificateValidationCallback +=

+                        new RemoteCertificateValidationCallback(ValidateCertificate);

+

+                    using (SPPermissionsService.Permissions service = new SPPermissionsService.Permissions())

+                    {

+                        service.Url = SPContext.Current.Web.Url + "/_vti_bin/Permissions.asmx";

+                        service.Credentials = System.Net.CredentialCache.DefaultCredentials;

+

+                        retVal = service.GetPermissionCollection(objectName, objectType);

+                    }

+                }

+            }

+            catch (SoapException soapEx)

+            {

+                throw soapEx;

+            }

+            catch (Exception ex)

+            {

+                EventLog.WriteEntry("MCPermissions.asmx", ex.Message);

+                throw RaiseException(ex.Message, "1000", ex.Source);

+            }

+

+            return retVal;

+        }

+

+        #endregion

+

+        #region Private Methods

+

+        /// <summary>

+        /// Given the name of a list item, return an XML fragment describing the set of permissions

+        /// for the specified list item.

+        /// </summary>

+        /// <param name="itemName">A string containing the name of a list item</param>

+        /// <returns>An XML fragment</returns>

+        private XmlNode GetItemPermissions(string itemName)

+        {

+            XmlNode retVal = null;

+

+            if (string.IsNullOrEmpty(itemName))

+                throw RaiseException("Parameter 'objectName' cannot be null or empty.", "2000", "GetPermissionCollection");

+

+            using (SPWeb site = SPContext.Current.Web)

+            {

+                SPListItem item = site.GetListItem(itemName);

+

+                if (item.RoleAssignments.Count > 0)

+                {

+                    XmlDocument doc = new XmlDocument();

+                    retVal = doc.CreateElement("GetPermissionCollection", 

+                        "http://schemas.microsoft.com/sharepoint/soap/directory/");

+                    XmlNode permissionsNode = doc.CreateElement("Permissions");

+

+                    // A list item can have one or more role assignments.  Each role assignment

+                    // represents a member (user or group) with one or more permissions.  

+                    // The code below creates a Permission node for every member-permission assignment.

+                    foreach (SPRoleAssignment assignment in item.RoleAssignments)

+                    {

+                        SPPrincipal member = assignment.Member;

+

+                        foreach (SPRoleDefinition roleDefinition in assignment.RoleDefinitionBindings)

+                        {

+                            XmlNode permissionNode = CreatePermissionNode(doc, member, roleDefinition);

+                            permissionsNode.AppendChild(permissionNode);

+                        }

+

+                        retVal.AppendChild(permissionsNode);

+                    }

+                }

+            }

+

+            return retVal;

+        }

+

+        private XmlNode CreatePermissionNode(XmlDocument doc, SPPrincipal member, SPRoleDefinition roleDefinition)

+        {

+            XmlNode retVal = doc.CreateElement("Permission");

+

+            XmlAttribute memberIdAttribute = doc.CreateAttribute("MemberID");

+            memberIdAttribute.Value = member.ID.ToString();

+            retVal.Attributes.Append(memberIdAttribute);

+

+            XmlAttribute maskAttribute = doc.CreateAttribute("Mask");

+            int mask = (int)roleDefinition.BasePermissions;

+            maskAttribute.Value = mask.ToString();

+            retVal.Attributes.Append(maskAttribute);

+

+            XmlAttribute memberIsUserAttribute = doc.CreateAttribute("MemberIsUser");

+            memberIsUserAttribute.Value = member is SPUser ? "True" : "False";

+            retVal.Attributes.Append(memberIsUserAttribute);

+

+            XmlAttribute memberGlobalAttribute = doc.CreateAttribute("MemberGlobal");

+            string isGlobalValue = "True";

+            if (member is SPUser)

+            {

+                SPUser user = member as SPUser;

+                if (!user.IsDomainGroup)

+                    isGlobalValue = "False";

+            }

+

+            memberGlobalAttribute.Value = isGlobalValue;

+            retVal.Attributes.Append(memberGlobalAttribute);

+

+            if (member is SPUser)

+            {

+                SPUser user = member as SPUser;

+                XmlAttribute userLoginAttribute = doc.CreateAttribute("UserLogin");

+                userLoginAttribute.Value = user.LoginName;

+                retVal.Attributes.Append(userLoginAttribute);

+            }

+            else

+            {

+                XmlAttribute groupNameAttribute = doc.CreateAttribute("GroupName");

+                groupNameAttribute.Value = member.Name;

+                retVal.Attributes.Append(groupNameAttribute);

+            }

+            return retVal;

+        }

+

+        private SoapException RaiseException(string errorMessage, string errorNumber, string errorSource)

+        {

+            SoapException retVal = null;

+

+            XmlDocument doc = new XmlDocument();

+            XmlNode root = doc.CreateNode(XmlNodeType.Element, SoapException.DetailElementName.Name,

+                SoapException.DetailElementName.Namespace);

+

+            XmlNode errorNode = doc.CreateNode(XmlNodeType.Element, "Error", 

+                SoapException.DetailElementName.Namespace);

+            XmlNode errorNumberNode = doc.CreateNode(XmlNodeType.Element, "ErrorNumber", 

+                SoapException.DetailElementName.Namespace);

+            errorNumberNode.InnerText = errorNumber;

+            XmlNode errorMessageNode = doc.CreateNode(XmlNodeType.Element, "ErrorMessage", 

+                SoapException.DetailElementName.Namespace);

+            errorMessageNode.InnerText = errorMessage;

+            XmlNode errorSourceNode = doc.CreateNode(XmlNodeType.Element, "ErrorSource", 

+                SoapException.DetailElementName.Namespace);

+            errorSourceNode.InnerText = errorSource;

+

+            errorNode.AppendChild(errorNumberNode);

+            errorNode.AppendChild(errorMessageNode);

+            errorNode.AppendChild(errorSourceNode);

+            root.AppendChild(errorNode);

+

+            retVal = new SoapException(errorMessage, SoapException.ClientFaultCode, Context.Request.Url.AbsoluteUri, root);

+

+            return retVal;

+        }

+

+        public static bool ValidateCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)

+        {

+            return true;

+        }

+

+        #endregion

+    }

+}
\ No newline at end of file
diff --git a/webservice/MCPermissionsService.csproj b/webservice/MCPermissionsService.csproj
new file mode 100644
index 0000000..a369ebe
--- /dev/null
+++ b/webservice/MCPermissionsService.csproj
@@ -0,0 +1,123 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

+  <PropertyGroup>

+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>

+    <ProductVersion>8.0.50727</ProductVersion>

+    <SchemaVersion>2.0</SchemaVersion>

+    <ProjectGuid>{A8B02181-4D12-4C71-92ED-2B7719B72893}</ProjectGuid>

+    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>

+    <OutputType>Library</OutputType>

+    <AppDesignerFolder>Properties</AppDesignerFolder>

+    <RootNamespace>MetaCarta.SharePoint</RootNamespace>

+    <AssemblyName>MetaCarta.SharePoint</AssemblyName>

+    <SignAssembly>true</SignAssembly>

+    <AssemblyOriginatorKeyFile>MetaCarta.snk</AssemblyOriginatorKeyFile>

+  </PropertyGroup>

+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

+    <DebugSymbols>true</DebugSymbols>

+    <DebugType>full</DebugType>

+    <Optimize>false</Optimize>

+    <OutputPath>bin\</OutputPath>

+    <DefineConstants>DEBUG;TRACE</DefineConstants>

+    <ErrorReport>prompt</ErrorReport>

+    <WarningLevel>4</WarningLevel>

+  </PropertyGroup>

+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">

+    <DebugType>pdbonly</DebugType>

+    <Optimize>true</Optimize>

+    <OutputPath>bin\</OutputPath>

+    <DefineConstants>TRACE</DefineConstants>

+    <ErrorReport>prompt</ErrorReport>

+    <WarningLevel>4</WarningLevel>

+    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>

+  </PropertyGroup>

+  <ItemGroup>

+    <Reference Include="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL" />

+    <Reference Include="System" />

+    <Reference Include="System.Data" />

+    <Reference Include="System.Drawing" />

+    <Reference Include="System.Web" />

+    <Reference Include="System.Xml" />

+    <Reference Include="System.Configuration" />

+    <Reference Include="System.Web.Services" />

+    <Reference Include="System.EnterpriseServices" />

+    <Reference Include="System.Web.Mobile" />

+  </ItemGroup>

+  <ItemGroup>

+    <None Include="Web References\SPPermissionsService\Permissions.disco" />

+  </ItemGroup>

+  <ItemGroup>

+    <Compile Include="MCPermissions.cs">

+      <SubType>Component</SubType>

+    </Compile>

+    <Compile Include="Properties\AssemblyInfo.cs" />

+    <Compile Include="Properties\Settings.Designer.cs">

+      <AutoGen>True</AutoGen>

+      <DesignTimeSharedInput>True</DesignTimeSharedInput>

+      <DependentUpon>Settings.settings</DependentUpon>

+    </Compile>

+    <Compile Include="Web References\SPPermissionsService\Reference.cs">

+      <AutoGen>True</AutoGen>

+      <DesignTime>True</DesignTime>

+      <DependentUpon>Reference.map</DependentUpon>

+    </Compile>

+  </ItemGroup>

+  <ItemGroup>

+    <WebReferences Include="Web References\" />

+  </ItemGroup>

+  <ItemGroup>

+    <None Include="MetaCarta.snk" />

+    <None Include="Properties\Settings.settings">

+      <Generator>SettingsSingleFileGenerator</Generator>

+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>

+    </None>

+    <None Include="Web References\SPPermissionsService\Permissions.wsdl" />

+    <None Include="Web References\SPPermissionsService\Reference.map">

+      <Generator>MSDiscoCodeGenerator</Generator>

+      <LastGenOutput>Reference.cs</LastGenOutput>

+    </None>

+  </ItemGroup>

+  <ItemGroup>

+    <WebReferenceUrl Include="http://localhost/_vti_bin/Permissions.asmx">

+      <UrlBehavior>Dynamic</UrlBehavior>

+      <RelPath>Web References\SPPermissionsService\</RelPath>

+      <UpdateFromURL>http://localhost/_vti_bin/Permissions.asmx</UpdateFromURL>

+      <ServiceLocationURL>

+      </ServiceLocationURL>

+      <CachedDynamicPropName>

+      </CachedDynamicPropName>

+      <CachedAppSettingsObjectName>

+      </CachedAppSettingsObjectName>

+      <CachedSettingsPropName>

+      </CachedSettingsPropName>

+    </WebReferenceUrl>

+  </ItemGroup>

+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

+    <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 

+       Other similar extension points exist, see Microsoft.Common.targets.

+  <Target Name="BeforeBuild">

+  </Target>

+  <Target Name="AfterBuild">

+  </Target>

+  -->

+  <ProjectExtensions>

+    <VisualStudio>

+      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">

+        <WebProjectProperties>

+          <UseIIS>True</UseIIS>

+          <AutoAssignPort>True</AutoAssignPort>

+          <DevelopmentServerPort>1347</DevelopmentServerPort>

+          <DevelopmentServerVPath>/</DevelopmentServerVPath>

+          <IISUrl>http://localhost</IISUrl>

+          <OverrideIISAppRootUrl>True</OverrideIISAppRootUrl>

+          <IISAppRootUrl>http://localhost</IISAppRootUrl>

+          <NTLMAuthentication>False</NTLMAuthentication>

+        </WebProjectProperties>

+      </FlavorProperties>

+    </VisualStudio>

+  </ProjectExtensions>

+  <PropertyGroup>

+    <PostBuildEvent>

+    </PostBuildEvent>

+  </PropertyGroup>

+</Project>
\ No newline at end of file
diff --git a/webservice/MCPermissionsService.ddf b/webservice/MCPermissionsService.ddf
new file mode 100644
index 0000000..3e2fad5
--- /dev/null
+++ b/webservice/MCPermissionsService.ddf
@@ -0,0 +1,33 @@
+;*** Licensed to the Apache Software Foundation (ASF) under one or more

+;*** contributor license agreements. See the NOTICE file distributed with

+;*** this work for additional information regarding copyright ownership.

+;*** The ASF licenses this file to You under the Apache License, Version 2.0

+;*** (the "License"); you may not use this file except in compliance with

+;*** the License. You may obtain a copy of the License at

+;***

+;*** http://www.apache.org/licenses/LICENSE-2.0

+;***

+;*** Unless required by applicable law or agreed to in writing, software

+;*** distributed under the License is distributed on an "AS IS" BASIS,

+;*** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+;*** See the License for the specific language governing permissions and

+;*** limitations under the License.

+

+;*** MakeCab Directive file

+.OPTION EXPLICIT ; Generate errors 

+.Set CabinetNameTemplate=MetaCarta.SharePoint.MCPermissionsService.wsp     

+.Set DiskDirectoryTemplate=CDROM ; All cabinets go in single directory

+.Set CompressionType=MSZIP ; All files compressed in cabinet files

+.Set UniqueFiles="ON"

+.Set Cabinet=on

+.Set DiskDirectory1=Package

+

+manifest.xml

+bin\MetaCarta.SharePoint.dll

+

+.Set DestinationDir=ISAPI

+ISAPI\MCPermissions.asmx

+ISAPI\MCPermissionsdisco.aspx

+ISAPI\MCPermissionswsdl.aspx

+

+;***End
\ No newline at end of file
diff --git a/webservice/MetaCarta.snk b/webservice/MetaCarta.snk
new file mode 100644
index 0000000..069d6a5
--- /dev/null
+++ b/webservice/MetaCarta.snk
Binary files differ
diff --git a/webservice/Package/Installation Readme.txt b/webservice/Package/Installation Readme.txt
new file mode 100755
index 0000000..535cb9f
--- /dev/null
+++ b/webservice/Package/Installation Readme.txt
@@ -0,0 +1,55 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+How to install and upgrade the MCPermissions SharePoint Web Service
+=================================================
+
+This web service is deployed using the SharePoint stsadm utility.  There are several included batch files: setup.bat (for first-time installation),
+and upgrade.bat (for subsequent installations).  There is also a remove.bat, in case there is a need to uninstall the web service.
+
+Note: This web service is only functional on SharePoint 3.0 (2007) systems.  Do not install on SharePoint 2.0 (2003) systems.
+
+
+First-time installation
+================
+
+1) Copy the contents of the Package directory into a directory on your SharePoint server.
+2) Open a "Command" prompt, and cd to the directory in which the files were copied.
+3) If your SharePoint has been installed with its default paths, enter the command "setup.bat".  Otherwise, you may need to
+   modify the setup.bat file first for it to be able to locate stsadm.exe.
+4) Test your installation by browsing to the following SharePoint URL:
+
+http://<your server name>:<server port>/<server location>/_vti_bin/MCPermissions.asmx
+
+If everything was properly deployed, you should see a web page that describes the "Permissions" web service.
+
+
+Repeat or upgrade installations
+=======================
+
+1) Copy the contents of the Package directory into a directory on your SharePoint server.
+2) Open a "Command" prompt, and cd to the directory in which the files were copied.
+3) If your SharePoint has been installed with its default paths, enter the command "upgrade.bat".  Otherwise, you may need to
+   modify the upgrade.bat file first for it to be able to locate stsadm.exe.
+   
+
+Remove an installation
+=================
+
+1) Copy the contents of the Package directory into a directory on your SharePoint server.
+2) Open a "Command" prompt, and cd to the directory in which the files were copied.
+3) If your SharePoint has been installed with its default paths, enter the command "remove.bat".  Otherwise, you may need to
+   modify the remove.bat file first for it to be able to locate stsadm.exe.
+
diff --git a/webservice/Package/remove.bat b/webservice/Package/remove.bat
new file mode 100755
index 0000000..6322c20
--- /dev/null
+++ b/webservice/Package/remove.bat
@@ -0,0 +1,27 @@
+REM Licensed to the Apache Software Foundation (ASF) under one or more

+REM contributor license agreements. See the NOTICE file distributed with

+REM this work for additional information regarding copyright ownership.

+REM The ASF licenses this file to You under the Apache License, Version 2.0

+REM (the "License"); you may not use this file except in compliance with

+REM the License. You may obtain a copy of the License at

+REM

+REM http://www.apache.org/licenses/LICENSE-2.0

+REM

+REM Unless required by applicable law or agreed to in writing, software

+REM distributed under the License is distributed on an "AS IS" BASIS,

+REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+REM See the License for the specific language governing permissions and

+REM limitations under the License.

+

+set SHPADMINDIR=C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN

+set SHPADMINEXE=%SHPADMINDIR%\stsadm.exe

+set DEFAULTSERVICENAME=MetaCarta.SharePoint.MCPermissionsService.wsp

+

+echo Removing %DEFAULTSERVICENAME% using %SHPADMINEXE%...

+

+"%SHPADMINEXE%" -o retractsolution -name "%DEFAULTSERVICENAME%" -immediate

+"%SHPADMINEXE%" -o execadmsvcjobs

+"%SHPADMINEXE%" -o deletesolution -name "%DEFAULTSERVICENAME%" -override

+"%SHPADMINEXE%" -o execadmsvcjobs

+

+echo Removal complete

diff --git a/webservice/Package/setup.bat b/webservice/Package/setup.bat
new file mode 100644
index 0000000..ecf4c49
--- /dev/null
+++ b/webservice/Package/setup.bat
@@ -0,0 +1,27 @@
+REM Licensed to the Apache Software Foundation (ASF) under one or more

+REM contributor license agreements. See the NOTICE file distributed with

+REM this work for additional information regarding copyright ownership.

+REM The ASF licenses this file to You under the Apache License, Version 2.0

+REM (the "License"); you may not use this file except in compliance with

+REM the License. You may obtain a copy of the License at

+REM

+REM http://www.apache.org/licenses/LICENSE-2.0

+REM

+REM Unless required by applicable law or agreed to in writing, software

+REM distributed under the License is distributed on an "AS IS" BASIS,

+REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+REM See the License for the specific language governing permissions and

+REM limitations under the License.

+

+set SHPADMINDIR=C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN

+set SHPADMINEXE=%SHPADMINDIR%\stsadm.exe

+set DEFAULTSERVICENAME=MetaCarta.SharePoint.MCPermissionsService.wsp

+

+echo Installing %DEFAULTSERVICENAME% using %SHPADMINEXE%...

+

+"%SHPADMINEXE%" -o addsolution -filename "%DEFAULTSERVICENAME%"

+"%SHPADMINEXE%" -o execadmsvcjobs

+"%SHPADMINEXE%" -o deploysolution -name "%DEFAULTSERVICENAME%" -immediate -allowGacDeployment -force

+"%SHPADMINEXE%" -o execadmsvcjobs

+

+echo Install complete

diff --git a/webservice/Package/upgrade.bat b/webservice/Package/upgrade.bat
new file mode 100755
index 0000000..2e948b2
--- /dev/null
+++ b/webservice/Package/upgrade.bat
@@ -0,0 +1,32 @@
+REM Licensed to the Apache Software Foundation (ASF) under one or more

+REM contributor license agreements. See the NOTICE file distributed with

+REM this work for additional information regarding copyright ownership.

+REM The ASF licenses this file to You under the Apache License, Version 2.0

+REM (the "License"); you may not use this file except in compliance with

+REM the License. You may obtain a copy of the License at

+REM

+REM http://www.apache.org/licenses/LICENSE-2.0

+REM

+REM Unless required by applicable law or agreed to in writing, software

+REM distributed under the License is distributed on an "AS IS" BASIS,

+REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+REM See the License for the specific language governing permissions and

+REM limitations under the License.

+

+set SHPADMINDIR=C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN

+set SHPADMINEXE=%SHPADMINDIR%\stsadm.exe

+set DEFAULTSERVICENAME=MetaCarta.SharePoint.MCPermissionsService.wsp

+

+echo Upgrading %DEFAULTSERVICENAME% using %SHPADMINEXE%...

+

+"%SHPADMINEXE%" -o retractsolution -name "%DEFAULTSERVICENAME%" -immediate

+"%SHPADMINEXE%" -o execadmsvcjobs

+"%SHPADMINEXE%" -o deletesolution -name "%DEFAULTSERVICENAME%" -override

+"%SHPADMINEXE%" -o execadmsvcjobs

+

+"%SHPADMINEXE%" -o addsolution -filename "%DEFAULTSERVICENAME%"

+"%SHPADMINEXE%" -o execadmsvcjobs

+"%SHPADMINEXE%" -o deploysolution -name "%DEFAULTSERVICENAME%" -immediate -allowGacDeployment -force

+"%SHPADMINEXE%" -o execadmsvcjobs

+

+echo Upgrade complete

diff --git a/webservice/Properties/AssemblyInfo.cs b/webservice/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..eda7dfd
--- /dev/null
+++ b/webservice/Properties/AssemblyInfo.cs
@@ -0,0 +1,35 @@
+using System.Reflection;

+using System.Runtime.CompilerServices;

+using System.Runtime.InteropServices;

+

+// General Information about an assembly is controlled through the following 

+// set of attributes. Change these attribute values to modify the information

+// associated with an assembly.

+[assembly: AssemblyTitle("PermissionsService")]

+[assembly: AssemblyDescription("")]

+[assembly: AssemblyConfiguration("")]

+[assembly: AssemblyCompany("")]

+[assembly: AssemblyProduct("PermissionsService")]

+[assembly: AssemblyCopyright("Copyright ©  2008")]

+[assembly: AssemblyTrademark("")]

+[assembly: AssemblyCulture("")]

+

+// Setting ComVisible to false makes the types in this assembly not visible 

+// to COM components.  If you need to access a type in this assembly from 

+// COM, set the ComVisible attribute to true on that type.

+[assembly: ComVisible(false)]

+

+// The following GUID is for the ID of the typelib if this project is exposed to COM

+[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]

+

+// Version information for an assembly consists of the following four values:

+//

+//      Major Version

+//      Minor Version 

+//      Build Number

+//      Revision

+//

+// You can specify all the values or you can default the Revision and Build Numbers 

+// by using the '*' as shown below:

+[assembly: AssemblyVersion("1.0.0.0")]

+[assembly: AssemblyFileVersion("1.0.0.0")]

diff --git a/webservice/Properties/Settings.Designer.cs b/webservice/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..8e2b541
--- /dev/null
+++ b/webservice/Properties/Settings.Designer.cs
@@ -0,0 +1,36 @@
+//------------------------------------------------------------------------------

+// <auto-generated>

+//     This code was generated by a tool.

+//     Runtime Version:2.0.50727.832

+//

+//     Changes to this file may cause incorrect behavior and will be lost if

+//     the code is regenerated.

+// </auto-generated>

+//------------------------------------------------------------------------------

+

+namespace MetaCarta.SharePoint.Properties {

+    

+    

+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]

+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]

+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {

+        

+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

+        

+        public static Settings Default {

+            get {

+                return defaultInstance;

+            }

+        }

+        

+        [global::System.Configuration.ApplicationScopedSettingAttribute()]

+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]

+        [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]

+        [global::System.Configuration.DefaultSettingValueAttribute("http://magenicwss3/_vti_bin/Permissions.asmx")]

+        public string MetaCarta_SharePoint_SPPermissionsService_Permissions {

+            get {

+                return ((string)(this["MetaCarta_SharePoint_SPPermissionsService_Permissions"]));

+            }

+        }

+    }

+}

diff --git a/webservice/Properties/Settings.settings b/webservice/Properties/Settings.settings
new file mode 100644
index 0000000..d9e4535
--- /dev/null
+++ b/webservice/Properties/Settings.settings
@@ -0,0 +1,9 @@
+<?xml version='1.0' encoding='utf-8'?>

+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="MetaCarta.SharePoint.Properties" GeneratedClassName="Settings">

+  <Profiles />

+  <Settings>

+    <Setting Name="MetaCarta_SharePoint_SPPermissionsService_Permissions" Type="(Web Service URL)" Scope="Application">

+      <Value Profile="(Default)">http://magenicwss3/_vti_bin/Permissions.asmx</Value>

+    </Setting>

+  </Settings>

+</SettingsFile>
\ No newline at end of file
diff --git a/webservice/Web References/SPPermissionsService/Reference.cs b/webservice/Web References/SPPermissionsService/Reference.cs
new file mode 100644
index 0000000..6bbfa2c
--- /dev/null
+++ b/webservice/Web References/SPPermissionsService/Reference.cs
@@ -0,0 +1,368 @@
+//------------------------------------------------------------------------------

+// <auto-generated>

+//     This code was generated by a tool.

+//     Runtime Version:2.0.50727.832

+//

+//     Changes to this file may cause incorrect behavior and will be lost if

+//     the code is regenerated.

+// </auto-generated>

+//------------------------------------------------------------------------------

+

+// 

+// This source code was auto-generated by Microsoft.VSDesigner, Version 2.0.50727.832.

+// 

+#pragma warning disable 1591

+

+namespace MetaCarta.SharePoint.SPPermissionsService {

+    using System.Diagnostics;

+    using System.Web.Services;

+    using System.ComponentModel;

+    using System.Web.Services.Protocols;

+    using System;

+    using System.Xml.Serialization;

+    

+    

+    /// <remarks/>

+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]

+    [System.Diagnostics.DebuggerStepThroughAttribute()]

+    [System.ComponentModel.DesignerCategoryAttribute("code")]

+    [System.Web.Services.WebServiceBindingAttribute(Name="PermissionsSoap", Namespace="http://schemas.microsoft.com/sharepoint/soap/directory/")]

+    public partial class Permissions : System.Web.Services.Protocols.SoapHttpClientProtocol {

+        

+        private System.Threading.SendOrPostCallback GetPermissionCollectionOperationCompleted;

+        

+        private System.Threading.SendOrPostCallback AddPermissionOperationCompleted;

+        

+        private System.Threading.SendOrPostCallback AddPermissionCollectionOperationCompleted;

+        

+        private System.Threading.SendOrPostCallback UpdatePermissionOperationCompleted;

+        

+        private System.Threading.SendOrPostCallback RemovePermissionOperationCompleted;

+        

+        private System.Threading.SendOrPostCallback RemovePermissionCollectionOperationCompleted;

+        

+        private bool useDefaultCredentialsSetExplicitly;

+        

+        /// <remarks/>

+        public Permissions() {

+            this.Url = "http://magenicwss3/_vti_bin/Permissions.asmx";

+            if ((this.IsLocalFileSystemWebService(this.Url) == true)) {

+                this.UseDefaultCredentials = true;

+                this.useDefaultCredentialsSetExplicitly = false;

+            }

+            else {

+                this.useDefaultCredentialsSetExplicitly = true;

+            }

+        }

+        

+        public new string Url {

+            get {

+                return base.Url;

+            }

+            set {

+                if ((((this.IsLocalFileSystemWebService(base.Url) == true) 

+                            && (this.useDefaultCredentialsSetExplicitly == false)) 

+                            && (this.IsLocalFileSystemWebService(value) == false))) {

+                    base.UseDefaultCredentials = false;

+                }

+                base.Url = value;

+            }

+        }

+        

+        public new bool UseDefaultCredentials {

+            get {

+                return base.UseDefaultCredentials;

+            }

+            set {

+                base.UseDefaultCredentials = value;

+                this.useDefaultCredentialsSetExplicitly = true;

+            }

+        }

+        

+        /// <remarks/>

+        public event GetPermissionCollectionCompletedEventHandler GetPermissionCollectionCompleted;

+        

+        /// <remarks/>

+        public event AddPermissionCompletedEventHandler AddPermissionCompleted;

+        

+        /// <remarks/>

+        public event AddPermissionCollectionCompletedEventHandler AddPermissionCollectionCompleted;

+        

+        /// <remarks/>

+        public event UpdatePermissionCompletedEventHandler UpdatePermissionCompleted;

+        

+        /// <remarks/>

+        public event RemovePermissionCompletedEventHandler RemovePermissionCompleted;

+        

+        /// <remarks/>

+        public event RemovePermissionCollectionCompletedEventHandler RemovePermissionCollectionCompleted;

+        

+        /// <remarks/>

+        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/directory/GetPermissionCollection", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

+        public System.Xml.XmlNode GetPermissionCollection(string objectName, string objectType) {

+            object[] results = this.Invoke("GetPermissionCollection", new object[] {

+                        objectName,

+                        objectType});

+            return ((System.Xml.XmlNode)(results[0]));

+        }

+        

+        /// <remarks/>

+        public void GetPermissionCollectionAsync(string objectName, string objectType) {

+            this.GetPermissionCollectionAsync(objectName, objectType, null);

+        }

+        

+        /// <remarks/>

+        public void GetPermissionCollectionAsync(string objectName, string objectType, object userState) {

+            if ((this.GetPermissionCollectionOperationCompleted == null)) {

+                this.GetPermissionCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetPermissionCollectionOperationCompleted);

+            }

+            this.InvokeAsync("GetPermissionCollection", new object[] {

+                        objectName,

+                        objectType}, this.GetPermissionCollectionOperationCompleted, userState);

+        }

+        

+        private void OnGetPermissionCollectionOperationCompleted(object arg) {

+            if ((this.GetPermissionCollectionCompleted != null)) {

+                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));

+                this.GetPermissionCollectionCompleted(this, new GetPermissionCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));

+            }

+        }

+        

+        /// <remarks/>

+        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/directory/AddPermission", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

+        public void AddPermission(string objectName, string objectType, string permissionIdentifier, string permissionType, int permissionMask) {

+            this.Invoke("AddPermission", new object[] {

+                        objectName,

+                        objectType,

+                        permissionIdentifier,

+                        permissionType,

+                        permissionMask});

+        }

+        

+        /// <remarks/>

+        public void AddPermissionAsync(string objectName, string objectType, string permissionIdentifier, string permissionType, int permissionMask) {

+            this.AddPermissionAsync(objectName, objectType, permissionIdentifier, permissionType, permissionMask, null);

+        }

+        

+        /// <remarks/>

+        public void AddPermissionAsync(string objectName, string objectType, string permissionIdentifier, string permissionType, int permissionMask, object userState) {

+            if ((this.AddPermissionOperationCompleted == null)) {

+                this.AddPermissionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddPermissionOperationCompleted);

+            }

+            this.InvokeAsync("AddPermission", new object[] {

+                        objectName,

+                        objectType,

+                        permissionIdentifier,

+                        permissionType,

+                        permissionMask}, this.AddPermissionOperationCompleted, userState);

+        }

+        

+        private void OnAddPermissionOperationCompleted(object arg) {

+            if ((this.AddPermissionCompleted != null)) {

+                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));

+                this.AddPermissionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));

+            }

+        }

+        

+        /// <remarks/>

+        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/directory/AddPermissionCollection", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

+        public void AddPermissionCollection(string objectName, string objectType, System.Xml.XmlNode permissionsInfoXml) {

+            this.Invoke("AddPermissionCollection", new object[] {

+                        objectName,

+                        objectType,

+                        permissionsInfoXml});

+        }

+        

+        /// <remarks/>

+        public void AddPermissionCollectionAsync(string objectName, string objectType, System.Xml.XmlNode permissionsInfoXml) {

+            this.AddPermissionCollectionAsync(objectName, objectType, permissionsInfoXml, null);

+        }

+        

+        /// <remarks/>

+        public void AddPermissionCollectionAsync(string objectName, string objectType, System.Xml.XmlNode permissionsInfoXml, object userState) {

+            if ((this.AddPermissionCollectionOperationCompleted == null)) {

+                this.AddPermissionCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddPermissionCollectionOperationCompleted);

+            }

+            this.InvokeAsync("AddPermissionCollection", new object[] {

+                        objectName,

+                        objectType,

+                        permissionsInfoXml}, this.AddPermissionCollectionOperationCompleted, userState);

+        }

+        

+        private void OnAddPermissionCollectionOperationCompleted(object arg) {

+            if ((this.AddPermissionCollectionCompleted != null)) {

+                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));

+                this.AddPermissionCollectionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));

+            }

+        }

+        

+        /// <remarks/>

+        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/directory/UpdatePermission", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

+        public void UpdatePermission(string objectName, string objectType, string permissionIdentifier, string permissionType, int permissionMask) {

+            this.Invoke("UpdatePermission", new object[] {

+                        objectName,

+                        objectType,

+                        permissionIdentifier,

+                        permissionType,

+                        permissionMask});

+        }

+        

+        /// <remarks/>

+        public void UpdatePermissionAsync(string objectName, string objectType, string permissionIdentifier, string permissionType, int permissionMask) {

+            this.UpdatePermissionAsync(objectName, objectType, permissionIdentifier, permissionType, permissionMask, null);

+        }

+        

+        /// <remarks/>

+        public void UpdatePermissionAsync(string objectName, string objectType, string permissionIdentifier, string permissionType, int permissionMask, object userState) {

+            if ((this.UpdatePermissionOperationCompleted == null)) {

+                this.UpdatePermissionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdatePermissionOperationCompleted);

+            }

+            this.InvokeAsync("UpdatePermission", new object[] {

+                        objectName,

+                        objectType,

+                        permissionIdentifier,

+                        permissionType,

+                        permissionMask}, this.UpdatePermissionOperationCompleted, userState);

+        }

+        

+        private void OnUpdatePermissionOperationCompleted(object arg) {

+            if ((this.UpdatePermissionCompleted != null)) {

+                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));

+                this.UpdatePermissionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));

+            }

+        }

+        

+        /// <remarks/>

+        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/directory/RemovePermission", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

+        public void RemovePermission(string objectName, string objectType, string permissionIdentifier, string permissionType) {

+            this.Invoke("RemovePermission", new object[] {

+                        objectName,

+                        objectType,

+                        permissionIdentifier,

+                        permissionType});

+        }

+        

+        /// <remarks/>

+        public void RemovePermissionAsync(string objectName, string objectType, string permissionIdentifier, string permissionType) {

+            this.RemovePermissionAsync(objectName, objectType, permissionIdentifier, permissionType, null);

+        }

+        

+        /// <remarks/>

+        public void RemovePermissionAsync(string objectName, string objectType, string permissionIdentifier, string permissionType, object userState) {

+            if ((this.RemovePermissionOperationCompleted == null)) {

+                this.RemovePermissionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemovePermissionOperationCompleted);

+            }

+            this.InvokeAsync("RemovePermission", new object[] {

+                        objectName,

+                        objectType,

+                        permissionIdentifier,

+                        permissionType}, this.RemovePermissionOperationCompleted, userState);

+        }

+        

+        private void OnRemovePermissionOperationCompleted(object arg) {

+            if ((this.RemovePermissionCompleted != null)) {

+                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));

+                this.RemovePermissionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));

+            }

+        }

+        

+        /// <remarks/>

+        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://schemas.microsoft.com/sharepoint/soap/directory/RemovePermissionCollection" +

+            "", RequestNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", ResponseNamespace="http://schemas.microsoft.com/sharepoint/soap/directory/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

+        public void RemovePermissionCollection(string objectName, string objectType, System.Xml.XmlNode memberIdsXml) {

+            this.Invoke("RemovePermissionCollection", new object[] {

+                        objectName,

+                        objectType,

+                        memberIdsXml});

+        }

+        

+        /// <remarks/>

+        public void RemovePermissionCollectionAsync(string objectName, string objectType, System.Xml.XmlNode memberIdsXml) {

+            this.RemovePermissionCollectionAsync(objectName, objectType, memberIdsXml, null);

+        }

+        

+        /// <remarks/>

+        public void RemovePermissionCollectionAsync(string objectName, string objectType, System.Xml.XmlNode memberIdsXml, object userState) {

+            if ((this.RemovePermissionCollectionOperationCompleted == null)) {

+                this.RemovePermissionCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnRemovePermissionCollectionOperationCompleted);

+            }

+            this.InvokeAsync("RemovePermissionCollection", new object[] {

+                        objectName,

+                        objectType,

+                        memberIdsXml}, this.RemovePermissionCollectionOperationCompleted, userState);

+        }

+        

+        private void OnRemovePermissionCollectionOperationCompleted(object arg) {

+            if ((this.RemovePermissionCollectionCompleted != null)) {

+                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));

+                this.RemovePermissionCollectionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));

+            }

+        }

+        

+        /// <remarks/>

+        public new void CancelAsync(object userState) {

+            base.CancelAsync(userState);

+        }

+        

+        private bool IsLocalFileSystemWebService(string url) {

+            if (((url == null) 

+                        || (url == string.Empty))) {

+                return false;

+            }

+            System.Uri wsUri = new System.Uri(url);

+            if (((wsUri.Port >= 1024) 

+                        && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {

+                return true;

+            }

+            return false;

+        }

+    }

+    

+    /// <remarks/>

+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]

+    public delegate void GetPermissionCollectionCompletedEventHandler(object sender, GetPermissionCollectionCompletedEventArgs e);

+    

+    /// <remarks/>

+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]

+    [System.Diagnostics.DebuggerStepThroughAttribute()]

+    [System.ComponentModel.DesignerCategoryAttribute("code")]

+    public partial class GetPermissionCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {

+        

+        private object[] results;

+        

+        internal GetPermissionCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 

+                base(exception, cancelled, userState) {

+            this.results = results;

+        }

+        

+        /// <remarks/>

+        public System.Xml.XmlNode Result {

+            get {

+                this.RaiseExceptionIfNecessary();

+                return ((System.Xml.XmlNode)(this.results[0]));

+            }

+        }

+    }

+    

+    /// <remarks/>

+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]

+    public delegate void AddPermissionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);

+    

+    /// <remarks/>

+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]

+    public delegate void AddPermissionCollectionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);

+    

+    /// <remarks/>

+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]

+    public delegate void UpdatePermissionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);

+    

+    /// <remarks/>

+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]

+    public delegate void RemovePermissionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);

+    

+    /// <remarks/>

+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "2.0.50727.42")]

+    public delegate void RemovePermissionCollectionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);

+}

+

+#pragma warning restore 1591
\ No newline at end of file
diff --git a/webservice/Web References/SPPermissionsService/Reference.map b/webservice/Web References/SPPermissionsService/Reference.map
new file mode 100644
index 0000000..446e396
--- /dev/null
+++ b/webservice/Web References/SPPermissionsService/Reference.map
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>

+<DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

+  <Results>

+    <DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://magenicwss3/_vti_bin/Permissions.asmx?wsdl" filename="Permissions.wsdl" />

+    <DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://localhost/_vti_bin/Permissions.asmx?disco" filename="Permissions.disco" />

+  </Results>

+</DiscoveryClientResultsFile>
\ No newline at end of file
diff --git a/webservice/build.bat b/webservice/build.bat
new file mode 100644
index 0000000..22b0e70
--- /dev/null
+++ b/webservice/build.bat
@@ -0,0 +1,33 @@
+@echo off

+REM Licensed to the Apache Software Foundation (ASF) under one or more

+REM contributor license agreements. See the NOTICE file distributed with

+REM this work for additional information regarding copyright ownership.

+REM The ASF licenses this file to You under the Apache License, Version 2.0

+REM (the "License"); you may not use this file except in compliance with

+REM the License. You may obtain a copy of the License at

+REM

+REM http://www.apache.org/licenses/LICENSE-2.0

+REM

+REM Unless required by applicable law or agreed to in writing, software

+REM distributed under the License is distributed on an "AS IS" BASIS,

+REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+REM See the License for the specific language governing permissions and

+REM limitations under the License.

+

+REM Command-line build script for the ManifoldCF SharePoint web service extension.

+REM $Id$

+

+REM This build script handles only changes to the code itself; changing other things (like the form of the WSDL) requires more work.

+REM The following article describes how to create and modify the static discovery and WSDL files:  http://msdn.microsoft.com/en-us/library/ms464040.aspx

+REM The following article describes how to change the payload specified in manifest.xml and MCPermissionsService.ddf: http://msdn.microsoft.com/en-us/library/ms916839.aspx

+REM The following article describes the overall packaging needed to build a SharePoint web extension: http://msdn.microsoft.com/en-us/library/ms916839.aspx#sharepoint_deployingwebparts_topic2

+

+REM Get rid of old stuff, in case it is there

+del bin\*.dll

+del Packages\*.wsp

+

+REM Build the dll

+c:\windows\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe MCPermissionsService.csproj

+REM Build the wsp

+c:\windows\system32\makecab.exe /f MCPermissionsService.ddf

+

diff --git a/webservice/manifest.xml b/webservice/manifest.xml
new file mode 100644
index 0000000..569040a
--- /dev/null
+++ b/webservice/manifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<Solution SolutionId="2b046d97-9511-4839-9994-235816c9e79d" xmlns="http://schemas.microsoft.com/sharepoint/">
+  <Assemblies>
+    <Assembly Location="MetaCarta.SharePoint.dll" DeploymentTarget="GlobalAssemblyCache" />
+  </Assemblies>
+  <RootFiles>
+    <RootFile Location="ISAPI\MCPermissions.asmx" />
+    <RootFile Location="ISAPI\MCPermissionsdisco.aspx" />
+    <RootFile Location="ISAPI\MCPermissionswsdl.aspx" />
+  </RootFiles>
+</Solution>
\ No newline at end of file
diff --git a/webservice/readme.txt b/webservice/readme.txt
new file mode 100644
index 0000000..824266f
--- /dev/null
+++ b/webservice/readme.txt
@@ -0,0 +1,114 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+MCPermissions SharePoint Web Service
+=============================
+
+I.  SharePoint Web Services Model
+
+The ManifoldCF SharePoint Connector only communicates with SharePoint
+through web services.  SharePoint has a well-developed web services API,
+along with a very convenient deployment model which allows additional,
+custom web services to be easily deployed, even across entire SharePoint
+server farms (their notion of a cluster).  The intention by Microsoft was clearly
+to make it straightforward for third parties to develop and sell and/or distribute
+custom web services which augment the capabilities of the SharePoint system.
+
+SharePoint WebServices are usually written in C#.  SharePoint itself runs on the
+.NET platform, so the language choice is not technically limited; however, I
+believe that the primary internal API's for SharePoint are all in C#, which does
+tend to push writers of SharePoint web services towards that language.
+
+
+II.  SharePoint Hierarchy
+
+SharePoint defines objects in a hierarchical manner, based on http or https urls
+served by IIS.  SharePoint hooks into IIS by taking over an
+IIS "website", and serving all paths for that port.  There is always a primary "root site",
+which has an empty path, and there can be (optionally) a number of "virtual paths"
+as well, each one of which functions like a root site in everything but name.
+The path of a virtual path root typically has the form: "sites/xxx", but you can define
+virtual paths with any prefix you want.
+
+Beneath the primary root site and each virtual path root you can find subsites
+(nested as deep as you like, so there are subsites of subsites etc.), libraries, lists,
+and a bunch of other entities we don't really care about.  Documents are found only
+in libraries (as far as we know to date).  Within a library you can also have folders,
+which grant further structure to the library.
+
+Here a simple example of a potential SharePoint url:
+
+http://servername.domain:port/sites/virtualrootname1/subsitelevel1/subsitelevel2/library/folderlevel1/folderlevel2/document.xls
+
+In this case, the url describes a document within a folder within an enclosing folder
+within a library that is part of a subsite that is a child of a parent subsite that is the
+child of a virtual path root.
+
+SharePoint web service .aspx files are always deployed under the "_vti_bin" path
+underneath each root site and subsite.
+
+
+III.  SharePoint Security Model
+
+SharePoint uses Active Directory security exclusively.  People with appropriate
+rights can attach AD users or groups to various objects in SharePoint.  Rights are
+always additive in SharePoint; there is no "deny" tokens.  In general, access rights are
+inherited down the hierarchy, unless a user explicitly chooses to break the
+inheritance and set access rights directly for a particular object (and potentially,
+for its children too.)
+
+A.  SharePoint 2.0 Security Model
+
+In SharePoint 2.0, sometimes called SharePoint 2003, one can attach AD users or
+groups to the following: The SharePoint website as a whole, sites (subsites too), and
+libraries.  You cannot set security on folders or files ("items") directly, however.
+
+B.  SharePoint 3.0 Security Model
+
+In SharePoint 3.0, sometimes called SharePoint 2007, one can attach AD users or
+groups to folders and files in, addition to the functionality provided in SharePoint 2.0.
+
+IV.  SharePoint Connector security
+
+In order for the SharePoint Connector to ingest documents with the proper security,
+it must obtain the list of AD SIDs that apply to each document, and ingest those along
+with the document.  This list must take into account SharePoint's notion of access
+inheritance and override.
+
+Luckily, SharePoint provides, out of the box, a web service that does precisely that for
+the web site, sites, and libraries, called the "Permissions" web service.  You use this
+service by providing an identifier (basically, a path) and a type ("web", "site", or "library"),
+and the web service obtains the SIDs of the users and groups for you.  Each acl query
+automatically handled the inheritance of SIDs properly also - so if you asked for the
+SIDs for a library, it would take into account inheritance from sites and the global website.
+
+This web service was sufficient for the SharePoint Connector's security queries in SharePoint 2.0,
+because there was no ability in that release to set permissions directly on folders or files.
+When SharePoint 3.0 was released, and new folder and item security levels were permitted,
+one would have thought that Microsoft would have augmented the Permissions web
+service accordingly.  Unfortunately, however, they did not.  No other out-of-the-box
+web services which performed this necessary functionality were available either.  We did
+inquire (through Magenic, MetaCarta's SharePoint contractor) whether Microsoft would be willing to
+release an augmented Permissions service as a patch, but they declined to do so.
+
+As a result, MetaCarta Inc. asked Magenic to provide a web service that did what was needed: give
+access to item and folder level security information.  What they eventually provided
+was a web service that looks identical to the Permissions web service, except that it
+understands the types "folder" and "item" as well as the other types.  The MCPermissions
+web service also performs the necessary inheritance so that the SharePoint Connector
+could simply ask for the SIDs for an item, and it would get all the inherited SIDs, as appropriate.
+
+This web service was granted to the Apache Software Foundation by MetaCarta, Inc. as part of
+the entire ManifoldCF software grant.