public bool ExecuteEvent(RESOClient app, bool preauth) { try { setClientApp(app); setURL(app.clientsettings.GetSetting(settings.oauth_tokenuri)); app.LogData("Begin Login Event"); if (clientsettings.GetSetting(settings.oauth_granttype) == "authorization_code") { if (string.IsNullOrEmpty(app.clientsettings.GetSetting(settings.openid_code))) { app.LogData("No Code Available"); return(false); } } responsedata = app.PostData(getURL(), BuildTokenRequest(app.clientsettings), preauth); if (!string.IsNullOrEmpty(responsedata)) { setResponseData(responsedata); app.LogData("Login Response"); app.LogData("", responsedata); SaveLoginParameters(responsedata); app.oauth_token = oauth_token; } } catch (Exception ex) { app.LogData("LOGIN TRANSACTION ERROR", ex.Message); return(false); //throw ex; } return(true); }
public bool ExecuteEvent(RESOClient app, EventRequest eventitem, string outputdirectory, ref RESOLogging debuglog) { try { if (debuglog != null) { debuglog.LogLabel("EventRequest" + eventitem.url); } responsedata = app.GetData(eventitem.url); responseobject = app.responseobject; app.LogData(eventitem.outputfile); app.LogData(eventitem.outputfile, responsedata); StringBuilder sbresponse = new StringBuilder(); sbresponse.Append("_____________________________REQUEST_____________________________"); sbresponse.Append("\r\n"); sbresponse.Append(app.logrequestheader); sbresponse.Append("\r\n"); sbresponse.Append(eventitem.url); sbresponse.Append("\r\n"); sbresponse.Append("_____________________________RESPONSE_____________________________"); sbresponse.Append("\r\n"); sbresponse.Append(responseobject.StatusCode); sbresponse.Append("\r\n"); sbresponse.Append(responseobject.ResponseHeaders); sbresponse.Append("\r\n"); sbresponse.Append(responseobject.ResponsePayload); sbresponse.Append("\r\n"); using (System.IO.StreamWriter file = new System.IO.StreamWriter(outputdirectory + "\\" + eventitem.outputfile, false)) { file.WriteLine(sbresponse.ToString()); } if (debuglog != null) { debuglog.LogData(sbresponse.ToString()); } } catch (Exception ex) { if (debuglog != null) { debuglog.LogException("OdataTestScriptTransaction:ExecuteEvent", ex.Message); } app.LogData("ERROR", ex.Message); return(false); } return(true); }
public bool ExecuteEvent(RESOClient app) { try { responsedata = app.GetODataMetadata(clientsettings.GetSetting(settings.webapi_uri).TrimEnd('/') + "/$metadata"); app.LogData("Response Data"); app.LogData("METADATA", responsedata); } catch (Exception ex) { app.LogData("ERROR", ex.Message); return(false); } return(true); }
public bool ExecuteEvent(RESOClient app) { try { string host = app.clientsettings.GetSetting(settings.webapi_uri).TrimEnd('/'); host = host + "/"; responsedata = app.GetData(host); app.LogData("Service Data"); app.LogData("SERVICE DATA", responsedata); } catch (Exception ex) { app.LogData("ERROR", ex.Message); return(false); } return(true); }