GraphQL: fix cert store access
This commit is contained in:
@@ -63,8 +63,10 @@ Public Class frmMain
|
||||
txtProxyPort.Text = _Config.Config.ProxyPort
|
||||
txtProxyUser.Text = _Config.Config.ProxyUsername
|
||||
txtProxyPass.Text = _Config.Config.ProxyPassword
|
||||
txtQuery.Text = _Config.Config.CustomQueryString
|
||||
|
||||
ComboBox1.SelectedIndex = 0
|
||||
Dim oIndex = cmbQuery.FindStringExact(_Config.Config.CurrentQuery)
|
||||
cmbQuery.SelectedIndex = oIndex
|
||||
|
||||
_MSSQL = New MSSQLServer(_LogConfig, _Config.Config.ConnectionString)
|
||||
Catch ex As Exception
|
||||
@@ -75,7 +77,6 @@ Public Class frmMain
|
||||
|
||||
Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
|
||||
Try
|
||||
|
||||
_Interface = New GraphQLInterface(_LogConfig,
|
||||
txtBaseUrl.Text,
|
||||
txtUsername.Text,
|
||||
@@ -86,16 +87,20 @@ Public Class frmMain
|
||||
If _Config.Config.HasProxySet() And _Config.Config.HasProxyCredentialsSet() Then
|
||||
Dim oURI As New Uri($"http://{_Config.Config.ProxyHost}:{_Config.Config.ProxyPort}")
|
||||
Dim oCredentials As New NetworkCredential(_Config.Config.ProxyUsername, _Config.Config.ProxyPassword)
|
||||
Dim oProxy As New WebProxy() With {
|
||||
Dim oProxy As New WebProxy(oURI, True) With {
|
||||
.Address = oURI,
|
||||
.UseDefaultCredentials = False,
|
||||
.Credentials = oCredentials
|
||||
}
|
||||
_Interface.Proxy = oProxy
|
||||
_Interface.Credentials = oCredentials
|
||||
|
||||
_Logger.Debug("Using Proxy: {0}", oURI.ToString)
|
||||
_Logger.Debug("Proxy Credentials: [{0}] [{1}]", _Config.Config.ProxyUsername, _Config.Config.ProxyPassword)
|
||||
Else
|
||||
_Interface.Proxy = Nothing
|
||||
_Interface.Credentials = Nothing
|
||||
|
||||
_Logger.Debug("Proxy not set.")
|
||||
End If
|
||||
|
||||
@@ -121,15 +126,15 @@ Public Class frmMain
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If ComboBox1.SelectedIndex = -1 Then
|
||||
If cmbQuery.SelectedIndex = -1 Then
|
||||
MsgBox("Please select a query!", MsgBoxStyle.Exclamation, Text)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If ComboBox1.Text = "SAPDaten" Then
|
||||
If cmbQuery.Text = "SAPDaten" Then
|
||||
_MSSQL.ExecuteNonQuery("DELETE FROM TBCUST_SYNC_API_SAPDATEN")
|
||||
|
||||
txtResults.Text = String.Empty
|
||||
txtResult.Text = String.Empty
|
||||
|
||||
For Each oDatapool In _Datapools
|
||||
Dim oQuery As String = GRAPHQL_QUERY_SAP_DATA.Trim.Replace("__DATA_POOL__", oDatapool)
|
||||
@@ -164,12 +169,33 @@ Public Class frmMain
|
||||
ProgressBar1.Value = oCounter
|
||||
Next
|
||||
|
||||
txtResults.Text &= "--------------------------------------------" & vbNewLine
|
||||
txtResults.Text &= $"--- Datapool: {oDatapool}" & vbNewLine
|
||||
txtResults.Text &= JsonConvert.SerializeObject(oObj, Formatting.Indented) & vbNewLine
|
||||
txtResult.Text &= "--------------------------------------------" & vbNewLine
|
||||
txtResult.Text &= $"--- Datapool: {oDatapool}" & vbNewLine
|
||||
txtResult.Text &= JsonConvert.SerializeObject(oObj, Formatting.Indented) & vbNewLine
|
||||
|
||||
Application.DoEvents()
|
||||
Next
|
||||
ElseIf cmbQuery.Text = "Custom" Then
|
||||
If txtOperation.Text = String.Empty Then
|
||||
MsgBox("Please select an operation!", MsgBoxStyle.Exclamation, Text)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oDataResponse = _Interface.GetData(txtQuery.Text, txtOperation.Text)
|
||||
|
||||
Dim oResult As String
|
||||
|
||||
Using oStream = oDataResponse.GetResponseStream()
|
||||
Using oReader As New StreamReader(oStream)
|
||||
oResult = oReader.ReadToEnd()
|
||||
End Using
|
||||
End Using
|
||||
|
||||
Dim oObj As JObject = JsonConvert.DeserializeObject(oResult)
|
||||
Dim oIndentedJson As String = JsonConvert.SerializeObject(oObj, Formatting.Indented)
|
||||
txtResult.Text = oIndentedJson
|
||||
|
||||
TabControl1.SelectedTab = pageRaw
|
||||
Else
|
||||
MsgBox("Unknown query!", MsgBoxStyle.Exclamation, Text)
|
||||
Exit Sub
|
||||
@@ -192,6 +218,7 @@ Public Class frmMain
|
||||
_Config.Config.ProxyPassword = txtProxyPass.Text
|
||||
_Config.Config.ProxyPort = txtProxyPort.Text
|
||||
_Config.Config.ProxyUsername = txtProxyUser.Text
|
||||
_Config.Config.CustomQueryString = txtQuery.Text
|
||||
_Config.Save(ForceAll:=True)
|
||||
|
||||
Dim oLogoutResponse = _Interface.Logout()
|
||||
@@ -210,4 +237,9 @@ Public Class frmMain
|
||||
|
||||
Return oSAPData
|
||||
End Function
|
||||
|
||||
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbQuery.SelectedIndexChanged
|
||||
_Config.Config.CurrentQuery = cmbQuery.Text
|
||||
_Config.Save()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user