How to Create External Content Type Using WCF Service


In this article we will be seeing how to create an external content type using WCF Service.

External content type can be created in various ways. In this we will be creating a WCF service and using SharePoint Designer 2010 we will be creating the external content type with ReadList and ReadItem operations. Check my previous article "How to create WCF service to retrieve data from the Oracle database" to create the WCF service which we will be using to create the external content type here.

Steps Involved:

I. Open the SharePoint Designer 2010.

share1.gif

ii. Click on Open Site.

iii. Enter the URL of your SharePoint site.

iv. Click OK.

v. Your SharePoint site will be opened in the Designer.

vi. In the Navigation, click on External Content Types.

share2.gif

vii. In the ribbon, click on External Content Type.

share3.gif

viii. In the External Content Type Information enter the Name as ECTUsingWCF.

share4.gif

ix. Click on "Click here to discover external data sources and define operations".

x. In the External Data Source Type Selection choose the Data Source Type as WCF Service and click OK.

share5.gif

xi. Click on Add Connection.

share6.gif

xii. In the WCF Connection wizard enter the WCF service url in the service metadata url http://moss1.cts.com:2010/Service1.svc?wsdl and in the service endpoint url enter http://moss1.cts.com:2010/Service1.svc.

share7.gif

xiii. Click OK; the WCF connection will be established and you will see the methods that we have created in the WCF service.

share8.gif

xiv. Now we are going to create ReadList and ReadItem operations.

xv. Right click on getEmployees and select New Read List Operation.

share9.gif

xvi. In the Read List wizard map Employee_ID to identifier.

share10.gif

xvii. Click Finish.

xviii. Right click on getEmployeesbyID and select New Read Item Operation.

share11.gif

xix. In the Read Item wizard map Employee_ID to identifier.

share12.gif

xx. Click Finish.

xxi. In the External Content Type Connections you will see the operations we have created.

share13.gif

xxii. Save the external content type.

share14.gif