How to pass an array of strings to WCF REST via a DELETE request?
the contract
[OperationContract(IsOneWay = true)] [WebInvoke(Method = "DELETE")] void DeleteFiles(string[] filesPath); Call
public void DeleteFiles(string[] filesPath) { var request = WebRequest.Create("http://localhost:8733/FileServer/DeleteFiles"); request.Method = HttpMethod.Delete.Method; var requestStream = request.GetRequestStream(); var sw = new StreamWriter(requestStream); foreach (var filePath in filesPath) sw.WriteLine(Encoding.UTF8.GetBytes(filePath)); request.GetResponse(); } The DeleteFiles(string[] filesPath) is called, but the filesPath = null variable filesPath = null .
For service I use webHttpBinding .