Thursday, February 4, 2010

how to call wcf service from jquery

Here I have mentioned how to call WCF using JQuery......

First of all I have created WCF service library using visual studio 2008.Then I have added assembly reference “System.ServiceModel.Web” to my WCF library.Then import this assemply to out interface like this way “using System.ServiceModel.Web;”then declare methods in this interface


[OperationContract]

[WebInvoke(Method="POST",BodyStyle=WebMessageBodyStyle.Wrapped, ResponseFormat=WebMessageFormat.Json)]


string GetData(string value);


After that implement this methods to my class and also create new end point to accress jquery.



WCF Services Test

After that I want to access this WCF to my client application. To my client application import JQuery library to my application. Then put the reference to my page in this way





 







From this code you can able to access WCF in client side.

No comments:

Post a Comment

Amma Bhagavan's Songs