GraphQL: fix cert store access
This commit is contained in:
parent
6e577627d3
commit
967ad15052
@ -10,6 +10,8 @@
|
|||||||
Public Property ProxyPort As Integer = 0
|
Public Property ProxyPort As Integer = 0
|
||||||
Public Property ProxyUsername As String = ""
|
Public Property ProxyUsername As String = ""
|
||||||
Public Property ProxyPassword As String = ""
|
Public Property ProxyPassword As String = ""
|
||||||
|
Public Property CurrentQuery As String = "Custom"
|
||||||
|
Public Property CustomQueryString As String = ""
|
||||||
|
|
||||||
Public Function HasProxySet() As Boolean
|
Public Function HasProxySet() As Boolean
|
||||||
Return ProxyHost <> "" And ProxyPort > 0
|
Return ProxyHost <> "" And ProxyPort > 0
|
||||||
|
|||||||
118
GUIs.Test.GraphQLTest/frmMain.Designer.vb
generated
118
GUIs.Test.GraphQLTest/frmMain.Designer.vb
generated
@ -1,9 +1,9 @@
|
|||||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
|
||||||
Partial Class frmMain
|
Partial Class frmMain
|
||||||
Inherits System.Windows.Forms.Form
|
Inherits System.Windows.Forms.Form
|
||||||
|
|
||||||
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
|
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
|
||||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
<System.Diagnostics.DebuggerNonUserCode()>
|
||||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||||
Try
|
Try
|
||||||
If disposing AndAlso components IsNot Nothing Then
|
If disposing AndAlso components IsNot Nothing Then
|
||||||
@ -20,7 +20,7 @@ Partial Class frmMain
|
|||||||
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
|
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
|
||||||
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
|
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
|
||||||
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
||||||
<System.Diagnostics.DebuggerStepThrough()> _
|
<System.Diagnostics.DebuggerStepThrough()>
|
||||||
Private Sub InitializeComponent()
|
Private Sub InitializeComponent()
|
||||||
Me.Button1 = New System.Windows.Forms.Button()
|
Me.Button1 = New System.Windows.Forms.Button()
|
||||||
Me.txtBaseUrl = New System.Windows.Forms.TextBox()
|
Me.txtBaseUrl = New System.Windows.Forms.TextBox()
|
||||||
@ -33,13 +33,13 @@ Partial Class frmMain
|
|||||||
Me.Label3 = New System.Windows.Forms.Label()
|
Me.Label3 = New System.Windows.Forms.Label()
|
||||||
Me.Label4 = New System.Windows.Forms.Label()
|
Me.Label4 = New System.Windows.Forms.Label()
|
||||||
Me.Label5 = New System.Windows.Forms.Label()
|
Me.Label5 = New System.Windows.Forms.Label()
|
||||||
Me.txtResults = New System.Windows.Forms.TextBox()
|
Me.txtResult = New System.Windows.Forms.TextBox()
|
||||||
Me.txtConnectionString = New System.Windows.Forms.TextBox()
|
Me.txtConnectionString = New System.Windows.Forms.TextBox()
|
||||||
Me.Label6 = New System.Windows.Forms.Label()
|
Me.Label6 = New System.Windows.Forms.Label()
|
||||||
Me.ComboBox1 = New System.Windows.Forms.ComboBox()
|
Me.cmbQuery = New System.Windows.Forms.ComboBox()
|
||||||
Me.Label7 = New System.Windows.Forms.Label()
|
Me.Label7 = New System.Windows.Forms.Label()
|
||||||
Me.TabControl1 = New System.Windows.Forms.TabControl()
|
Me.TabControl1 = New System.Windows.Forms.TabControl()
|
||||||
Me.TabPage1 = New System.Windows.Forms.TabPage()
|
Me.pageRaw = New System.Windows.Forms.TabPage()
|
||||||
Me.btnLogin = New System.Windows.Forms.Button()
|
Me.btnLogin = New System.Windows.Forms.Button()
|
||||||
Me.ProgressBar1 = New System.Windows.Forms.ProgressBar()
|
Me.ProgressBar1 = New System.Windows.Forms.ProgressBar()
|
||||||
Me.txtProxyHost = New System.Windows.Forms.TextBox()
|
Me.txtProxyHost = New System.Windows.Forms.TextBox()
|
||||||
@ -50,8 +50,12 @@ Partial Class frmMain
|
|||||||
Me.Label10 = New System.Windows.Forms.Label()
|
Me.Label10 = New System.Windows.Forms.Label()
|
||||||
Me.txtProxyPort = New System.Windows.Forms.TextBox()
|
Me.txtProxyPort = New System.Windows.Forms.TextBox()
|
||||||
Me.Label11 = New System.Windows.Forms.Label()
|
Me.Label11 = New System.Windows.Forms.Label()
|
||||||
|
Me.pageQuery = New System.Windows.Forms.TabPage()
|
||||||
|
Me.txtQuery = New System.Windows.Forms.TextBox()
|
||||||
|
Me.txtOperation = New System.Windows.Forms.TextBox()
|
||||||
Me.TabControl1.SuspendLayout()
|
Me.TabControl1.SuspendLayout()
|
||||||
Me.TabPage1.SuspendLayout()
|
Me.pageRaw.SuspendLayout()
|
||||||
|
Me.pageQuery.SuspendLayout()
|
||||||
Me.SuspendLayout()
|
Me.SuspendLayout()
|
||||||
'
|
'
|
||||||
'Button1
|
'Button1
|
||||||
@ -148,16 +152,16 @@ Partial Class frmMain
|
|||||||
Me.Label5.TabIndex = 2
|
Me.Label5.TabIndex = 2
|
||||||
Me.Label5.Text = "Cert Pass"
|
Me.Label5.Text = "Cert Pass"
|
||||||
'
|
'
|
||||||
'txtResults
|
'txtResult
|
||||||
'
|
'
|
||||||
Me.txtResults.Dock = System.Windows.Forms.DockStyle.Fill
|
Me.txtResult.Dock = System.Windows.Forms.DockStyle.Fill
|
||||||
Me.txtResults.Font = New System.Drawing.Font("Consolas", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
Me.txtResult.Font = New System.Drawing.Font("Consolas", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||||||
Me.txtResults.Location = New System.Drawing.Point(3, 3)
|
Me.txtResult.Location = New System.Drawing.Point(3, 3)
|
||||||
Me.txtResults.Multiline = True
|
Me.txtResult.Multiline = True
|
||||||
Me.txtResults.Name = "txtResults"
|
Me.txtResult.Name = "txtResult"
|
||||||
Me.txtResults.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
|
Me.txtResult.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
|
||||||
Me.txtResults.Size = New System.Drawing.Size(458, 342)
|
Me.txtResult.Size = New System.Drawing.Size(458, 342)
|
||||||
Me.txtResults.TabIndex = 3
|
Me.txtResult.TabIndex = 3
|
||||||
'
|
'
|
||||||
'txtConnectionString
|
'txtConnectionString
|
||||||
'
|
'
|
||||||
@ -176,14 +180,14 @@ Partial Class frmMain
|
|||||||
Me.Label6.TabIndex = 2
|
Me.Label6.TabIndex = 2
|
||||||
Me.Label6.Text = "ConnectionString"
|
Me.Label6.Text = "ConnectionString"
|
||||||
'
|
'
|
||||||
'ComboBox1
|
'cmbQuery
|
||||||
'
|
'
|
||||||
Me.ComboBox1.FormattingEnabled = True
|
Me.cmbQuery.FormattingEnabled = True
|
||||||
Me.ComboBox1.Items.AddRange(New Object() {"SAPDaten"})
|
Me.cmbQuery.Items.AddRange(New Object() {"SAPDaten", "Custom"})
|
||||||
Me.ComboBox1.Location = New System.Drawing.Point(106, 352)
|
Me.cmbQuery.Location = New System.Drawing.Point(106, 352)
|
||||||
Me.ComboBox1.Name = "ComboBox1"
|
Me.cmbQuery.Name = "cmbQuery"
|
||||||
Me.ComboBox1.Size = New System.Drawing.Size(338, 21)
|
Me.cmbQuery.Size = New System.Drawing.Size(338, 21)
|
||||||
Me.ComboBox1.TabIndex = 4
|
Me.cmbQuery.TabIndex = 4
|
||||||
'
|
'
|
||||||
'Label7
|
'Label7
|
||||||
'
|
'
|
||||||
@ -196,23 +200,24 @@ Partial Class frmMain
|
|||||||
'
|
'
|
||||||
'TabControl1
|
'TabControl1
|
||||||
'
|
'
|
||||||
Me.TabControl1.Controls.Add(Me.TabPage1)
|
Me.TabControl1.Controls.Add(Me.pageRaw)
|
||||||
|
Me.TabControl1.Controls.Add(Me.pageQuery)
|
||||||
Me.TabControl1.Location = New System.Drawing.Point(450, 6)
|
Me.TabControl1.Location = New System.Drawing.Point(450, 6)
|
||||||
Me.TabControl1.Name = "TabControl1"
|
Me.TabControl1.Name = "TabControl1"
|
||||||
Me.TabControl1.SelectedIndex = 0
|
Me.TabControl1.SelectedIndex = 0
|
||||||
Me.TabControl1.Size = New System.Drawing.Size(472, 374)
|
Me.TabControl1.Size = New System.Drawing.Size(472, 374)
|
||||||
Me.TabControl1.TabIndex = 5
|
Me.TabControl1.TabIndex = 5
|
||||||
'
|
'
|
||||||
'TabPage1
|
'pageRaw
|
||||||
'
|
'
|
||||||
Me.TabPage1.Controls.Add(Me.txtResults)
|
Me.pageRaw.Controls.Add(Me.txtResult)
|
||||||
Me.TabPage1.Location = New System.Drawing.Point(4, 22)
|
Me.pageRaw.Location = New System.Drawing.Point(4, 22)
|
||||||
Me.TabPage1.Name = "TabPage1"
|
Me.pageRaw.Name = "pageRaw"
|
||||||
Me.TabPage1.Padding = New System.Windows.Forms.Padding(3)
|
Me.pageRaw.Padding = New System.Windows.Forms.Padding(3)
|
||||||
Me.TabPage1.Size = New System.Drawing.Size(464, 348)
|
Me.pageRaw.Size = New System.Drawing.Size(464, 348)
|
||||||
Me.TabPage1.TabIndex = 0
|
Me.pageRaw.TabIndex = 0
|
||||||
Me.TabPage1.Text = "Raw GraphQL Result"
|
Me.pageRaw.Text = "Raw GraphQL Result"
|
||||||
Me.TabPage1.UseVisualStyleBackColor = True
|
Me.pageRaw.UseVisualStyleBackColor = True
|
||||||
'
|
'
|
||||||
'btnLogin
|
'btnLogin
|
||||||
'
|
'
|
||||||
@ -294,6 +299,36 @@ Partial Class frmMain
|
|||||||
Me.Label11.TabIndex = 2
|
Me.Label11.TabIndex = 2
|
||||||
Me.Label11.Text = "Proxy Port"
|
Me.Label11.Text = "Proxy Port"
|
||||||
'
|
'
|
||||||
|
'pageQuery
|
||||||
|
'
|
||||||
|
Me.pageQuery.Controls.Add(Me.txtQuery)
|
||||||
|
Me.pageQuery.Controls.Add(Me.txtOperation)
|
||||||
|
Me.pageQuery.Location = New System.Drawing.Point(4, 22)
|
||||||
|
Me.pageQuery.Name = "pageQuery"
|
||||||
|
Me.pageQuery.Padding = New System.Windows.Forms.Padding(3)
|
||||||
|
Me.pageQuery.Size = New System.Drawing.Size(464, 348)
|
||||||
|
Me.pageQuery.TabIndex = 1
|
||||||
|
Me.pageQuery.Text = "Custom Query"
|
||||||
|
Me.pageQuery.UseVisualStyleBackColor = True
|
||||||
|
'
|
||||||
|
'txtQuery
|
||||||
|
'
|
||||||
|
Me.txtQuery.Dock = System.Windows.Forms.DockStyle.Fill
|
||||||
|
Me.txtQuery.Font = New System.Drawing.Font("Consolas", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
|
||||||
|
Me.txtQuery.Location = New System.Drawing.Point(3, 23)
|
||||||
|
Me.txtQuery.Multiline = True
|
||||||
|
Me.txtQuery.Name = "txtQuery"
|
||||||
|
Me.txtQuery.Size = New System.Drawing.Size(458, 322)
|
||||||
|
Me.txtQuery.TabIndex = 0
|
||||||
|
'
|
||||||
|
'txtOperation
|
||||||
|
'
|
||||||
|
Me.txtOperation.Dock = System.Windows.Forms.DockStyle.Top
|
||||||
|
Me.txtOperation.Location = New System.Drawing.Point(3, 3)
|
||||||
|
Me.txtOperation.Name = "txtOperation"
|
||||||
|
Me.txtOperation.Size = New System.Drawing.Size(458, 20)
|
||||||
|
Me.txtOperation.TabIndex = 1
|
||||||
|
'
|
||||||
'frmMain
|
'frmMain
|
||||||
'
|
'
|
||||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||||
@ -301,7 +336,7 @@ Partial Class frmMain
|
|||||||
Me.ClientSize = New System.Drawing.Size(934, 429)
|
Me.ClientSize = New System.Drawing.Size(934, 429)
|
||||||
Me.Controls.Add(Me.ProgressBar1)
|
Me.Controls.Add(Me.ProgressBar1)
|
||||||
Me.Controls.Add(Me.TabControl1)
|
Me.Controls.Add(Me.TabControl1)
|
||||||
Me.Controls.Add(Me.ComboBox1)
|
Me.Controls.Add(Me.cmbQuery)
|
||||||
Me.Controls.Add(Me.Label7)
|
Me.Controls.Add(Me.Label7)
|
||||||
Me.Controls.Add(Me.Label6)
|
Me.Controls.Add(Me.Label6)
|
||||||
Me.Controls.Add(Me.Label5)
|
Me.Controls.Add(Me.Label5)
|
||||||
@ -328,8 +363,10 @@ Partial Class frmMain
|
|||||||
Me.Name = "frmMain"
|
Me.Name = "frmMain"
|
||||||
Me.Text = "GraphQL Interface"
|
Me.Text = "GraphQL Interface"
|
||||||
Me.TabControl1.ResumeLayout(False)
|
Me.TabControl1.ResumeLayout(False)
|
||||||
Me.TabPage1.ResumeLayout(False)
|
Me.pageRaw.ResumeLayout(False)
|
||||||
Me.TabPage1.PerformLayout()
|
Me.pageRaw.PerformLayout()
|
||||||
|
Me.pageQuery.ResumeLayout(False)
|
||||||
|
Me.pageQuery.PerformLayout()
|
||||||
Me.ResumeLayout(False)
|
Me.ResumeLayout(False)
|
||||||
Me.PerformLayout()
|
Me.PerformLayout()
|
||||||
|
|
||||||
@ -346,13 +383,13 @@ Partial Class frmMain
|
|||||||
Friend WithEvents Label3 As Label
|
Friend WithEvents Label3 As Label
|
||||||
Friend WithEvents Label4 As Label
|
Friend WithEvents Label4 As Label
|
||||||
Friend WithEvents Label5 As Label
|
Friend WithEvents Label5 As Label
|
||||||
Friend WithEvents txtResults As TextBox
|
Friend WithEvents txtResult As TextBox
|
||||||
Friend WithEvents txtConnectionString As TextBox
|
Friend WithEvents txtConnectionString As TextBox
|
||||||
Friend WithEvents Label6 As Label
|
Friend WithEvents Label6 As Label
|
||||||
Friend WithEvents ComboBox1 As ComboBox
|
Friend WithEvents cmbQuery As ComboBox
|
||||||
Friend WithEvents Label7 As Label
|
Friend WithEvents Label7 As Label
|
||||||
Friend WithEvents TabControl1 As TabControl
|
Friend WithEvents TabControl1 As TabControl
|
||||||
Friend WithEvents TabPage1 As TabPage
|
Friend WithEvents pageRaw As TabPage
|
||||||
Friend WithEvents btnLogin As Button
|
Friend WithEvents btnLogin As Button
|
||||||
Friend WithEvents ProgressBar1 As ProgressBar
|
Friend WithEvents ProgressBar1 As ProgressBar
|
||||||
Friend WithEvents txtProxyHost As TextBox
|
Friend WithEvents txtProxyHost As TextBox
|
||||||
@ -363,4 +400,7 @@ Partial Class frmMain
|
|||||||
Friend WithEvents Label10 As Label
|
Friend WithEvents Label10 As Label
|
||||||
Friend WithEvents txtProxyPort As TextBox
|
Friend WithEvents txtProxyPort As TextBox
|
||||||
Friend WithEvents Label11 As Label
|
Friend WithEvents Label11 As Label
|
||||||
|
Friend WithEvents pageQuery As TabPage
|
||||||
|
Friend WithEvents txtQuery As TextBox
|
||||||
|
Friend WithEvents txtOperation As TextBox
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@ -63,8 +63,10 @@ Public Class frmMain
|
|||||||
txtProxyPort.Text = _Config.Config.ProxyPort
|
txtProxyPort.Text = _Config.Config.ProxyPort
|
||||||
txtProxyUser.Text = _Config.Config.ProxyUsername
|
txtProxyUser.Text = _Config.Config.ProxyUsername
|
||||||
txtProxyPass.Text = _Config.Config.ProxyPassword
|
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)
|
_MSSQL = New MSSQLServer(_LogConfig, _Config.Config.ConnectionString)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
@ -75,7 +77,6 @@ Public Class frmMain
|
|||||||
|
|
||||||
Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
|
Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
|
||||||
Try
|
Try
|
||||||
|
|
||||||
_Interface = New GraphQLInterface(_LogConfig,
|
_Interface = New GraphQLInterface(_LogConfig,
|
||||||
txtBaseUrl.Text,
|
txtBaseUrl.Text,
|
||||||
txtUsername.Text,
|
txtUsername.Text,
|
||||||
@ -86,16 +87,20 @@ Public Class frmMain
|
|||||||
If _Config.Config.HasProxySet() And _Config.Config.HasProxyCredentialsSet() Then
|
If _Config.Config.HasProxySet() And _Config.Config.HasProxyCredentialsSet() Then
|
||||||
Dim oURI As New Uri($"http://{_Config.Config.ProxyHost}:{_Config.Config.ProxyPort}")
|
Dim oURI As New Uri($"http://{_Config.Config.ProxyHost}:{_Config.Config.ProxyPort}")
|
||||||
Dim oCredentials As New NetworkCredential(_Config.Config.ProxyUsername, _Config.Config.ProxyPassword)
|
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,
|
.Address = oURI,
|
||||||
.UseDefaultCredentials = False,
|
.UseDefaultCredentials = False,
|
||||||
.Credentials = oCredentials
|
.Credentials = oCredentials
|
||||||
}
|
}
|
||||||
_Interface.Proxy = oProxy
|
_Interface.Proxy = oProxy
|
||||||
|
_Interface.Credentials = oCredentials
|
||||||
|
|
||||||
_Logger.Debug("Using Proxy: {0}", oURI.ToString)
|
_Logger.Debug("Using Proxy: {0}", oURI.ToString)
|
||||||
_Logger.Debug("Proxy Credentials: [{0}] [{1}]", _Config.Config.ProxyUsername, _Config.Config.ProxyPassword)
|
_Logger.Debug("Proxy Credentials: [{0}] [{1}]", _Config.Config.ProxyUsername, _Config.Config.ProxyPassword)
|
||||||
Else
|
Else
|
||||||
|
_Interface.Proxy = Nothing
|
||||||
|
_Interface.Credentials = Nothing
|
||||||
|
|
||||||
_Logger.Debug("Proxy not set.")
|
_Logger.Debug("Proxy not set.")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@ -121,15 +126,15 @@ Public Class frmMain
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If ComboBox1.SelectedIndex = -1 Then
|
If cmbQuery.SelectedIndex = -1 Then
|
||||||
MsgBox("Please select a query!", MsgBoxStyle.Exclamation, Text)
|
MsgBox("Please select a query!", MsgBoxStyle.Exclamation, Text)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If ComboBox1.Text = "SAPDaten" Then
|
If cmbQuery.Text = "SAPDaten" Then
|
||||||
_MSSQL.ExecuteNonQuery("DELETE FROM TBCUST_SYNC_API_SAPDATEN")
|
_MSSQL.ExecuteNonQuery("DELETE FROM TBCUST_SYNC_API_SAPDATEN")
|
||||||
|
|
||||||
txtResults.Text = String.Empty
|
txtResult.Text = String.Empty
|
||||||
|
|
||||||
For Each oDatapool In _Datapools
|
For Each oDatapool In _Datapools
|
||||||
Dim oQuery As String = GRAPHQL_QUERY_SAP_DATA.Trim.Replace("__DATA_POOL__", oDatapool)
|
Dim oQuery As String = GRAPHQL_QUERY_SAP_DATA.Trim.Replace("__DATA_POOL__", oDatapool)
|
||||||
@ -164,12 +169,33 @@ Public Class frmMain
|
|||||||
ProgressBar1.Value = oCounter
|
ProgressBar1.Value = oCounter
|
||||||
Next
|
Next
|
||||||
|
|
||||||
txtResults.Text &= "--------------------------------------------" & vbNewLine
|
txtResult.Text &= "--------------------------------------------" & vbNewLine
|
||||||
txtResults.Text &= $"--- Datapool: {oDatapool}" & vbNewLine
|
txtResult.Text &= $"--- Datapool: {oDatapool}" & vbNewLine
|
||||||
txtResults.Text &= JsonConvert.SerializeObject(oObj, Formatting.Indented) & vbNewLine
|
txtResult.Text &= JsonConvert.SerializeObject(oObj, Formatting.Indented) & vbNewLine
|
||||||
|
|
||||||
Application.DoEvents()
|
Application.DoEvents()
|
||||||
Next
|
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
|
Else
|
||||||
MsgBox("Unknown query!", MsgBoxStyle.Exclamation, Text)
|
MsgBox("Unknown query!", MsgBoxStyle.Exclamation, Text)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
@ -192,6 +218,7 @@ Public Class frmMain
|
|||||||
_Config.Config.ProxyPassword = txtProxyPass.Text
|
_Config.Config.ProxyPassword = txtProxyPass.Text
|
||||||
_Config.Config.ProxyPort = txtProxyPort.Text
|
_Config.Config.ProxyPort = txtProxyPort.Text
|
||||||
_Config.Config.ProxyUsername = txtProxyUser.Text
|
_Config.Config.ProxyUsername = txtProxyUser.Text
|
||||||
|
_Config.Config.CustomQueryString = txtQuery.Text
|
||||||
_Config.Save(ForceAll:=True)
|
_Config.Save(ForceAll:=True)
|
||||||
|
|
||||||
Dim oLogoutResponse = _Interface.Logout()
|
Dim oLogoutResponse = _Interface.Logout()
|
||||||
@ -210,4 +237,9 @@ Public Class frmMain
|
|||||||
|
|
||||||
Return oSAPData
|
Return oSAPData
|
||||||
End Function
|
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
|
End Class
|
||||||
|
|||||||
@ -16,6 +16,7 @@ Public Class GraphQLInterface
|
|||||||
Private _Encoding As New UTF8Encoding
|
Private _Encoding As New UTF8Encoding
|
||||||
|
|
||||||
Public Property Proxy As WebProxy
|
Public Property Proxy As WebProxy
|
||||||
|
Public Property Credentials As NetworkCredential
|
||||||
|
|
||||||
Public Sub New(LogConfig As LogConfig, BaseUrl As String, Email As String, Password As String, CertificateFile As String, CertificatePassword As String)
|
Public Sub New(LogConfig As LogConfig, BaseUrl As String, Email As String, Password As String, CertificateFile As String, CertificatePassword As String)
|
||||||
Try
|
Try
|
||||||
@ -25,7 +26,18 @@ Public Class GraphQLInterface
|
|||||||
_userEmail = Email
|
_userEmail = Email
|
||||||
_userPassword = Password
|
_userPassword = Password
|
||||||
|
|
||||||
_certificate = New X509Certificate(CertificateFile, CertificatePassword)
|
_certificate = New X509Certificate2(CertificateFile, CertificatePassword, X509KeyStorageFlags.UserKeySet)
|
||||||
|
|
||||||
|
Dim oStore As New X509Store(StoreName.My, StoreLocation.CurrentUser)
|
||||||
|
oStore.Open(OpenFlags.ReadOnly)
|
||||||
|
|
||||||
|
_logger.Debug("Available Certificates ({0}):", oStore.Certificates.Count)
|
||||||
|
|
||||||
|
For Each oCert In oStore.Certificates
|
||||||
|
_logger.Debug("FriendlyName: {0}", oCert.FriendlyName)
|
||||||
|
_logger.Debug("IssuerName: {0}", oCert.IssuerName.Name)
|
||||||
|
_logger.Debug("SubjectName: {0}", oCert.SubjectName.Name)
|
||||||
|
Next
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_logger.Error(ex)
|
_logger.Error(ex)
|
||||||
End Try
|
End Try
|
||||||
@ -93,18 +105,19 @@ Public Class GraphQLInterface
|
|||||||
|
|
||||||
Private Function GetRequest(Url As String, PostData As Byte()) As HttpWebRequest
|
Private Function GetRequest(Url As String, PostData As Byte()) As HttpWebRequest
|
||||||
Try
|
Try
|
||||||
ServicePointManager.Expect100Continue = True
|
|
||||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls12
|
|
||||||
|
|
||||||
Dim oRequest As HttpWebRequest = WebRequest.Create($"{_baseUrl}{Url}")
|
Dim oRequest As HttpWebRequest = WebRequest.Create($"{_baseUrl}{Url}")
|
||||||
oRequest.Method = "POST"
|
oRequest.Method = "POST"
|
||||||
oRequest.ContentType = "application/json"
|
oRequest.ContentType = "application/json"
|
||||||
oRequest.ContentLength = PostData.Length
|
oRequest.ContentLength = PostData.Length
|
||||||
oRequest.ClientCertificates.Add(_certificate)
|
oRequest.ClientCertificates.Add(_certificate)
|
||||||
oRequest.CookieContainer = GetCookies()
|
oRequest.CookieContainer = GetCookies()
|
||||||
|
oRequest.Proxy = Nothing
|
||||||
|
|
||||||
If Proxy IsNot Nothing Then
|
If Proxy Is Nothing Then
|
||||||
|
oRequest.Proxy = Nothing
|
||||||
|
Else
|
||||||
oRequest.Proxy = Proxy
|
oRequest.Proxy = Proxy
|
||||||
|
oRequest.Credentials = Credentials
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Return oRequest
|
Return oRequest
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user