1. Create web service project
2. Create web methods
[WebMethod]
[ScriptMethod(UseHttpGet = true)]
public EntityCollection GetApplications()
{
EntityCollection applications = new EntityCollection(new AppEntityFactory());
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
adapter.FetchEntityCollection(applications,null);
return applications;
}
}
3. Http POST and GET enable for localhost by default. But Hosting we have to enable it. If you want to check your service with inputs you have to do following changes
Edit your web.config file with following tag
webServices>
protocols>
add name="HttpPost"/>
add name="HttpGet"/>
add name="Documentation"/>
add name="HttpPostLocalhost"/>
/protocols>
/webServices>
webServices>
protocols>
remove name="HttpPost" />
remove name="HttpGet" />
remove name="HttpPostLocalhost" />
/protocols>
/webServices>
note:
If this doen't work Edit your machine.config file
No comments:
Post a Comment