FrmTestWebService: New form for Soap and Rest services.
This commit is contained in:
190
VAR.Toolbox/UI/FrmTestRestService.Designer.cs
generated
190
VAR.Toolbox/UI/FrmTestRestService.Designer.cs
generated
@@ -1,190 +0,0 @@
|
||||
namespace VAR.Toolbox.UI
|
||||
{
|
||||
partial class FrmTestRestService
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.txtUrl = new System.Windows.Forms.TextBox();
|
||||
this.txtUrlApiMethod = new System.Windows.Forms.TextBox();
|
||||
this.txtParameters = new System.Windows.Forms.TextBox();
|
||||
this.txtBody = new System.Windows.Forms.TextBox();
|
||||
this.lblURL = new System.Windows.Forms.Label();
|
||||
this.lblUrlApiMethod = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.btnTest = new System.Windows.Forms.Button();
|
||||
this.txtResult = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txtUrl
|
||||
//
|
||||
this.txtUrl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtUrl.Location = new System.Drawing.Point(123, 12);
|
||||
this.txtUrl.Name = "txtUrl";
|
||||
this.txtUrl.Size = new System.Drawing.Size(298, 20);
|
||||
this.txtUrl.TabIndex = 0;
|
||||
//
|
||||
// txtUrlApiMethod
|
||||
//
|
||||
this.txtUrlApiMethod.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtUrlApiMethod.Location = new System.Drawing.Point(123, 39);
|
||||
this.txtUrlApiMethod.Name = "txtUrlApiMethod";
|
||||
this.txtUrlApiMethod.Size = new System.Drawing.Size(298, 20);
|
||||
this.txtUrlApiMethod.TabIndex = 1;
|
||||
//
|
||||
// txtParameters
|
||||
//
|
||||
this.txtParameters.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtParameters.Location = new System.Drawing.Point(123, 66);
|
||||
this.txtParameters.Multiline = true;
|
||||
this.txtParameters.Name = "txtParameters";
|
||||
this.txtParameters.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.txtParameters.Size = new System.Drawing.Size(298, 50);
|
||||
this.txtParameters.TabIndex = 2;
|
||||
//
|
||||
// txtBody
|
||||
//
|
||||
this.txtBody.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtBody.Location = new System.Drawing.Point(123, 122);
|
||||
this.txtBody.Multiline = true;
|
||||
this.txtBody.Name = "txtBody";
|
||||
this.txtBody.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.txtBody.Size = new System.Drawing.Size(298, 59);
|
||||
this.txtBody.TabIndex = 3;
|
||||
//
|
||||
// lblURL
|
||||
//
|
||||
this.lblURL.AutoSize = true;
|
||||
this.lblURL.Location = new System.Drawing.Point(12, 15);
|
||||
this.lblURL.Name = "lblURL";
|
||||
this.lblURL.Size = new System.Drawing.Size(29, 13);
|
||||
this.lblURL.TabIndex = 4;
|
||||
this.lblURL.Text = "URL";
|
||||
//
|
||||
// lblUrlApiMethod
|
||||
//
|
||||
this.lblUrlApiMethod.AutoSize = true;
|
||||
this.lblUrlApiMethod.Location = new System.Drawing.Point(12, 42);
|
||||
this.lblUrlApiMethod.Name = "lblUrlApiMethod";
|
||||
this.lblUrlApiMethod.Size = new System.Drawing.Size(71, 13);
|
||||
this.lblUrlApiMethod.TabIndex = 5;
|
||||
this.lblUrlApiMethod.Text = "UrlApiMethod";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 69);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(60, 13);
|
||||
this.label1.TabIndex = 6;
|
||||
this.label1.Text = "Parameters";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 125);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(31, 13);
|
||||
this.label2.TabIndex = 7;
|
||||
this.label2.Text = "Body";
|
||||
//
|
||||
// btnTest
|
||||
//
|
||||
this.btnTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnTest.Location = new System.Drawing.Point(346, 187);
|
||||
this.btnTest.Name = "btnTest";
|
||||
this.btnTest.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnTest.TabIndex = 8;
|
||||
this.btnTest.Text = "Test";
|
||||
this.btnTest.UseVisualStyleBackColor = true;
|
||||
this.btnTest.Click += new System.EventHandler(this.btnTest_Click);
|
||||
//
|
||||
// txtResult
|
||||
//
|
||||
this.txtResult.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtResult.Location = new System.Drawing.Point(12, 216);
|
||||
this.txtResult.Multiline = true;
|
||||
this.txtResult.Name = "txtResult";
|
||||
this.txtResult.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.txtResult.Size = new System.Drawing.Size(409, 206);
|
||||
this.txtResult.TabIndex = 9;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(12, 200);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(37, 13);
|
||||
this.label3.TabIndex = 10;
|
||||
this.label3.Text = "Result";
|
||||
//
|
||||
// FrmTestRestService
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(433, 434);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.txtResult);
|
||||
this.Controls.Add(this.btnTest);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.lblUrlApiMethod);
|
||||
this.Controls.Add(this.lblURL);
|
||||
this.Controls.Add(this.txtBody);
|
||||
this.Controls.Add(this.txtParameters);
|
||||
this.Controls.Add(this.txtUrlApiMethod);
|
||||
this.Controls.Add(this.txtUrl);
|
||||
this.Name = "FrmTestRestService";
|
||||
this.Text = "TestRestService";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox txtUrl;
|
||||
private System.Windows.Forms.TextBox txtUrlApiMethod;
|
||||
private System.Windows.Forms.TextBox txtParameters;
|
||||
private System.Windows.Forms.TextBox txtBody;
|
||||
private System.Windows.Forms.Label lblURL;
|
||||
private System.Windows.Forms.Label lblUrlApiMethod;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Button btnTest;
|
||||
private System.Windows.Forms.TextBox txtResult;
|
||||
private System.Windows.Forms.Label label3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace VAR.Toolbox.UI
|
||||
{
|
||||
public partial class FrmTestRestService : Form
|
||||
{
|
||||
public FrmTestRestService()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnTest_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string url = txtUrl.Text;
|
||||
string urlApiMethod = txtUrlApiMethod.Text;
|
||||
Dictionary<string, string> parms = StringToDictionary(txtParameters.Text);
|
||||
string body = txtBody.Text;
|
||||
|
||||
string result = CallApi(url, urlApiMethod, parms, body);
|
||||
|
||||
txtResult.Text = result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StringBuilder sbException = new StringBuilder();
|
||||
while (ex != null)
|
||||
{
|
||||
sbException.AppendFormat("{0}\r\n{1}\r\n\r\n", ex.Message, ex.StackTrace);
|
||||
ex = ex.InnerException;
|
||||
}
|
||||
txtResult.Text = sbException.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deseria una cadena a un diccionario string,string
|
||||
/// </summary>
|
||||
/// <param name="str">The STR.</param>
|
||||
/// <returns></returns>
|
||||
/// <author>VAR</author>
|
||||
public static Dictionary<string, string> StringToDictionary(string str)
|
||||
{
|
||||
var dic = new Dictionary<string, string>();
|
||||
List<string> pairs = SplitUnscaped(str, ',');
|
||||
foreach (string pair in pairs)
|
||||
{
|
||||
List<string> values = SplitUnscaped(pair, ':');
|
||||
if (values.Count < 2) continue;
|
||||
string key = values[0].Replace("\\:", ":").Replace("\\,", ",");
|
||||
string val = values[1].Replace("\\:", ":").Replace("\\,", ",");
|
||||
dic.Add(key, val);
|
||||
}
|
||||
return dic;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializa un diccionario string,string a una cadena.
|
||||
/// </summary>
|
||||
/// <param name="dic">The dic.</param>
|
||||
/// <returns></returns>
|
||||
/// <author>VAR</author>
|
||||
public static string DictionaryToString(Dictionary<string, string> dic)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
foreach (KeyValuePair<string, string> entrada in dic)
|
||||
{
|
||||
string sKey = entrada.Key.Replace(":", "\\:").Replace(",", "\\,");
|
||||
string sVal = entrada.Value.Replace(":", "\\:").Replace(",", "\\,");
|
||||
sb.AppendFormat("{0}:{1},", sKey, sVal);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parte una cadena usando un caracter, evitando usar las ocurrencias escapadas con '\\'
|
||||
/// </summary>
|
||||
/// <param name="str">The STR.</param>
|
||||
/// <param name="splitter">The splitter.</param>
|
||||
/// <returns></returns>
|
||||
/// <author>VAR</author>
|
||||
public static List<string> SplitUnscaped(string str, char splitter)
|
||||
{
|
||||
var strs = new List<string>();
|
||||
int j, i;
|
||||
int n = str.Length;
|
||||
|
||||
for (j = 0, i = 0; i < n; i++)
|
||||
{
|
||||
if (str[i] == '\\') i++;
|
||||
else if (str[i] == splitter)
|
||||
{
|
||||
strs.Add(str.Substring(j, i - j));
|
||||
j = i + 1;
|
||||
}
|
||||
}
|
||||
if (i >= j) strs.Add(str.Substring(j, n - j));
|
||||
|
||||
return strs;
|
||||
}
|
||||
|
||||
private static CookieContainer _cookieJar = new CookieContainer();
|
||||
|
||||
public static string CallApi(string urlService, string urlApiMethod, Dictionary<string, string> prms, string content)
|
||||
{
|
||||
var sbRequestUrl = new StringBuilder();
|
||||
sbRequestUrl.Append(urlService);
|
||||
sbRequestUrl.Append(urlApiMethod);
|
||||
if (prms != null)
|
||||
{
|
||||
foreach (KeyValuePair<string, string> pair in prms)
|
||||
{
|
||||
sbRequestUrl.AppendFormat("&{0}={1}", pair.Key, Uri.EscapeUriString(pair.Value));
|
||||
}
|
||||
}
|
||||
if (sbRequestUrl.Length > 2048)
|
||||
{
|
||||
throw new Exception(string.Format("CallApi: Request URL longer than 2048: url: \"{0}\"", sbRequestUrl.ToString()));
|
||||
}
|
||||
|
||||
var http = (HttpWebRequest)WebRequest.Create(new Uri(sbRequestUrl.ToString()));
|
||||
http.CookieContainer = _cookieJar;
|
||||
http.Accept = "application/json";
|
||||
http.ContentType = "application/json; charset=utf-8";
|
||||
http.Method = "POST";
|
||||
|
||||
UTF8Encoding encoding = new UTF8Encoding();
|
||||
byte[] bytes = encoding.GetBytes(content);
|
||||
|
||||
Task<Stream> requestStreamTask = http.GetRequestStreamAsync();
|
||||
requestStreamTask.Wait();
|
||||
Stream requestStream = requestStreamTask.Result;
|
||||
requestStream.Write(bytes, 0, bytes.Length);
|
||||
requestStream.Flush();
|
||||
|
||||
Task<WebResponse> responseTask = http.GetResponseAsync();
|
||||
responseTask.Wait();
|
||||
WebResponse response = responseTask.Result;
|
||||
var stream = response.GetResponseStream();
|
||||
var sr = new StreamReader(stream);
|
||||
return sr.ReadToEnd();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
187
VAR.Toolbox/UI/FrmTestSoapService.Designer.cs
generated
187
VAR.Toolbox/UI/FrmTestSoapService.Designer.cs
generated
@@ -1,187 +0,0 @@
|
||||
namespace VAR.Toolbox.UI
|
||||
{
|
||||
partial class FrmTestSoapService
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.txtUrl = new System.Windows.Forms.TextBox();
|
||||
this.txtInterface = new System.Windows.Forms.TextBox();
|
||||
this.txtMethod = new System.Windows.Forms.TextBox();
|
||||
this.txtParameters = new System.Windows.Forms.TextBox();
|
||||
this.txtResult = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.btnTest = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 16);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(29, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "URL";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 43);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(49, 13);
|
||||
this.label2.TabIndex = 1;
|
||||
this.label2.Text = "Interface";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(12, 70);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(43, 13);
|
||||
this.label3.TabIndex = 2;
|
||||
this.label3.Text = "Method";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(12, 97);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(60, 13);
|
||||
this.label4.TabIndex = 3;
|
||||
this.label4.Text = "Parameters";
|
||||
//
|
||||
// txtUrl
|
||||
//
|
||||
this.txtUrl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtUrl.Location = new System.Drawing.Point(98, 13);
|
||||
this.txtUrl.Name = "txtUrl";
|
||||
this.txtUrl.Size = new System.Drawing.Size(389, 20);
|
||||
this.txtUrl.TabIndex = 4;
|
||||
//
|
||||
// txtInterface
|
||||
//
|
||||
this.txtInterface.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtInterface.Location = new System.Drawing.Point(98, 40);
|
||||
this.txtInterface.Name = "txtInterface";
|
||||
this.txtInterface.Size = new System.Drawing.Size(389, 20);
|
||||
this.txtInterface.TabIndex = 5;
|
||||
//
|
||||
// txtMethod
|
||||
//
|
||||
this.txtMethod.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtMethod.Location = new System.Drawing.Point(98, 67);
|
||||
this.txtMethod.Name = "txtMethod";
|
||||
this.txtMethod.Size = new System.Drawing.Size(389, 20);
|
||||
this.txtMethod.TabIndex = 6;
|
||||
//
|
||||
// txtParameters
|
||||
//
|
||||
this.txtParameters.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtParameters.Location = new System.Drawing.Point(98, 94);
|
||||
this.txtParameters.Multiline = true;
|
||||
this.txtParameters.Name = "txtParameters";
|
||||
this.txtParameters.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.txtParameters.Size = new System.Drawing.Size(389, 103);
|
||||
this.txtParameters.TabIndex = 7;
|
||||
//
|
||||
// txtResult
|
||||
//
|
||||
this.txtResult.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtResult.Location = new System.Drawing.Point(12, 234);
|
||||
this.txtResult.Multiline = true;
|
||||
this.txtResult.Name = "txtResult";
|
||||
this.txtResult.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.txtResult.Size = new System.Drawing.Size(475, 196);
|
||||
this.txtResult.TabIndex = 8;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(12, 215);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(37, 13);
|
||||
this.label5.TabIndex = 9;
|
||||
this.label5.Text = "Result";
|
||||
//
|
||||
// btnTest
|
||||
//
|
||||
this.btnTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnTest.Location = new System.Drawing.Point(412, 203);
|
||||
this.btnTest.Name = "btnTest";
|
||||
this.btnTest.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnTest.TabIndex = 10;
|
||||
this.btnTest.Text = "Test";
|
||||
this.btnTest.UseVisualStyleBackColor = true;
|
||||
this.btnTest.Click += new System.EventHandler(this.btnTest_Click);
|
||||
//
|
||||
// FrmTestSoapService
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(499, 442);
|
||||
this.Controls.Add(this.btnTest);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.txtResult);
|
||||
this.Controls.Add(this.txtParameters);
|
||||
this.Controls.Add(this.txtMethod);
|
||||
this.Controls.Add(this.txtInterface);
|
||||
this.Controls.Add(this.txtUrl);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Name = "FrmTestSoapService";
|
||||
this.Text = "TestSoapService";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.TextBox txtUrl;
|
||||
private System.Windows.Forms.TextBox txtInterface;
|
||||
private System.Windows.Forms.TextBox txtMethod;
|
||||
private System.Windows.Forms.TextBox txtParameters;
|
||||
private System.Windows.Forms.TextBox txtResult;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Button btnTest;
|
||||
}
|
||||
}
|
||||
374
VAR.Toolbox/UI/FrmTestWebService.Designer.cs
generated
Normal file
374
VAR.Toolbox/UI/FrmTestWebService.Designer.cs
generated
Normal file
@@ -0,0 +1,374 @@
|
||||
namespace VAR.Toolbox.UI
|
||||
{
|
||||
partial class FrmTestWebService
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tabWebServices = new System.Windows.Forms.TabControl();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.btnTestSoap = new System.Windows.Forms.Button();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.txtResultSoap = new System.Windows.Forms.TextBox();
|
||||
this.txtParametersSoap = new System.Windows.Forms.TextBox();
|
||||
this.txtMethodSoap = new System.Windows.Forms.TextBox();
|
||||
this.txtInterfaceSoap = new System.Windows.Forms.TextBox();
|
||||
this.txtUrlSoap = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.txtResultRest = new System.Windows.Forms.TextBox();
|
||||
this.btnTestRest = new System.Windows.Forms.Button();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.lblUrlApiMethod = new System.Windows.Forms.Label();
|
||||
this.lblURL = new System.Windows.Forms.Label();
|
||||
this.txtBodyRest = new System.Windows.Forms.TextBox();
|
||||
this.txtParametersRest = new System.Windows.Forms.TextBox();
|
||||
this.txtUrlApiMethodRest = new System.Windows.Forms.TextBox();
|
||||
this.txtUrlRest = new System.Windows.Forms.TextBox();
|
||||
this.tabWebServices.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.tabPage2.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tabWebServices
|
||||
//
|
||||
this.tabWebServices.Appearance = System.Windows.Forms.TabAppearance.FlatButtons;
|
||||
this.tabWebServices.Controls.Add(this.tabPage1);
|
||||
this.tabWebServices.Controls.Add(this.tabPage2);
|
||||
this.tabWebServices.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tabWebServices.Location = new System.Drawing.Point(0, 0);
|
||||
this.tabWebServices.Name = "tabWebServices";
|
||||
this.tabWebServices.SelectedIndex = 0;
|
||||
this.tabWebServices.Size = new System.Drawing.Size(682, 521);
|
||||
this.tabWebServices.TabIndex = 0;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.Controls.Add(this.btnTestSoap);
|
||||
this.tabPage1.Controls.Add(this.label5);
|
||||
this.tabPage1.Controls.Add(this.txtResultSoap);
|
||||
this.tabPage1.Controls.Add(this.txtParametersSoap);
|
||||
this.tabPage1.Controls.Add(this.txtMethodSoap);
|
||||
this.tabPage1.Controls.Add(this.txtInterfaceSoap);
|
||||
this.tabPage1.Controls.Add(this.txtUrlSoap);
|
||||
this.tabPage1.Controls.Add(this.label4);
|
||||
this.tabPage1.Controls.Add(this.label3);
|
||||
this.tabPage1.Controls.Add(this.label2);
|
||||
this.tabPage1.Controls.Add(this.label1);
|
||||
this.tabPage1.Location = new System.Drawing.Point(4, 25);
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage1.Size = new System.Drawing.Size(674, 492);
|
||||
this.tabPage1.TabIndex = 0;
|
||||
this.tabPage1.Text = "SoapService";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnTestSoap
|
||||
//
|
||||
this.btnTestSoap.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnTestSoap.Location = new System.Drawing.Point(596, 190);
|
||||
this.btnTestSoap.Name = "btnTestSoap";
|
||||
this.btnTestSoap.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnTestSoap.TabIndex = 21;
|
||||
this.btnTestSoap.Text = "Test";
|
||||
this.btnTestSoap.UseVisualStyleBackColor = true;
|
||||
this.btnTestSoap.Click += new System.EventHandler(this.btnTestSoap_Click);
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(8, 203);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(37, 13);
|
||||
this.label5.TabIndex = 20;
|
||||
this.label5.Text = "Result";
|
||||
//
|
||||
// txtResultSoap
|
||||
//
|
||||
this.txtResultSoap.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtResultSoap.Location = new System.Drawing.Point(6, 219);
|
||||
this.txtResultSoap.Multiline = true;
|
||||
this.txtResultSoap.Name = "txtResultSoap";
|
||||
this.txtResultSoap.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.txtResultSoap.Size = new System.Drawing.Size(662, 265);
|
||||
this.txtResultSoap.TabIndex = 19;
|
||||
//
|
||||
// txtParametersSoap
|
||||
//
|
||||
this.txtParametersSoap.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtParametersSoap.Location = new System.Drawing.Point(100, 81);
|
||||
this.txtParametersSoap.Multiline = true;
|
||||
this.txtParametersSoap.Name = "txtParametersSoap";
|
||||
this.txtParametersSoap.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.txtParametersSoap.Size = new System.Drawing.Size(571, 103);
|
||||
this.txtParametersSoap.TabIndex = 18;
|
||||
//
|
||||
// txtMethodSoap
|
||||
//
|
||||
this.txtMethodSoap.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtMethodSoap.Location = new System.Drawing.Point(100, 55);
|
||||
this.txtMethodSoap.Name = "txtMethodSoap";
|
||||
this.txtMethodSoap.Size = new System.Drawing.Size(571, 20);
|
||||
this.txtMethodSoap.TabIndex = 17;
|
||||
//
|
||||
// txtInterfaceSoap
|
||||
//
|
||||
this.txtInterfaceSoap.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtInterfaceSoap.Location = new System.Drawing.Point(100, 29);
|
||||
this.txtInterfaceSoap.Name = "txtInterfaceSoap";
|
||||
this.txtInterfaceSoap.Size = new System.Drawing.Size(571, 20);
|
||||
this.txtInterfaceSoap.TabIndex = 16;
|
||||
//
|
||||
// txtUrlSoap
|
||||
//
|
||||
this.txtUrlSoap.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtUrlSoap.Location = new System.Drawing.Point(100, 6);
|
||||
this.txtUrlSoap.Name = "txtUrlSoap";
|
||||
this.txtUrlSoap.Size = new System.Drawing.Size(571, 20);
|
||||
this.txtUrlSoap.TabIndex = 15;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(8, 84);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(60, 13);
|
||||
this.label4.TabIndex = 14;
|
||||
this.label4.Text = "Parameters";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(8, 58);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(43, 13);
|
||||
this.label3.TabIndex = 13;
|
||||
this.label3.Text = "Method";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(8, 32);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(49, 13);
|
||||
this.label2.TabIndex = 12;
|
||||
this.label2.Text = "Interface";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(8, 9);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(29, 13);
|
||||
this.label1.TabIndex = 11;
|
||||
this.label1.Text = "URL";
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
this.tabPage2.BackColor = System.Drawing.Color.Transparent;
|
||||
this.tabPage2.Controls.Add(this.label6);
|
||||
this.tabPage2.Controls.Add(this.txtResultRest);
|
||||
this.tabPage2.Controls.Add(this.btnTestRest);
|
||||
this.tabPage2.Controls.Add(this.label7);
|
||||
this.tabPage2.Controls.Add(this.label8);
|
||||
this.tabPage2.Controls.Add(this.lblUrlApiMethod);
|
||||
this.tabPage2.Controls.Add(this.lblURL);
|
||||
this.tabPage2.Controls.Add(this.txtBodyRest);
|
||||
this.tabPage2.Controls.Add(this.txtParametersRest);
|
||||
this.tabPage2.Controls.Add(this.txtUrlApiMethodRest);
|
||||
this.tabPage2.Controls.Add(this.txtUrlRest);
|
||||
this.tabPage2.Location = new System.Drawing.Point(4, 25);
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage2.Size = new System.Drawing.Size(674, 492);
|
||||
this.tabPage2.TabIndex = 1;
|
||||
this.tabPage2.Text = "RestService";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(8, 197);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(37, 13);
|
||||
this.label6.TabIndex = 21;
|
||||
this.label6.Text = "Result";
|
||||
//
|
||||
// txtResultRest
|
||||
//
|
||||
this.txtResultRest.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtResultRest.Location = new System.Drawing.Point(8, 213);
|
||||
this.txtResultRest.Multiline = true;
|
||||
this.txtResultRest.Name = "txtResultRest";
|
||||
this.txtResultRest.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.txtResultRest.Size = new System.Drawing.Size(658, 271);
|
||||
this.txtResultRest.TabIndex = 20;
|
||||
//
|
||||
// btnTestRest
|
||||
//
|
||||
this.btnTestRest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnTestRest.Location = new System.Drawing.Point(591, 184);
|
||||
this.btnTestRest.Name = "btnTestRest";
|
||||
this.btnTestRest.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnTestRest.TabIndex = 19;
|
||||
this.btnTestRest.Text = "Test";
|
||||
this.btnTestRest.UseVisualStyleBackColor = true;
|
||||
this.btnTestRest.Click += new System.EventHandler(this.btnTestRest_Click);
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(8, 122);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(31, 13);
|
||||
this.label7.TabIndex = 18;
|
||||
this.label7.Text = "Body";
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(8, 66);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(60, 13);
|
||||
this.label8.TabIndex = 17;
|
||||
this.label8.Text = "Parameters";
|
||||
//
|
||||
// lblUrlApiMethod
|
||||
//
|
||||
this.lblUrlApiMethod.AutoSize = true;
|
||||
this.lblUrlApiMethod.Location = new System.Drawing.Point(8, 39);
|
||||
this.lblUrlApiMethod.Name = "lblUrlApiMethod";
|
||||
this.lblUrlApiMethod.Size = new System.Drawing.Size(71, 13);
|
||||
this.lblUrlApiMethod.TabIndex = 16;
|
||||
this.lblUrlApiMethod.Text = "UrlApiMethod";
|
||||
//
|
||||
// lblURL
|
||||
//
|
||||
this.lblURL.AutoSize = true;
|
||||
this.lblURL.Location = new System.Drawing.Point(8, 12);
|
||||
this.lblURL.Name = "lblURL";
|
||||
this.lblURL.Size = new System.Drawing.Size(29, 13);
|
||||
this.lblURL.TabIndex = 15;
|
||||
this.lblURL.Text = "URL";
|
||||
//
|
||||
// txtBodyRest
|
||||
//
|
||||
this.txtBodyRest.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtBodyRest.Location = new System.Drawing.Point(119, 119);
|
||||
this.txtBodyRest.Multiline = true;
|
||||
this.txtBodyRest.Name = "txtBodyRest";
|
||||
this.txtBodyRest.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.txtBodyRest.Size = new System.Drawing.Size(547, 59);
|
||||
this.txtBodyRest.TabIndex = 14;
|
||||
//
|
||||
// txtParametersRest
|
||||
//
|
||||
this.txtParametersRest.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtParametersRest.Location = new System.Drawing.Point(119, 63);
|
||||
this.txtParametersRest.Multiline = true;
|
||||
this.txtParametersRest.Name = "txtParametersRest";
|
||||
this.txtParametersRest.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.txtParametersRest.Size = new System.Drawing.Size(547, 50);
|
||||
this.txtParametersRest.TabIndex = 13;
|
||||
//
|
||||
// txtUrlApiMethodRest
|
||||
//
|
||||
this.txtUrlApiMethodRest.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtUrlApiMethodRest.Location = new System.Drawing.Point(119, 36);
|
||||
this.txtUrlApiMethodRest.Name = "txtUrlApiMethodRest";
|
||||
this.txtUrlApiMethodRest.Size = new System.Drawing.Size(547, 20);
|
||||
this.txtUrlApiMethodRest.TabIndex = 12;
|
||||
//
|
||||
// txtUrlRest
|
||||
//
|
||||
this.txtUrlRest.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtUrlRest.Location = new System.Drawing.Point(119, 9);
|
||||
this.txtUrlRest.Name = "txtUrlRest";
|
||||
this.txtUrlRest.Size = new System.Drawing.Size(547, 20);
|
||||
this.txtUrlRest.TabIndex = 11;
|
||||
//
|
||||
// FrmTestWebService
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(682, 521);
|
||||
this.Controls.Add(this.tabWebServices);
|
||||
this.Name = "FrmTestWebService";
|
||||
this.Text = "FrmTestWebService";
|
||||
this.tabWebServices.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.tabPage1.PerformLayout();
|
||||
this.tabPage2.ResumeLayout(false);
|
||||
this.tabPage2.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TabControl tabWebServices;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private System.Windows.Forms.TabPage tabPage2;
|
||||
private System.Windows.Forms.Button btnTestSoap;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox txtResultSoap;
|
||||
private System.Windows.Forms.TextBox txtParametersSoap;
|
||||
private System.Windows.Forms.TextBox txtMethodSoap;
|
||||
private System.Windows.Forms.TextBox txtInterfaceSoap;
|
||||
private System.Windows.Forms.TextBox txtUrlSoap;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.TextBox txtResultRest;
|
||||
private System.Windows.Forms.Button btnTestRest;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.Label lblUrlApiMethod;
|
||||
private System.Windows.Forms.Label lblURL;
|
||||
private System.Windows.Forms.TextBox txtBodyRest;
|
||||
private System.Windows.Forms.TextBox txtParametersRest;
|
||||
private System.Windows.Forms.TextBox txtUrlApiMethodRest;
|
||||
private System.Windows.Forms.TextBox txtUrlRest;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
|
||||
namespace VAR.Toolbox.UI
|
||||
{
|
||||
public partial class FrmTestSoapService : Form
|
||||
public partial class FrmTestWebService : Form
|
||||
{
|
||||
public FrmTestSoapService()
|
||||
public FrmTestWebService()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnTest_Click(object sender, EventArgs e)
|
||||
private void btnTestSoap_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string url = txtUrl.Text;
|
||||
string iface = txtInterface.Text;
|
||||
string method = txtMethod.Text;
|
||||
Dictionary<string, string> parms = StringToDictionary(txtParameters.Text);
|
||||
string url = txtUrlSoap.Text;
|
||||
string iface = txtInterfaceSoap.Text;
|
||||
string method = txtMethodSoap.Text;
|
||||
Dictionary<string, string> parms = StringToDictionary(txtParametersSoap.Text);
|
||||
|
||||
Dictionary<string, string> result = CallSoapMethod(url, iface, method, parms);
|
||||
|
||||
txtResult.Text = DictionaryToString(result);
|
||||
txtResultSoap.Text = DictionaryToString(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -35,7 +37,32 @@ namespace VAR.Toolbox.UI
|
||||
sbException.AppendFormat("{0}\r\n{1}\r\n\r\n", ex.Message, ex.StackTrace);
|
||||
ex = ex.InnerException;
|
||||
}
|
||||
txtResult.Text = sbException.ToString();
|
||||
txtResultSoap.Text = sbException.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void btnTestRest_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
string url = txtUrlRest.Text;
|
||||
string urlApiMethod = txtUrlApiMethodRest.Text;
|
||||
Dictionary<string, string> parms = StringToDictionary(txtParametersRest.Text);
|
||||
string body = txtBodyRest.Text;
|
||||
|
||||
string result = CallApi(url, urlApiMethod, parms, body);
|
||||
|
||||
txtResultRest.Text = result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StringBuilder sbException = new StringBuilder();
|
||||
while (ex != null)
|
||||
{
|
||||
sbException.AppendFormat("{0}\r\n{1}\r\n\r\n", ex.Message, ex.StackTrace);
|
||||
ex = ex.InnerException;
|
||||
}
|
||||
txtResultRest.Text = sbException.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,5 +205,47 @@ namespace VAR.Toolbox.UI
|
||||
}
|
||||
|
||||
|
||||
private static CookieContainer _cookieJar = new CookieContainer();
|
||||
|
||||
public static string CallApi(string urlService, string urlApiMethod, Dictionary<string, string> prms, string content)
|
||||
{
|
||||
var sbRequestUrl = new StringBuilder();
|
||||
sbRequestUrl.Append(urlService);
|
||||
sbRequestUrl.Append(urlApiMethod);
|
||||
if (prms != null)
|
||||
{
|
||||
foreach (KeyValuePair<string, string> pair in prms)
|
||||
{
|
||||
sbRequestUrl.AppendFormat("&{0}={1}", pair.Key, Uri.EscapeUriString(pair.Value));
|
||||
}
|
||||
}
|
||||
if (sbRequestUrl.Length > 2048)
|
||||
{
|
||||
throw new Exception(string.Format("CallApi: Request URL longer than 2048: url: \"{0}\"", sbRequestUrl.ToString()));
|
||||
}
|
||||
|
||||
var http = (HttpWebRequest)WebRequest.Create(new Uri(sbRequestUrl.ToString()));
|
||||
http.CookieContainer = _cookieJar;
|
||||
http.Accept = "application/json";
|
||||
http.ContentType = "application/json; charset=utf-8";
|
||||
http.Method = "POST";
|
||||
|
||||
UTF8Encoding encoding = new UTF8Encoding();
|
||||
byte[] bytes = encoding.GetBytes(content);
|
||||
|
||||
Task<Stream> requestStreamTask = http.GetRequestStreamAsync();
|
||||
requestStreamTask.Wait();
|
||||
Stream requestStream = requestStreamTask.Result;
|
||||
requestStream.Write(bytes, 0, bytes.Length);
|
||||
requestStream.Flush();
|
||||
|
||||
Task<WebResponse> responseTask = http.GetResponseAsync();
|
||||
responseTask.Wait();
|
||||
WebResponse response = responseTask.Result;
|
||||
var stream = response.GetResponseStream();
|
||||
var sr = new StreamReader(stream);
|
||||
return sr.ReadToEnd();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
42
VAR.Toolbox/UI/FrmToolbox.Designer.cs
generated
42
VAR.Toolbox/UI/FrmToolbox.Designer.cs
generated
@@ -36,8 +36,7 @@
|
||||
this.pnlSuspension1 = new VAR.Toolbox.UI.PnlSuspension();
|
||||
this.pnlCover1 = new VAR.Toolbox.UI.PnlCover();
|
||||
this.btnExit = new System.Windows.Forms.Button();
|
||||
this.btnTestSoapService = new System.Windows.Forms.Button();
|
||||
this.btnTestRestService = new System.Windows.Forms.Button();
|
||||
this.btnTestWebService = new System.Windows.Forms.Button();
|
||||
this.btnScreenshooter = new System.Windows.Forms.Button();
|
||||
this.btnIPScan = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
@@ -85,7 +84,7 @@
|
||||
//
|
||||
// lblToolbox
|
||||
//
|
||||
this.lblToolbox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.lblToolbox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lblToolbox.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblToolbox.Location = new System.Drawing.Point(9, 9);
|
||||
@@ -116,7 +115,7 @@
|
||||
//
|
||||
// btnExit
|
||||
//
|
||||
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnExit.Location = new System.Drawing.Point(12, 359);
|
||||
this.btnExit.Name = "btnExit";
|
||||
@@ -126,27 +125,16 @@
|
||||
this.btnExit.UseVisualStyleBackColor = true;
|
||||
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
|
||||
//
|
||||
// btnTestSoapService
|
||||
// btnTestWebService
|
||||
//
|
||||
this.btnTestSoapService.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnTestSoapService.Location = new System.Drawing.Point(180, 52);
|
||||
this.btnTestSoapService.Name = "btnTestSoapService";
|
||||
this.btnTestSoapService.Size = new System.Drawing.Size(165, 34);
|
||||
this.btnTestSoapService.TabIndex = 8;
|
||||
this.btnTestSoapService.Text = "TestSoapService";
|
||||
this.btnTestSoapService.UseVisualStyleBackColor = true;
|
||||
this.btnTestSoapService.Click += new System.EventHandler(this.btnTestSoapService_Click);
|
||||
//
|
||||
// btnTestRestService
|
||||
//
|
||||
this.btnTestRestService.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnTestRestService.Location = new System.Drawing.Point(180, 92);
|
||||
this.btnTestRestService.Name = "btnTestRestService";
|
||||
this.btnTestRestService.Size = new System.Drawing.Size(165, 36);
|
||||
this.btnTestRestService.TabIndex = 9;
|
||||
this.btnTestRestService.Text = "TestRestService";
|
||||
this.btnTestRestService.UseVisualStyleBackColor = true;
|
||||
this.btnTestRestService.Click += new System.EventHandler(this.btnTestRestService_Click);
|
||||
this.btnTestWebService.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnTestWebService.Location = new System.Drawing.Point(180, 52);
|
||||
this.btnTestWebService.Name = "btnTestWebService";
|
||||
this.btnTestWebService.Size = new System.Drawing.Size(165, 34);
|
||||
this.btnTestWebService.TabIndex = 8;
|
||||
this.btnTestWebService.Text = "TestWebService";
|
||||
this.btnTestWebService.UseVisualStyleBackColor = true;
|
||||
this.btnTestWebService.Click += new System.EventHandler(this.btnTestWebService_Click);
|
||||
//
|
||||
// btnScreenshooter
|
||||
//
|
||||
@@ -177,8 +165,7 @@
|
||||
this.ClientSize = new System.Drawing.Size(352, 400);
|
||||
this.Controls.Add(this.btnIPScan);
|
||||
this.Controls.Add(this.btnScreenshooter);
|
||||
this.Controls.Add(this.btnTestRestService);
|
||||
this.Controls.Add(this.btnTestSoapService);
|
||||
this.Controls.Add(this.btnTestWebService);
|
||||
this.Controls.Add(this.btnExit);
|
||||
this.Controls.Add(this.lblToolbox);
|
||||
this.Controls.Add(this.btnTunnelTCP);
|
||||
@@ -208,8 +195,7 @@
|
||||
private System.Windows.Forms.Button btnTunnelTCP;
|
||||
private System.Windows.Forms.Label lblToolbox;
|
||||
private System.Windows.Forms.Button btnExit;
|
||||
private System.Windows.Forms.Button btnTestSoapService;
|
||||
private System.Windows.Forms.Button btnTestRestService;
|
||||
private System.Windows.Forms.Button btnTestWebService;
|
||||
private System.Windows.Forms.Button btnScreenshooter;
|
||||
private System.Windows.Forms.Button btnIPScan;
|
||||
}
|
||||
|
||||
@@ -119,14 +119,9 @@ namespace VAR.Toolbox.UI
|
||||
CreateWindow(typeof(FrmTunnelTCP));
|
||||
}
|
||||
|
||||
private void btnTestSoapService_Click(object sender, EventArgs e)
|
||||
private void btnTestWebService_Click(object sender, EventArgs e)
|
||||
{
|
||||
CreateWindow(typeof(FrmTestSoapService));
|
||||
}
|
||||
|
||||
private void btnTestRestService_Click(object sender, EventArgs e)
|
||||
{
|
||||
CreateWindow(typeof(FrmTestRestService));
|
||||
CreateWindow(typeof(FrmTestWebService));
|
||||
}
|
||||
|
||||
private void btnScreenshooter_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -137,17 +137,11 @@
|
||||
<Compile Include="UI\FrmScreenshooter.Designer.cs">
|
||||
<DependentUpon>FrmScreenshooter.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmTestRestService.cs">
|
||||
<Compile Include="UI\FrmTestWebService.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmTestRestService.Designer.cs">
|
||||
<DependentUpon>FrmTestRestService.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmTestSoapService.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmTestSoapService.Designer.cs">
|
||||
<DependentUpon>FrmTestSoapService.cs</DependentUpon>
|
||||
<Compile Include="UI\FrmTestWebService.Designer.cs">
|
||||
<DependentUpon>FrmTestWebService.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\FrmTunnelTCP.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
||||
Reference in New Issue
Block a user