WCF and SharePoint
Recently I was checking options to utilize WCF together with SharePoint. In SharePoint 2007 it was difficult but SharePoint 2010 is different story as it was written in .net 3.5, which fully support WCF. Creating WCF and putting it into SharePoint hive is simple, you need just to remember about a few things:
1. Your implementation class needs following information
[BasicHttpBindingServiceMetadataExchangeEndpointAttribute] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] It will allow SharePoint to automatically create a metadata exchange endpoint for your service
2. You need your own SVC file like this one:<%@ServiceHost Language=”C#” Debug=”true” Service=”MyNameSpace.MyService, $SharePoint.Project.AssemblyFullName$” Factory=”Microsoft.SharePoint.Client.Services.MultipleBaseAddressBasicHttpBindingServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=22.214.171.124, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
This Token is Dll of Microsoft.SharePoint.Client.ServerRuntime
All works fine and there’s no problem with utilize WCF via C# application or SharePoint Designer. But funny thing. When I was trying to useit with InfoPath it doesn’t work… I mean InfoPath can’t understand XML schema of such service. I was trying all solutions and nothing. I even posted the problem on the SharePoint forum , but there’s no feedback and I saw similar problems on the Internet from other users.