404 not found when I try to DELETE from my service

I get a 404 not found when I try to DELETE from my service, on the client side I use this:

On my Service side I use this:

    [OperationContract]
    [WebInvoke(Method = "DELETE", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml, UriTemplate = "/Student")]
    void removeStudent(Student studentID);

    List<Student> students = new List<Student>();
    public void removeStudent(Student studentID)
    {
        students.Remove(students.Find(f => f.StudentID.Equals(studentID)));
    }

Answers


Based on what i see above, you are passing the some text to the URL on the client side BUT expecting a Student object which doesn't seem right.

I think the convention is that the DELETE should have the same URI template as a GET.

  [WebInvoke(Method = "DELETE", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml, UriTemplate = "/{studentID}")]
    void removeStudent(string studentID);

or

void removeStudent(int studentID);

The DELETE Http Verb is not enabled by default. Read this how to fix it.


Need Your Help

Issue with the ClassLoader of ProcessingEnvironment from Maven

java linux eclipse maven classloader

I'm new to maven, and barely handling the concept of ClassLoader.