Invoking WCF REST Services

To Invoke WCF REST Services, Proxy Parameters are required, as mentioned below.

Proxy Parameters:

To consume all WCF REST Services, user needs to pass the Proxy Class (Username, Password, Return Type) and Mandatory Fields (mentioned in the note for every JSON Object Input Parameters) to get the Output.

Service authenticates the credentials first, and then processes the User Request.

Note:

These authentication parameters are applicable for all WCF Rest Services methods

REST Service Call Source Code

Example

WebClient webClient = new WebClient(); webClient.Headers["Content-type"] = "application/JSON"; webClient.Encoding = Encoding.UTF8;
string	body	= "{\"ServiceName\":\"IM_GetIncidentDetailsAndChangeHistory\",\"objCommonParameters\":{\"_ProxyDetails\":{\"Pass word\":\"XXXXX\",\"UserName\":\" test@domain.com\",\"ProxyID\":0,\"ReturnType\":\"JSON\",\"OrgID\":1},\"TicketNo\":6290}}";
string URL = "http://<Customer_URL>/REST/Summit_RESTWCF.svc"; string method = "CommonWS_JsonObjCall";
string parameter = "";
string final = string.Format("{0}/RESTService/{1}{2}", URL, method, parameter); string res1 = webClient.UploadString(final, "POST", body); Console.WriteLine(res1);
Console.ReadLine();