/WSCF.Blue/source/UI/WsdlWizard/WsdlWizardForm.cs
C# | 3304 lines | 2352 code | 350 blank | 602 comment | 171 complexity | 0eced8fd8c69baa9b16743bf11f5b9b3 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- using System;
- using System.Collections;
- using System.Collections.Specialized;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Globalization;
- using System.Linq;
- using System.Windows.Forms;
- using System.IO;
- using System.Text;
- using System.Reflection;
- using System.Net;
- using Thinktecture.Tools.Web.Services;
- using Thinktecture.Tools.Wscf.Services.ServiceDescription;
- using Thinktecture.Tools.Wscf.Services.ServiceDescription.Exceptions;
- using WizardControl;
- using WRM.Windows.Forms;
- using Message = Thinktecture.Tools.Wscf.Services.ServiceDescription.Message;
- using Thinktecture.Tools.Web.Services.Wscf.Environment;
-
- namespace Thinktecture.Tools.Wscf.UI.WsdlWizard
- {
- /// <summary>
- /// Represents the user interface handler for WsdlWizardForm.
- /// </summary>
- public class WsdlWizardForm : Form
- {
- #region Private fields
-
- #region "Primitives"
- private int operationCount;
- private string schemaLocation = "";
- private string wsdlLocation = "";
- private string schemaNamespace = "";
- private bool openCodeGenDialog;
- private bool alreadyCancelled = false;
- private bool roundtripMode = false;
-
- private string currentFolder;
- private string wsdlFile = string.Empty;
- private string defaultPathForImports = string.Empty;
- private string projectRootDirectory = string.Empty;
- #endregion
-
- #region "Objects"
- private ArrayList importedSchemaNamespaces = new ArrayList();
- private InterfaceContract serviceInterfaceContract;
- private InterfaceContract importedContract = null;
- //private SchemaElements messageSchemas = new SchemaElements();
- //private SchemaElements headerSchemas = new SchemaElements();
- //private OperationsCollection inferOperations = new OperationsCollection(10);
- private List<Operation> oldOperations =
- new List<Operation>(); // Holds a list of old operations configured by the user.
- #endregion
-
- #region "WizardPages and Items"
-
- private Wizard wsdlWizardCtrl;
- private WizardPage wizardPageBasicMetadata;
- private TextBox tbServiceName;
- private Label lblServiceName;
- private Label lblNamespace;
-
- private WizardPage wizardPageOperationsList;
- private GroupBox groupBox1;
- private TextBox tbEdit;
- private ComboBox cbMEPs;
- private Panel panel1;
- private ToolTip toolTip1;
- private IContainer components;
- private TextBox tbNamespace;
- private LinkLabel llAddOperation;
- private EditableListView operationsListView;
- private LinkLabel llRemoveOperation;
- private Label lblServiceDoc;
- private TextBox tbServiceDoc;
-
- private WizardPage wizardPageMessageMapping;
- private WizardControl.WizardPage wizardPageAdditionalOptions;
- private System.Windows.Forms.CheckBox cbNeedsServiceElement;
- private System.Windows.Forms.CheckBox cbCodeGenDialog;
- private WRM.Windows.Forms.PropertyTree ptvServiceOperations;
- private WizardControl.WizardPage wizardPageSchemaImports;
- private System.Windows.Forms.GroupBox groupBox2;
- private Thinktecture.Tools.Wscf.UI.WsdlWizard.EditableListView importsListView;
- private System.Windows.Forms.LinkLabel llAddImport;
- private System.Windows.Forms.LinkLabel llRemoveImport;
- private System.Windows.Forms.OpenFileDialog openFileDialog1;
-
- private WizardControl.WizardPage wizardPageAlternativeXSDPaths;
- private Thinktecture.Tools.Wscf.UI.WsdlWizard.EditableListView xsdpathsListView;
- private System.Windows.Forms.ToolTip toolTipPath;
- private System.Windows.Forms.CheckBox cbInfer;
- private CheckBox cbSoap12;
- private CheckBox cbSoap11;
- #endregion
-
- #endregion
-
- #region Public properties.
-
- /// <summary>
- /// Gets a value indicating whether the code generation dialog should be opened or not.
- /// </summary>
- public bool OpenCodeGenDialog
- {
- get { return openCodeGenDialog; }
- }
-
- /// <summary>
- /// Gets or sets the location to create the WSDL file.
- /// </summary>
- public string WsdlLocation
- {
- get { return wsdlLocation; }
- set { wsdlLocation = value; }
- }
-
- /// <summary>
- /// Gets or sets the schema namespace.
- /// </summary>
- public string SchemaNamespace
- {
- get { return schemaNamespace; }
- set { schemaNamespace = value; }
- }
-
- /// <summary>
- /// Gets or sets the schema location.
- /// </summary>
- public string SchemaLocation
- {
- get { return schemaLocation; }
- set
- {
- schemaLocation = value;
- this.UpdateCurrentFolder(schemaLocation);
- }
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether the round tripping mode is on or off.
- /// </summary>
- public bool RoundtripMode
- {
- get { return roundtripMode; }
- set { roundtripMode = value; }
- }
-
- /// <summary>
- /// Gets or sets the default path for the imported XSD files.
- /// </summary>
- public string DefaultPathForImports
- {
- get { return defaultPathForImports; }
- set { defaultPathForImports = value; }
- }
-
- /// <summary>
- /// Gets or sets the root directory for the project.
- /// </summary>
- public string ProjectRootDirectory
- {
- get { return projectRootDirectory; }
- set { projectRootDirectory = value; }
- }
-
- #endregion
-
- #region Constructors
-
- /// <summary>
- /// Initializes a new instance of WsdlWizardForm class with the specified values.
- /// </summary>
- /// <param name="xsdLocation">
- /// Location of the XSD file containing the message contract definitions for the WSDL.
- /// </param>
- public WsdlWizardForm(string xsdLocation)
- {
- //
- // Required for Windows Form Designer support.
- //
- InitializeComponent();
-
- schemaLocation = xsdLocation;
- this.UpdateCurrentFolder(schemaLocation);
-
- serviceInterfaceContract = new InterfaceContract();
- serviceInterfaceContract.SchemaNamespace = schemaLocation;
- }
-
- /// <summary>
- /// Initializes a new instance of WsdlWizardForm class with the specified values.
- /// </summary>
- /// <param name="wsdlLocation">Location of the WSDL file to modify.</param>
- /// <param name="roundTripping">
- /// Value indicating that the round tripping is required.
- /// </param>
- /// <remarks>
- /// The roundTripping parameter must be set to true in order to use the round tripping feature.
- /// </remarks>
- public WsdlWizardForm(string wsdlLocation, bool roundTripping)
- {
- //
- // Required for Windows Form Designer support.
- //
- InitializeComponent();
-
- // Import the interface contract from the selected WSDL file.
- try
- {
- this.importedContract =
- ServiceDescriptionEngine.GetInterfaceContract(wsdlLocation);
- this.wsdlFile = wsdlLocation;
- }
- catch(WsdlModifiedException ex)
- {
- throw new WsdlFileLoadException(
- "Could not import the specified WSDL file for round-triping.\nThis file is not compatible for round-tripping.", ex);
- }
- catch(WsdlNotCompatibleForRoundTrippingException ex)
- {
- throw new WsdlFileLoadException(
- "Could not import the specified WSDL file for round-triping.\nThis file is not compatible for round-tripping.", ex);
- }
- catch
- {
- throw new WsdlFileLoadException(
- "System could not import the specified WSDL file for round triping.\nThis file is either modified or not a valid WSDL file created using WSCF.exe.");
- }
-
- this.UpdateCurrentFolder(wsdlLocation);
- serviceInterfaceContract = new InterfaceContract();
- serviceInterfaceContract.SchemaNamespace = schemaLocation;
- this.roundtripMode = roundTripping;
- }
-
- #endregion
-
- #region Dispose
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
-
- #endregion
-
- #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.components = new System.ComponentModel.Container();
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WsdlWizardForm));
- this.wsdlWizardCtrl = new WizardControl.Wizard();
- this.wizardPageBasicMetadata = new WizardControl.WizardPage();
- this.tbServiceDoc = new System.Windows.Forms.TextBox();
- this.lblServiceDoc = new System.Windows.Forms.Label();
- this.lblNamespace = new System.Windows.Forms.Label();
- this.tbNamespace = new System.Windows.Forms.TextBox();
- this.lblServiceName = new System.Windows.Forms.Label();
- this.tbServiceName = new System.Windows.Forms.TextBox();
- this.wizardPageSchemaImports = new WizardControl.WizardPage();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.llRemoveImport = new System.Windows.Forms.LinkLabel();
- this.llAddImport = new System.Windows.Forms.LinkLabel();
- this.importsListView = new Thinktecture.Tools.Wscf.UI.WsdlWizard.EditableListView();
- this.wizardPageOperationsList = new WizardControl.WizardPage();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.operationsListView = new Thinktecture.Tools.Wscf.UI.WsdlWizard.EditableListView();
- this.llAddOperation = new System.Windows.Forms.LinkLabel();
- this.llRemoveOperation = new System.Windows.Forms.LinkLabel();
- this.cbInfer = new System.Windows.Forms.CheckBox();
- this.panel1 = new System.Windows.Forms.Panel();
- this.tbEdit = new System.Windows.Forms.TextBox();
- this.cbMEPs = new System.Windows.Forms.ComboBox();
- this.wizardPageMessageMapping = new WizardControl.WizardPage();
- this.ptvServiceOperations = new WRM.Windows.Forms.PropertyTree();
- this.wizardPageAdditionalOptions = new WizardControl.WizardPage();
- this.cbSoap12 = new System.Windows.Forms.CheckBox();
- this.cbSoap11 = new System.Windows.Forms.CheckBox();
- this.cbNeedsServiceElement = new System.Windows.Forms.CheckBox();
- this.cbCodeGenDialog = new System.Windows.Forms.CheckBox();
- this.wizardPageAlternativeXSDPaths = new WizardControl.WizardPage();
- this.xsdpathsListView = new Thinktecture.Tools.Wscf.UI.WsdlWizard.EditableListView();
- this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
- this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
- this.toolTipPath = new System.Windows.Forms.ToolTip(this.components);
- this.wsdlWizardCtrl.SuspendLayout();
- this.wizardPageBasicMetadata.SuspendLayout();
- this.wizardPageSchemaImports.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.wizardPageOperationsList.SuspendLayout();
- this.groupBox1.SuspendLayout();
- this.panel1.SuspendLayout();
- this.wizardPageMessageMapping.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.ptvServiceOperations)).BeginInit();
- this.wizardPageAdditionalOptions.SuspendLayout();
- this.wizardPageAlternativeXSDPaths.SuspendLayout();
- this.SuspendLayout();
- //
- // wsdlWizardCtrl
- //
- this.wsdlWizardCtrl.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.wsdlWizardCtrl.BannerBitmap = ((System.Drawing.Image)(resources.GetObject("wsdlWizardCtrl.BannerBitmap")));
- this.wsdlWizardCtrl.CloseForm = false;
- this.wsdlWizardCtrl.Controls.Add(this.wizardPageBasicMetadata);
- this.wsdlWizardCtrl.Controls.Add(this.wizardPageSchemaImports);
- this.wsdlWizardCtrl.Controls.Add(this.wizardPageOperationsList);
- this.wsdlWizardCtrl.Controls.Add(this.wizardPageMessageMapping);
- this.wsdlWizardCtrl.Controls.Add(this.wizardPageAdditionalOptions);
- this.wsdlWizardCtrl.Controls.Add(this.wizardPageAlternativeXSDPaths);
- this.wsdlWizardCtrl.Location = new System.Drawing.Point(0, 0);
- this.wsdlWizardCtrl.Name = "wsdlWizardCtrl";
- this.wsdlWizardCtrl.Size = new System.Drawing.Size(497, 360);
- this.wsdlWizardCtrl.TabIndex = 0;
- this.wsdlWizardCtrl.Title = "Generate WSDL";
- this.wsdlWizardCtrl.WelcomeBitmap = ((System.Drawing.Image)(resources.GetObject("wsdlWizardCtrl.WelcomeBitmap")));
- this.wsdlWizardCtrl.WelcomeText = resources.GetString("wsdlWizardCtrl.WelcomeText");
- this.wsdlWizardCtrl.BeforeSummaryPageDisplayed += new WizardControl.Wizard.BeforeSummaryPageDisplayedEventHandler(this.wsdlWizardCtrl_BeforeSummaryPageDisplayed);
- this.wsdlWizardCtrl.Finished += new WizardControl.Wizard.FinishedEventHandler(this.wsdlWizardCtrl_Finished);
- this.wsdlWizardCtrl.Load += new System.EventHandler(this.wsdlWizardCtrl_Load);
- this.wsdlWizardCtrl.Cancelled += new WizardControl.Wizard.CancelledEventHandler(this.wsdlWizardCtrl_Cancelled);
- this.wsdlWizardCtrl.BeforePageDisplayed += new WizardControl.Wizard.BeforePageDisplayedEventHandler(this.wsdlWizardCtrl_BeforePageDisplayed);
- this.wsdlWizardCtrl.AfterPageDisplayed += new WizardControl.Wizard.AfterPageDisplayedEventHandler(this.wsdlWizardCtrl_AfterPageDisplayed);
- this.wsdlWizardCtrl.ValidatePage += new WizardControl.Wizard.ValidatePageEventHandler(this.wsdlWizardCtrl_ValidatePage);
- //
- // wizardPageBasicMetadata
- //
- this.wizardPageBasicMetadata.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.wizardPageBasicMetadata.Controls.Add(this.tbServiceDoc);
- this.wizardPageBasicMetadata.Controls.Add(this.lblServiceDoc);
- this.wizardPageBasicMetadata.Controls.Add(this.lblNamespace);
- this.wizardPageBasicMetadata.Controls.Add(this.tbNamespace);
- this.wizardPageBasicMetadata.Controls.Add(this.lblServiceName);
- this.wizardPageBasicMetadata.Controls.Add(this.tbServiceName);
- this.wizardPageBasicMetadata.Description = "Please enter the name and the XML namespace of the Web Service.";
- this.wizardPageBasicMetadata.Heading = "Step 1: Specify your Web Service\'s basic settings";
- this.wizardPageBasicMetadata.Location = new System.Drawing.Point(21, 71);
- this.wizardPageBasicMetadata.Name = "wizardPageBasicMetadata";
- this.wizardPageBasicMetadata.Size = new System.Drawing.Size(456, 230);
- this.wizardPageBasicMetadata.TabIndex = 0;
- //
- // tbServiceDoc
- //
- this.tbServiceDoc.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.tbServiceDoc.Location = new System.Drawing.Point(120, 72);
- this.tbServiceDoc.Multiline = true;
- this.tbServiceDoc.Name = "tbServiceDoc";
- this.tbServiceDoc.Size = new System.Drawing.Size(312, 88);
- this.tbServiceDoc.TabIndex = 5;
- //
- // lblServiceDoc
- //
- this.lblServiceDoc.Location = new System.Drawing.Point(24, 72);
- this.lblServiceDoc.Name = "lblServiceDoc";
- this.lblServiceDoc.Size = new System.Drawing.Size(100, 23);
- this.lblServiceDoc.TabIndex = 4;
- this.lblServiceDoc.Text = "Documentation:";
- //
- // lblNamespace
- //
- this.lblNamespace.Location = new System.Drawing.Point(24, 40);
- this.lblNamespace.Name = "lblNamespace";
- this.lblNamespace.Size = new System.Drawing.Size(96, 23);
- this.lblNamespace.TabIndex = 3;
- this.lblNamespace.Text = "XML namespace:";
- //
- // tbNamespace
- //
- this.tbNamespace.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.tbNamespace.Location = new System.Drawing.Point(120, 40);
- this.tbNamespace.Name = "tbNamespace";
- this.tbNamespace.Size = new System.Drawing.Size(312, 20);
- this.tbNamespace.TabIndex = 2;
- //
- // lblServiceName
- //
- this.lblServiceName.Location = new System.Drawing.Point(24, 8);
- this.lblServiceName.Name = "lblServiceName";
- this.lblServiceName.Size = new System.Drawing.Size(88, 23);
- this.lblServiceName.TabIndex = 1;
- this.lblServiceName.Text = "Service name:";
- this.toolTip1.SetToolTip(this.lblServiceName, "\'Service name\' specifies the name of the Web Service binding to be generated. Thi" +
- "s will be the e.g. the class name for your Web Service proxy when generated from" +
- " the service description.");
- //
- // tbServiceName
- //
- this.tbServiceName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.tbServiceName.Location = new System.Drawing.Point(120, 6);
- this.tbServiceName.Name = "tbServiceName";
- this.tbServiceName.Size = new System.Drawing.Size(312, 20);
- this.tbServiceName.TabIndex = 0;
- this.toolTip1.SetToolTip(this.tbServiceName, "\'Service name\' specifies the name of the Web Service binding to be generated. Thi" +
- "s will be the e.g. the class name for your Web Service proxy when generated from" +
- " the service description.");
- //
- // wizardPageSchemaImports
- //
- this.wizardPageSchemaImports.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.wizardPageSchemaImports.Controls.Add(this.groupBox2);
- this.wizardPageSchemaImports.Cursor = System.Windows.Forms.Cursors.Default;
- this.wizardPageSchemaImports.Description = "Please add additional message schemas from XSD files as appropriate.";
- this.wizardPageSchemaImports.Heading = "Step 2: Specify additional message schemas";
- this.wizardPageSchemaImports.Location = new System.Drawing.Point(21, 71);
- this.wizardPageSchemaImports.Name = "wizardPageSchemaImports";
- this.wizardPageSchemaImports.Size = new System.Drawing.Size(456, 230);
- this.wizardPageSchemaImports.TabIndex = 2;
- //
- // groupBox2
- //
- this.groupBox2.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.groupBox2.Controls.Add(this.llRemoveImport);
- this.groupBox2.Controls.Add(this.llAddImport);
- this.groupBox2.Controls.Add(this.importsListView);
- this.groupBox2.Location = new System.Drawing.Point(8, 3);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(440, 224);
- this.groupBox2.TabIndex = 2;
- this.groupBox2.TabStop = false;
- this.groupBox2.Text = "XSD Imports:";
- //
- // llRemoveImport
- //
- this.llRemoveImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.llRemoveImport.Location = new System.Drawing.Point(95, 205);
- this.llRemoveImport.Name = "llRemoveImport";
- this.llRemoveImport.Size = new System.Drawing.Size(100, 16);
- this.llRemoveImport.TabIndex = 4;
- this.llRemoveImport.TabStop = true;
- this.llRemoveImport.Text = "Remove import";
- this.llRemoveImport.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llRemoveImport_LinkClicked);
- //
- // llAddImport
- //
- this.llAddImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.llAddImport.Location = new System.Drawing.Point(8, 205);
- this.llAddImport.Name = "llAddImport";
- this.llAddImport.Size = new System.Drawing.Size(81, 15);
- this.llAddImport.TabIndex = 3;
- this.llAddImport.TabStop = true;
- this.llAddImport.Text = "Add import";
- this.llAddImport.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llAddImport_LinkClicked);
- //
- // importsListView
- //
- this.importsListView.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.importsListView.DisabledColumns = ((System.Collections.ArrayList)(resources.GetObject("importsListView.DisabledColumns")));
- this.importsListView.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.importsListView.FullRowSelect = true;
- this.importsListView.GridLines = true;
- this.importsListView.Location = new System.Drawing.Point(8, 16);
- this.importsListView.Name = "importsListView";
- this.importsListView.Size = new System.Drawing.Size(424, 184);
- this.importsListView.TabIndex = 2;
- this.importsListView.UseCompatibleStateImageBehavior = false;
- this.importsListView.View = System.Windows.Forms.View.Details;
- this.importsListView.MouseMove += new System.Windows.Forms.MouseEventHandler(this.importsListView_MouseMove);
- //
- // wizardPageOperationsList
- //
- this.wizardPageOperationsList.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.wizardPageOperationsList.Controls.Add(this.groupBox1);
- this.wizardPageOperationsList.Controls.Add(this.panel1);
- this.wizardPageOperationsList.Description = "Please add operations to the Web Service as needed.";
- this.wizardPageOperationsList.Heading = "Step 3: Specify settings for your Web Service\'s operations.";
- this.wizardPageOperationsList.Location = new System.Drawing.Point(21, 71);
- this.wizardPageOperationsList.Name = "wizardPageOperationsList";
- this.wizardPageOperationsList.Size = new System.Drawing.Size(456, 230);
- this.wizardPageOperationsList.TabIndex = 1;
- //
- // groupBox1
- //
- this.groupBox1.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.groupBox1.Controls.Add(this.operationsListView);
- this.groupBox1.Controls.Add(this.llAddOperation);
- this.groupBox1.Controls.Add(this.llRemoveOperation);
- this.groupBox1.Controls.Add(this.cbInfer);
- this.groupBox1.Location = new System.Drawing.Point(8, 3);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(440, 224);
- this.groupBox1.TabIndex = 4;
- this.groupBox1.TabStop = false;
- this.groupBox1.Text = "Operations:";
- //
- // operationsListView
- //
- this.operationsListView.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.operationsListView.DisabledColumns = ((System.Collections.ArrayList)(resources.GetObject("operationsListView.DisabledColumns")));
- this.operationsListView.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.operationsListView.FullRowSelect = true;
- this.operationsListView.GridLines = true;
- this.operationsListView.Location = new System.Drawing.Point(8, 16);
- this.operationsListView.Name = "operationsListView";
- this.operationsListView.Size = new System.Drawing.Size(424, 184);
- this.operationsListView.TabIndex = 0;
- this.operationsListView.UseCompatibleStateImageBehavior = false;
- this.operationsListView.View = System.Windows.Forms.View.Details;
- //
- // llAddOperation
- //
- this.llAddOperation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.llAddOperation.Location = new System.Drawing.Point(7, 205);
- this.llAddOperation.Name = "llAddOperation";
- this.llAddOperation.Size = new System.Drawing.Size(81, 15);
- this.llAddOperation.TabIndex = 1;
- this.llAddOperation.TabStop = true;
- this.llAddOperation.Text = "Add operation";
- this.llAddOperation.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llAddOperation_LinkClicked);
- //
- // llRemoveOperation
- //
- this.llRemoveOperation.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.llRemoveOperation.Location = new System.Drawing.Point(95, 205);
- this.llRemoveOperation.Name = "llRemoveOperation";
- this.llRemoveOperation.Size = new System.Drawing.Size(100, 16);
- this.llRemoveOperation.TabIndex = 2;
- this.llRemoveOperation.TabStop = true;
- this.llRemoveOperation.Text = "Remove operation";
- this.llRemoveOperation.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.llRemoveOperation_LinkClicked);
- //
- // cbInfer
- //
- this.cbInfer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.cbInfer.Location = new System.Drawing.Point(336, 204);
- this.cbInfer.Name = "cbInfer";
- this.cbInfer.Size = new System.Drawing.Size(104, 16);
- this.cbInfer.TabIndex = 4;
- this.cbInfer.Text = "Infer Operations";
- this.cbInfer.CheckedChanged += new System.EventHandler(this.cbInfer_CheckedChanged);
- //
- // panel1
- //
- this.panel1.Controls.Add(this.tbEdit);
- this.panel1.Controls.Add(this.cbMEPs);
- this.panel1.Location = new System.Drawing.Point(24, 32);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(408, 192);
- this.panel1.TabIndex = 2;
- //
- // tbEdit
- //
- this.tbEdit.Location = new System.Drawing.Point(16, 16);
- this.tbEdit.Name = "tbEdit";
- this.tbEdit.Size = new System.Drawing.Size(100, 20);
- this.tbEdit.TabIndex = 3;
- this.tbEdit.Text = "textBox2";
- this.tbEdit.Visible = false;
- //
- // cbMEPs
- //
- this.cbMEPs.ItemHeight = 13;
- this.cbMEPs.Items.AddRange(new object[] {
- "Request/Response",
- "One-Way"});
- this.cbMEPs.Location = new System.Drawing.Point(272, 16);
- this.cbMEPs.Name = "cbMEPs";
- this.cbMEPs.Size = new System.Drawing.Size(121, 21);
- this.cbMEPs.TabIndex = 2;
- this.cbMEPs.Text = "comboBox1";
- this.cbMEPs.Visible = false;
- //
- // wizardPageMessageMapping
- //
- this.wizardPageMessageMapping.Controls.Add(this.ptvServiceOperations);
- this.wizardPageMessageMapping.Description = "Please enter all details for the service\'s operations and messages.";
- this.wizardPageMessageMapping.Heading = "Step 4: Specify the operation\'s message parameters";
- this.wizardPageMessageMapping.Location = new System.Drawing.Point(21, 71);
- this.wizardPageMessageMapping.Name = "wizardPageMessageMapping";
- this.wizardPageMessageMapping.Size = new System.Drawing.Size(456, 230);
- this.wizardPageMessageMapping.TabIndex = 3;
- //
- // ptvServiceOperations
- //
- this.ptvServiceOperations.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.ptvServiceOperations.ImageList = null;
- this.ptvServiceOperations.Indent = 19;
- this.ptvServiceOperations.Location = new System.Drawing.Point(0, -1);
- this.ptvServiceOperations.Name = "ptvServiceOperations";
- this.ptvServiceOperations.PaneHeaderVisible = false;
- this.ptvServiceOperations.SelectedImageIndex = -1;
- this.ptvServiceOperations.SelectedPaneNode = null;
- this.ptvServiceOperations.ShowLines = true;
- this.ptvServiceOperations.ShowPlusMinus = true;
- this.ptvServiceOperations.ShowRootLines = true;
- this.ptvServiceOperations.Size = new System.Drawing.Size(456, 232);
- this.ptvServiceOperations.SplitterColor = System.Drawing.SystemColors.AppWorkspace;
- this.ptvServiceOperations.SplitterLeft = 184;
- this.ptvServiceOperations.TabIndex = 1;
- //
- // wizardPageAdditionalOptions
- //
- this.wizardPageAdditionalOptions.Controls.Add(this.cbSoap12);
- this.wizardPageAdditionalOptions.Controls.Add(this.cbSoap11);
- this.wizardPageAdditionalOptions.Controls.Add(this.cbNeedsServiceElement);
- this.wizardPageAdditionalOptions.Controls.Add(this.cbCodeGenDialog);
- this.wizardPageAdditionalOptions.Description = "Please select any additional options to configure.";
- this.wizardPageAdditionalOptions.Heading = "Step 5: Additional options";
- this.wizardPageAdditionalOptions.Location = new System.Drawing.Point(21, 71);
- this.wizardPageAdditionalOptions.Name = "wizardPageAdditionalOptions";
- this.wizardPageAdditionalOptions.Size = new System.Drawing.Size(456, 230);
- this.wizardPageAdditionalOptions.TabIndex = 4;
- //
- // cbSoap12
- //
- this.cbSoap12.AutoSize = true;
- this.cbSoap12.Location = new System.Drawing.Point(24, 87);
- this.cbSoap12.Name = "cbSoap12";
- this.cbSoap12.Size = new System.Drawing.Size(144, 17);
- this.cbSoap12.TabIndex = 12;
- this.cbSoap12.Text = "Create SOAP 1.2 binding";
- this.cbSoap12.UseVisualStyleBackColor = true;
- //
- // cbSoap11
- //
- this.cbSoap11.AutoSize = true;
- this.cbSoap11.Checked = true;
- this.cbSoap11.CheckState = System.Windows.Forms.CheckState.Checked;
- this.cbSoap11.Enabled = false;
- this.cbSoap11.Location = new System.Drawing.Point(24, 51);
- this.cbSoap11.Name = "cbSoap11";
- this.cbSoap11.Size = new System.Drawing.Size(144, 17);
- this.cbSoap11.TabIndex = 11;
- this.cbSoap11.Text = "Create SOAP 1.1 binding";
- this.cbSoap11.UseVisualStyleBackColor = true;
- //
- // cbNeedsServiceElement
- //
- this.cbNeedsServiceElement.Location = new System.Drawing.Point(24, 8);
- this.cbNeedsServiceElement.Name = "cbNeedsServiceElement";
- this.cbNeedsServiceElement.Size = new System.Drawing.Size(192, 24);
- this.cbNeedsServiceElement.TabIndex = 10;
- this.cbNeedsServiceElement.Text = "Generate <service> element.";
- this.toolTip1.SetToolTip(this.cbNeedsServiceElement, "Enable this option if you want to have a <service> element generated for the WSDL" +
- " service description.");
- //
- // cbCodeGenDialog
- //
- this.cbCodeGenDialog.Location = new System.Drawing.Point(24, 169);
- this.cbCodeGenDialog.Name = "cbCodeGenDialog";
- this.cbCodeGenDialog.Size = new System.Drawing.Size(408, 24);
- this.cbCodeGenDialog.TabIndex = 6;
- this.cbCodeGenDialog.Text = "Open the code generation dialog after this wizard closes.";
- this.cbCodeGenDialog.CheckedChanged += new System.EventHandler(this.cbCodeGenDialog_CheckedChanged);
- //
- // wizardPageAlternativeXSDPaths
- //
- this.wizardPageAlternativeXSDPaths.Controls.Add(this.xsdpathsListView);
- this.wizardPageAlternativeXSDPaths.Description = "Please select the alternative XSD path for each XSD file imported.";
- this.wizardPageAlternativeXSDPaths.Heading = "Step 6: Alternative XSD Paths";
- this.wizardPageAlternativeXSDPaths.Location = new System.Drawing.Point(21, 71);
- this.wizardPageAlternativeXSDPaths.Name = "wizardPageAlternativeXSDPaths";
- this.wizardPageAlternativeXSDPaths.Size = new System.Drawing.Size(456, 230);
- this.wizardPageAlternativeXSDPaths.TabIndex = 5;
- //
- // xsdpathsListView
- //
- this.xsdpathsListView.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.xsdpathsListView.DisabledColumns = ((System.Collections.ArrayList)(resources.GetObject("xsdpathsListView.DisabledColumns")));
- this.xsdpathsListView.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.xsdpathsListView.FullRowSelect = true;
- this.xsdpathsListView.GridLines = true;
- this.xsdpathsListView.Location = new System.Drawing.Point(0, 0);
- this.xsdpathsListView.Name = "xsdpathsListView";
- this.xsdpathsListView.Size = new System.Drawing.Size(456, 224);
- this.xsdpathsListView.TabIndex = 3;
- this.xsdpathsListView.UseCompatibleStateImageBehavior = false;
- this.xsdpathsListView.View = System.Windows.Forms.View.Details;
- //
- // openFileDialog1
- //
- this.openFileDialog1.Filter = "XSD Files(*.xsd)|*.xsd";
- //
- // toolTipPath
- //
- this.toolTipPath.AutomaticDelay = 1000;
- //
- // WsdlWizardForm
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
- this.ClientSize = new System.Drawing.Size(497, 360);
- this.Controls.Add(this.wsdlWizardCtrl);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
- this.HelpButton = true;
- this.Name = "WsdlWizardForm";
- this.ShowInTaskbar = false;
- this.Text = "Create a WSDL Interface Description";
- this.Closing += new System.ComponentModel.CancelEventHandler(this.WsdlWizardForm_Closing);
- this.Load += new System.EventHandler(this.WSDLWizard_Load);
- this.wsdlWizardCtrl.ResumeLayout(false);
- this.wizardPageBasicMetadata.ResumeLayout(false);
- this.wizardPageBasicMetadata.PerformLayout();
- this.wizardPageSchemaImports.ResumeLayout(false);
- this.groupBox2.ResumeLayout(false);
- this.wizardPageOperationsList.ResumeLayout(false);
- this.groupBox1.ResumeLayout(false);
- this.panel1.ResumeLayout(false);
- this.panel1.PerformLayout();
- this.wizardPageMessageMapping.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.ptvServiceOperations)).EndInit();
- this.wizardPageAdditionalOptions.ResumeLayout(false);
- this.wizardPageAdditionalOptions.PerformLayout();
- this.wizardPageAlternativeXSDPaths.ResumeLayout(false);
- this.ResumeLayout(false);
-
- }
- #endregion
-
- #region Event handlers
-
- /// <summary>
- /// Performs the actions on loading the WSDL wizard.
- /// </summary>
- /// <param name="sender">Source of the event.</param>
- /// <param name="e">An instance of <see cref="EventArgs"/> class with the event data.</param>
- /// <remarks>If the round tripping mode is on, this method imports the data from the existing
- /// WSDL file to the UI.</remarks>
- private void WSDLWizard_Load(object sender, EventArgs e)
- {
- ptvServiceOperations.PaneHeaderVisible = true;
-
- // If the round tripping mode is on then import the data from the existing WSDL to the UI.
- if (this.roundtripMode)
- {
- if (importedContract.IsHttpBinding)
- {
- if (MessageBox.Show(this,
- "This WSDL contains an HTTP binding. It will be converted to a SOAP binding.\nAre you sure you want to perform this action?",
- "WSDL Wizard", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) ==
- DialogResult.Cancel)
- {
- this.DialogResult = DialogResult.Cancel;
- this.Close();
- }
- }
- ImportBasicServiceMetaData();
- if (!ImportSchemaImports())
- {
- this.DialogResult = DialogResult.Retry;
- this.Close();
- return;
- }
- ImportOperations();
- ImportAdditionalOptions();
- ImportEmbeddedTypes();
-
- }
- }
-
- /// <summary>
- /// Performs the actions before the summery page is loaded.
- /// </summary>
- /// <param name="sender">Source of the event.</param>
- /// <param name="e">An instance of <see cref="WizardPageSummaryEventArgs"/> with event data.</param>
- private void wsdlWizardCtrl_BeforeSummaryPageDisplayed(object sender, WizardPageSummaryEventArgs e)
- {
- openCodeGenDialog = cbCodeGenDialog.Checked;
-
- // Assign the modified alternative Xsd paths.
- foreach (ListViewItem li in xsdpathsListView.Items)
- {
- serviceInterfaceContract.Imports[li.Index].AlternateLocation =
- li.SubItems[1].Text;
- }
- }
-
- /// <summary>
- /// Performs the actions prior to displaying each page on the wizard control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">An instance of <see cref="WizardPageDisplayedEventArgs"/> class with event data.</param>
- private void wsdlWizardCtrl_BeforePageDisplayed(object sender, WizardPageDisplayedEventArgs e)
- {
- // Assign the basic meta data values to the instance of InterfaceContract class.
- if (e.Page == wizardPageSchemaImports)
- {
- bool isValid = InterfaceContract.ValidateUri(tbNamespace.Text);
- if (!isValid)
- {
- DisplayError("Invalid uri for the namespace. Enter a valid uri and try again.");
- e.Cancel = true;
- return;
- }
-
- serviceInterfaceContract.InitializeServiceInfo(tbServiceName.Text, tbNamespace.Text, schemaNamespace, tbServiceDoc.Text);
-
-
- return;
- }
-
- if (e.Page == wizardPageOperationsList)
- {
- try
- {
- //Load the dropdown for the operation types
- LoadOperationsListViewWithMEP();
- AddSchemasToContract();
- }
- catch (Exception ex)
- {
- DisplayError(ex.Message);
- e.Cancel = true;
- return;
-
- }
- }
-
- if (e.Page == wizardPageMessageMapping)
- {
- try
- {
- //Update the list of operations prior to setting up the panes
- UpdateOperations();
- // Setup the dynamic UI controls for the operation - message mapping UI.
- SetupOperationsMessagesPanes();
-
- if (ptvServiceOperations.PaneNodes.Count > 0)
- {
- ptvServiceOperations.SelectedPaneNode = ptvServiceOperations.PaneNodes[0];
- ptvServiceOperations.PaneNodes[0].Expanded = true;
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- return;
- }
-
- if (e.Page == wizardPageAdditionalOptions)
- {
- cbCodeGenDialog.Checked = this.roundtripMode;
- return;
- }
-
- if (e.Page == wizardPageAlternativeXSDPaths)
- {
- xsdpathsListView.Items.Clear();
- if (serviceInterfaceContract.Imports.Count > 0)
- {
- foreach (SchemaImport import in serviceInterfaceContract.Imports)
- {
- ListViewItem li = new ListViewItem(import.SchemaName);
- li.SubItems.Add(import.AlternateLocation);
- xsdpathsListView.Items.Add(li);
- }
- }
- else
- {
- wsdlWizardCtrl.AdvancePage();
- }
- return;
- }
- }
-
- /// <summary>
- /// Performs the validation before navigating to another page on the wizard control.
- /// </summary>
- /// <param name="sender">Source of the event.</param>
- /// <param name="e">An instance of <see cref="WizardPageSummaryEventArgs"/> with event data.</param>
- private void wsdlWizardCtrl_ValidatePage(object sender, WizardPageValidateEventArgs e)
- {
- // Validate the basic metadata.
- if (e.Page == wizardPageBasicMetadata)
- {
- if (tbServiceName.Text.Length == 0 || tbNamespace.Text.Length == 0)
- {
- MessageBox.Show("Please enter valid values.", "WSDL Wizard", MessageBoxButtons.OK,
- MessageBoxIcon.Exclamation);
- e.NextPage = 1;
- }
- }
-
- // Validate the operations list.
- if (e.Page == wizardPageOperationsList)
- {
- if (operationsListView.Items.Count == 0)
- {
- MessageBox.Show("Please specify any operations.", "WSDL Wizard", MessageBoxButtons.OK,
- MessageBoxIcon.Exclamation);
- e.NextPage = 3;
- }
- }
-
- // Validate the imported schemas list.
- if (e.Page == wizardPageSchemaImports)
- {
- if (serviceInterfaceContract.MessageSchemas.Count == 0 && importsListView.Items.Count == 0)
- {
- MessageBox.Show("Please add at least one XSD file.", "WSDL Wizard", MessageBoxButtons.OK,
- MessageBoxIcon.Exclamation);
- e.NextPage = 2;
- }
- }
- }
-
- /// <summary>
- /// Performs the actions after displaying a wizard page.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">An instance of <see cref="WizardPageEventArgs"/> with event data.</param>
- private void wsdlWizardCtrl_AfterPageDisplayed(object sender, WizardPageEventArgs e)
- {
- if (e.Page == wizardPageBasicMetadata)
- {
- tbServiceName.Focus();
- return;
- }
-
- if (e.Page == wizardPageAdditionalOptions)
- {
- if (ptvServiceOperations.PaneNodes.Count > 0)
- ptvServiceOperations.SelectedPaneNode = ptvServiceOperations.PaneNodes[0];
- }
- }
-
- /// <summary>
- /// Performs the actions upon closing the main wizard form.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">An instance of <see cref="CancelEventArgs"/> with event data.</param>
- /// <remarks>This method shows the confirmation dialog box , if the form is closed using the "Close" button.</remarks>
- private void WsdlWizardForm_Closing(object sender, CancelEventArgs e)
- {
- if (!alreadyCancelled)
- {
- if (MessageBox.Show("Do you really want to quit?",
- "WSDL Wizard", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- e.Cancel = true;
- }
- }
- }
-
- /// <summary>
- /// Performs the necessary initialization when the wizard control loads.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="e">An instance of <see cref="EventArgs"/> class with event data.</param>
- private void wsdlWizardCtrl_Load(object sender, EventArgs e)
- {
- // Add the columns to the operationsListView.
- operationsListView.Columns.Add("Operation Name", 210, HorizontalAlignment.Left);
- operationsListView.Columns.Add("Message Exchange Pattern", -2, HorizontalAlignment.Left);
-
- // Add the columns to the importsListView.
- importsListView.Columns.Add("File Name", 210, HorizontalAlignment.Left);
- importsListView.Columns.Add("Location", -1, HorizontalAlignment.Left);
-
- // Set the non editable columns.
- importsListView.DisabledColumns.Add("File Name");
- importsListView.DisabledColumns.Add("Location");
-
- // Add the columns to the xsdpathsListView.
- xsdpathsListView.Columns.Add("File Name", 210, HorizontalAlignment.Left);
- xsdpathsListView.Columns.Add("Alternative Path", -2, HorizontalAlignment.Left);
-
- // Set the non editable columns.
- xsdpathsListView.DisabledColumns.Add("File Name");
-
- // Load the default XSD to the schema imports list.
- string fname = schemaLocatio…
Large files files are truncated, but you can click here to view the full file