/// <summary> /// Overrides IAdapter's Initialize method, to set default protocol short name of the testSite. /// </summary> /// <param name="testSite">A parameter represents a ITestSite instance which is used to get/operate current test suite context.</param> public override void Initialize(ITestSite testSite) { // Set the protocol name of current test suite testSite.DefaultProtocolDocShortName = "MS-WWSP"; base.Initialize(testSite); AdapterHelper.Initialize(testSite); // Merge the common configuration string conmmonConfigFileName = Common.GetConfigurationPropertyValue("CommonConfigurationFileName", this.Site); Common.MergeGlobalConfig(conmmonConfigFileName, this.Site); Common.CheckCommonProperties(this.Site, true); // Load SHOULDMAY configuration Common.MergeSHOULDMAYConfig(this.Site); // Initialize the proxy. this.wwspProxy = Proxy.CreateProxy<WorkflowSoap>(this.Site); // Set soap version according to the configuration file. this.SetSoapVersion(this.wwspProxy); // Setup the request URL. this.wwspProxy.Url = Common.GetConfigurationPropertyValue("TargetServiceUrl", this.Site); // Configure the service timeout. int soapTimeOut = Common.GetConfigurationPropertyValue<int>("ServiceTimeOut", this.Site); // 60000 means the configure SOAP Timeout is in minute. this.wwspProxy.Timeout = soapTimeOut * 60000; // Set Credentials information string userName = Common.GetConfigurationPropertyValue("MSWWSPTestAccount", this.Site); string password = Common.GetConfigurationPropertyValue("MSWWSPTestAccountPassword", this.Site); string domain = Common.GetConfigurationPropertyValue("Domain", this.Site); this.wwspProxy.Credentials = new NetworkCredential(userName, password, domain); if (TransportProtocol.HTTPS == Common.GetConfigurationPropertyValue<TransportProtocol>("TransportType", this.Site)) { Common.AcceptServerCertificate(); } }
/// <summary> /// Set the SOAP version according to the SoapVersion property. /// </summary> /// <param name="proxyInstance">A parameter represents the proxy instance which will be set soap version</param> private void SetSoapVersion(WorkflowSoap proxyInstance) { string soapVersion = Common.GetConfigurationPropertyValue("SoapVersion", this.Site); if (string.Compare(soapVersion, "SOAP11", true) == 0) { proxyInstance.SoapVersion = SoapProtocolVersion.Soap11; } else if (string.Compare(soapVersion, "SOAP12", true) == 0) { proxyInstance.SoapVersion = SoapProtocolVersion.Soap12; } else { Site.Assume.Fail( "Property SoapVersion value must be {0} or {1} at the ptfconfig file.", "SOAP11", "SOAP12"); } }