Home > SharePoint 2010, WCF > Deploy a Custom WCF into SharePoint2010—Part 4

Deploy a Custom WCF into SharePoint2010—Part 4

Deploy a Custom WCF into SharePoint2010—Part 1

Deploy a Custom WCF into SharePoint2010—Part 2

Deploy a Custom WCF into SharePoint2010—Part 3

Deploy a Custom WCF into SharePoint2010—Part 4

In this post, I will show you how to consume the custom WCF using asp.net Ajax. ASP.NET Ajax cannot consume services that are exposed over basicHttpBinding. However, it can consume services that are exposed over webHttpBinding and use the enableWebScript behavior. The steps are shown below:

1. Modify the web.config to add a new endpoint using webHttpBinding and enableWebScript behavior.

2. Deploy the solution and navigate to http://ybest/_vti_bin/ybbest/CustomService.svc/javascript/jsDebug, it will prompt you to download a JavaScript file. This file contains the automatically generated JavaScript proxy that can now be used with ASP.NET Ajax.

3. You can references your JavaScript using ScriptManagerProxy in a SharePoint site page and start consuming the WCF services using the auto-generated service proxy. Please check the JSTestPage.aspx site page in the Source Code for details.

4. Now navigate to http:// ybest /SitePages/JSTestPage.aspx and you will see the results as below.

You can download the source code here.

Advertisements
Categories: SharePoint 2010, WCF
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: