Archive

Posts Tagged ‘wcf’

Creating a custom WCF service in SharePoint Server 2010

October 11, 2012 Leave a comment

Developing a WCF in SharePoint 2007 was not easy Job. and for now in SharePoint Server 2010 ASP.NET web services are obsolete . in SharePoint 2010, the recommended approach is developing WCF. Creating Custom WCF and hosting it in SharePoint 2010 isn’t difficult task where we can achieve that through multiple approaches like using an open source Visual Studio 2010 extension know as Community Kit for SharePoint: Development Tools Edition which makes developing Custom WCF more easily or Creating Empty SharePoint Project , then Map to ISAP folder then add WCF files ( Interface , Classes, Configuration Files) to it.

Here i going to use Community Kit for SharePoint . The Community Kit for SharePoint: Development Tools Edition extends the Visual Studio 2010 SharePoint project system with advanced templates and tools.

Create WCF Service

1- create a new empty SharePoint Project.

2- Select Deploy as farm solution.

3- Add new Item, Right Click on Project Name , then Select WCFService (CKSDEV).

Services Type

There are 3 different type of service

1- SOAP Service.

2- REST Service

3- ADO.NET Data Service

if you want to change the service type,please modify the factory in .SVC

SOAP Service Factory : MultipleBaseAddressBasicHttpBindingServiceHostFactory

REST Service Factory: MultipleBaseAddressWebServiceHostFactory

ADO.NET Service Factory : MultipleBaseAddressDataServiceHostFactory

Browsing Custom WCF Service

After Service deploy, you need to use the service in another projects. First try to access the service in browser. But remember you need to access the MEX endpoint either you will not get the service accessible in browser. To access the MEX endpoint, you should add “/MEX” at the end of the service name as shown below: