// POST api/values public HttpResponseMessage Post() { const string FLIPPER = "Test"; string xml = Request.Content.ReadAsStringAsync().Result; // Console.WriteLine(xml); if (xml.Contains("<event")) { @event e; try { using (TextReader sr = new StringReader(xml)) { e = (@event)new XmlSerializer(typeof(@event)).Deserialize(sr); } if (e.event_header.entity.Equals("NotifyMe") && e.event_header.event_type.Equals(FLIPPER)) { Flipper flipper = new Flipper(); flipper.Create(e); } else return Request.CreateResponse(HttpStatusCode.BadRequest, "Bad Request"); } catch (Exception ex) { return Request.CreateResponse(HttpStatusCode.Unauthorized, "Unauthorized"); } return Request.CreateResponse(HttpStatusCode.OK); } else return Request.CreateResponse(HttpStatusCode.NotFound, "Not Found"); }