public void GetRequestStatus(string id) { RequestStatus status = null; try { OutgoingWebResponseContext context = WebOperationContext.Current.OutgoingResponse; status = _adapterProvider.GetRequestStatus(id); if (status.State == State.NotFound) { WebOperationContext.Current.OutgoingResponse.StatusCode = HttpStatusCode.NotFound; } } catch (Exception ex) { status = new RequestStatus() { State = State.Error, Message = ex.Message }; } _adapterProvider.FormatOutgoingMessage <RequestStatus>(status, "xml", true); }