public Stream getIntegrationObject(string Version, string QueryType, string SessionId, Stream content) { Global.ClearDebugLog( ); Global.WriteServiceMethod("Evado.Integration.Service.Service.getIntegrationObject event method."); Global.WriteServiceLogLine("Version: " + Version); Global.WriteServiceLogLine("QueryType: " + QueryType); Global.WriteServiceLogLine("SessionId: " + SessionId); Global.WriteDebugLogMethod("Evado.Integration.Service.WcfRestService.getPageObject event method."); Global.WriteDebugLogLine("Version: " + Version); Global.WriteDebugLogLine("QueryType: " + QueryType); Global.WriteDebugLogLine("SessionId: " + SessionId); try { // // Initialise the methods variables and object. // string json = String.Empty; Evado.Digital.Bll.EiServices integrationServices = new Evado.Digital.Bll.EiServices( ); this._ClientVersion = Evado.Model.EvStatics.decodeMinorVersion(Version); Evado.Digital.Bll.EvStaticSetting.DebugOn = Global.DebugLogOn; Global.WriteServiceLogLine("ClientVersion: " + this._ClientVersion); Global.WriteServiceLogLine("Context SessionId: " + this._Context.Session.SessionID); Global.WriteDebugLogLine("ClientVersion: " + this._ClientVersion); Global.WriteDebugLogLine("Context SessionId: " + this._Context.Session.SessionID); // // first load the POST payload into a string // the POST content comes from the content param above // as it is the only param that is not listed in the URI template // string content_value = new StreamReader(content).ReadToEnd( ); // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #region Step 1 set session and deserialise json // // Deserialise the commandobjects. // Global.WriteDebugLogMethod("STEP 1 : Deserializing the json command object."); Global.WriteServiceMethod("STEP 1 : Deserializing the json command object."); // // if content value is empty then send a login request. // if (content_value == String.Empty) { Global.WriteDebugLogLine("POST content is empty."); this._ReturnData = new Evado.Integration.Model.EiData( ); this._ReturnData.EventCode = Evado.Integration.Model.EiEventCodes.WebServices_JSON_Empty_Error; this._ReturnData.ErrorMessage = "Received JSON object was empty."; // // send the web service response to the device app. // return(this.generateWebServiceResponse( )); } Global.WriteDebugLogLine("CONTENT: " + content_value); // // attempt to convert this JSON payload to a C# structure try { // // serialise the client groupCommand // this._ReceivedData = JsonConvert.DeserializeObject <Evado.Integration.Model.EiData> (content_value); String eventMessage = "Query Recieved from " + this._UserId + " querying project " + this._ReceivedData.GetQueryParameterValue(Evado.Integration.Model.EiQueryParameterNames.Project_Id) + " executing query type " + this._ReceivedData.QueryType; EventLog.WriteEntry(Global.EventLogSource, eventMessage, EventLogEntryType.Information); Global.WriteDebugLogLine(eventMessage); } catch (Exception Ex) { this._ReturnData = new Evado.Integration.Model.EiData( ); this._ReturnData.EventCode = Evado.Integration.Model.EiEventCodes.WebServices_JSON_Deserialisation_Failed_Error; this._ReturnData.ErrorMessage = "JSON object deserialisation error."; String EventMessage = evado.model.Properties.Resources.JSON_DESERIALISATION_ERROR + "\r\n" + getExceptionAsString(Ex); EventLog.WriteEntry(Global.EventLogSource, this._DebugLog.ToString( ), EventLogEntryType.Error); Global.WriteDebugLogLine(EventMessage); Global.WriteServiceMethod(EventMessage); return(generateErrorWebServiceResponse(Ex)); } Global.WriteDebugLogLine(this._ReceivedData.getAsString( )); #endregion // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ #region Step 2: Process the user's groupCommand request Global.WriteDebugLogMethod("STEP 2 : Process the user's query request."); Global.WriteServiceMethod("STEP 2 : Process the user's query request."); Global.WriteDebugLogLine("EvStaticSetting.DebugOn: " + Evado.Digital.Bll.EvStaticSetting.DebugOn); // // execute the query // this._ReturnData = integrationServices.ProcessQuery(this._ReceivedData); // // Return the debug log. // Global.WriteDebugLogLine(integrationServices.Log); // // Return the debug log. // Global.WriteDebugLogLine("Process log: " + integrationServices.ProcessLog + " END log"); // // Log errored return event codes. // if (this._ReturnData == null) { this._ReturnData = new Evado.Integration.Model.EiData( ); this._ReturnData.EventCode = Evado.Integration.Model.EiEventCodes.Data_Null_Data_Error; this._ReturnData.ErrorMessage = "Query failed null data returned."; Global.WriteDebugLogLine("Integration Service return Event " + Evado.Integration.Model.EiEventCodes.Data_Null_Data_Error); EventLog.WriteEntry( Global.EventLogSource, "Integration Services return Event " + Evado.Integration.Model.EiEventCodes.Data_Null_Data_Error, EventLogEntryType.Error); } else { if (this._ReturnData.EventCode != Evado.Integration.Model.EiEventCodes.Ok) { Global.WriteDebugLogLine("Integration Service return Event " + this._ReturnData.EventCode); EventLog.WriteEntry( Global.EventLogSource, "Integration Services return Event " + this._ReturnData.EventCode, EventLogEntryType.Error); } } // // send the web service response to the device app. // return(this.generateWebServiceResponse( )); #endregion } catch (Exception Ex) { string EventMessage = "Evado.UniForm.Service.c event method.\r\n" + Ex.ToString( ); EventLog.WriteEntry(Global.EventLogSource, EventMessage, EventLogEntryType.Error); Global.WriteServiceMethod(EventMessage); return(generateErrorWebServiceResponse(Ex)); } // Close catch } //END Create web method.