private ResponseMsg handleRequest(RequestMsg request) { try { ServerCallContext.__SetThreadLevelContext(request); try { var response = doWork(request); var rhdr = ServerCallContext.GetResponseHeadersOrNull(); if (rhdr != null && response != null) { response.Headers = rhdr; } return(response); } finally { ServerCallContext.__ResetThreadLevelContext(); } } catch (Exception error) { if (request.OneWay) { //because it is one-way, the caller will never know about it this.WriteLog(LogSrc.Server, MessageType.Error, string.Format(StringConsts.GLUE_SERVER_ONE_WAY_CALL_ERROR + error.ToMessageWithType()), from: "SrvrHndlr.handleRequest(ReqMsg)", exception: error ); return(null); } else { var red = new WrappedExceptionData(error); var response = new ResponseMsg(request.RequestID, red); response.__SetBindingSpecificContext(request); return(response); } } }