/// <summary> /// Overrides base Initialize method. /// </summary> /// <param name="testSite">An instance of the ITestSite.</param> public override void Initialize(ITestSite testSite) { base.Initialize(testSite); testSite.DefaultProtocolDocShortName = "MS-DWSS"; this.LoadCommonConfiguration(); // Load SHOULDMAY configuration this.LoadCurrentSutSHOULDMAYConfiguration(); this.dwsService = Proxy.CreateProxy <DwsSoap>(testSite); // Set default Dws service url to site collection. this.dwsService.Url = Common.GetConfigurationPropertyValue("SiteCollection", this.Site); // Set default Dws service credential to admin credential. string userName = Common.GetConfigurationPropertyValue("UserName", this.Site); string password = Common.GetConfigurationPropertyValue("Password", this.Site); string domain = Common.GetConfigurationPropertyValue("Domain", this.Site); this.dwsService.Credentials = new NetworkCredential(userName, password, domain); this.SetSoapVersion(this.dwsService); // When request Url include HTTPS prefix, avoid closing base connection. // Local client will accept all certificates after executing this function. this.transport = Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site); if (this.transport == TransportProtocol.HTTPS) { Common.AcceptServerCertificate(); } }
/// <summary> /// Initializes the services of MS-WEBSS with the specified transport type, soap version and user authentication provided by the test case. /// </summary> /// <param name="transportType">The type of the connection</param> /// <param name="soapVersion">The soap version of the protocol message</param> /// <param name="userAuthentication">a user authenticated</param> /// <param name="serverRelativeUrl"> a Server related URL</param> public void InitializeService(TransportProtocol transportType, SoapProtocolVersion soapVersion, UserAuthentication userAuthentication, string serverRelativeUrl) { this.service = Proxy.CreateProxy <WebsSoap>(this.Site); this.service.SoapVersion = soapVersion; // select transport protocol switch (transportType) { case TransportProtocol.HTTP: this.service.Url = serverRelativeUrl; break; default: this.service.Url = serverRelativeUrl; // when request URL include HTTPS prefix, avoid closing base connection. // local client will accept all certificate after execute this function. Common.AcceptServerCertificate(); break; } this.service.Credentials = AdapterHelper.ConfigureCredential(userAuthentication); // Configure the service timeout. int soapTimeOut = Common.GetConfigurationPropertyValue <int>("ServiceTimeOut", this.Site); // 60000 means the configure SOAP Timeout is in minute. this.service.Timeout = soapTimeOut * 60000; }
/// <summary> /// A method used to accept server certificate if current transport type is HTTPS /// </summary> public static void AcceptServerCertificate() { if (TransportProtocol.HTTPS == currentTransportType) { Common.AcceptServerCertificate(); } }
/// <summary> /// Initialize SUT control adapter. /// </summary> /// <param name="testSite">The test site instance associated with the current adapter.</param> public override void Initialize(ITestSite testSite) { base.Initialize(testSite); AdapterHelper.Initialize(testSite); this.listsService = new ListsSoap(); string transportType = Common.GetConfigurationPropertyValue("TransportType", testSite); this.listsService.Url = Common.GetConfigurationPropertyValue("MSLISTSWSServiceUrl", testSite); string domain = Common.GetConfigurationPropertyValue("Domain", testSite); string userName = Common.GetConfigurationPropertyValue("UserName", testSite); string userPassword = Common.GetConfigurationPropertyValue("Password", testSite); this.listsService.Credentials = new NetworkCredential(userName, userPassword, domain); SoapVersion soapVersion = Common.GetConfigurationPropertyValue <SoapVersion>("SoapVersion", this.Site); switch (soapVersion) { case SoapVersion.SOAP11: this.listsService.SoapVersion = SoapProtocolVersion.Soap11; break; default: this.listsService.SoapVersion = SoapProtocolVersion.Soap12; break; } if (string.Compare(transportType, "https", true, System.Globalization.CultureInfo.CurrentCulture) == 0) { Common.AcceptServerCertificate(); } }
/// <summary> /// This operation is used to switch to the corresponding WebApplication according to AuthenticationMode. /// </summary> /// <param name="authenticationMode">The current Authentication Mode.</param> public void SwitchWebApplication(AuthenticationMode authenticationMode) { TransportProtocol currenTransportType = Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site); if (currenTransportType == TransportProtocol.HTTP) { switch (authenticationMode) { case AuthenticationMode.Forms: this.authwsServiceStub.Url = Common.GetConfigurationPropertyValue("FormsAuthenticationUrlForHTTP", this.Site); break; case AuthenticationMode.None: this.authwsServiceStub.Url = Common.GetConfigurationPropertyValue("NoneAuthenticationUrlForHTTP", this.Site); break; case AuthenticationMode.Passport: this.authwsServiceStub.Url = Common.GetConfigurationPropertyValue("PassportAuthenticationUrlForHTTP", this.Site); break; case AuthenticationMode.Windows: this.authwsServiceStub.Url = Common.GetConfigurationPropertyValue("WindowsAuthenticationUrlForHTTP", this.Site); break; } } else if (currenTransportType == TransportProtocol.HTTPS) { // When request Url include HTTPS prefix, avoid closing base connection. // Local client will accept all certificates after executing this function. Common.AcceptServerCertificate(); switch (authenticationMode) { case AuthenticationMode.Forms: this.authwsServiceStub.Url = Common.GetConfigurationPropertyValue("FormsAuthenticationUrlForHTTPS", this.Site); break; case AuthenticationMode.None: this.authwsServiceStub.Url = Common.GetConfigurationPropertyValue("NoneAuthenticationUrlForHTTPS", this.Site); break; case AuthenticationMode.Passport: this.authwsServiceStub.Url = Common.GetConfigurationPropertyValue("PassportAuthenticationUrlForHTTPS", this.Site); break; case AuthenticationMode.Windows: this.authwsServiceStub.Url = Common.GetConfigurationPropertyValue("WindowsAuthenticationUrlForHTTPS", this.Site); break; } } else { Site.Assume.Fail("The property 'TransportType' value at the ptfconfig file must be HTTP or HTTPS."); } }
/// <summary> /// Overrides IAdapter's Initialize(). /// </summary> /// <param name="testSite">A parameter represents an ITestSite instance.</param> public override void Initialize(ITestSite testSite) { base.Initialize(testSite); testSite.DefaultProtocolDocShortName = "MS-ADMINS"; // Initialize the AdminSoap. this.adminService = Proxy.CreateProxy <AdminSoap>(this.Site); // Merge the common configuration into local configuration string conmmonConfigFileName = Common.GetConfigurationPropertyValue("CommonConfigurationFileName", this.Site); // Execute the merge the common configuration Common.MergeGlobalConfig(conmmonConfigFileName, this.Site); Common.CheckCommonProperties(this.Site, true); // Load SHOULDMAY configuration Common.MergeSHOULDMAYConfig(this.Site); TransportProtocol transport = Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site); switch (transport) { case TransportProtocol.HTTP: { this.adminService.Url = Common.GetConfigurationPropertyValue("HTTPTargetServiceUrl", this.Site); break; } default: { this.adminService.Url = Common.GetConfigurationPropertyValue("HTTPSTargetServiceUrl", this.Site); // When request Url include HTTPS prefix, avoid closing base connection. // Local client will accept all certificates after executing this function. Common.AcceptServerCertificate(); break; } } string userName = Common.GetConfigurationPropertyValue("UserName", this.Site); string password = Common.GetConfigurationPropertyValue("Password", this.Site); string domain = Common.GetConfigurationPropertyValue("Domain", this.Site); this.adminService.Credentials = new NetworkCredential(userName, password, domain); this.SetSoapVersion(this.adminService); // Configure the service timeout. string soapTimeOut = Common.GetConfigurationPropertyValue("ServiceTimeOut", this.Site); // 60000 means the configure SOAP Timeout is in milliseconds. this.adminService.Timeout = Convert.ToInt32(soapTimeOut) * 60000; }
/// <summary> /// The Overridden Initialize method, it includes the initialization logic of this adapter. /// </summary> /// <param name="testSite">The ITestSite member of ManagedAdapterBase</param> public override void Initialize(ITestSite testSite) { base.Initialize(testSite); this.defaultUserName = Common.GetConfigurationPropertyValue("UserName", this.Site); this.defaultPassword = Common.GetConfigurationPropertyValue("Password", this.Site); this.defaultDomain = Common.GetConfigurationPropertyValue("Domain", this.Site); this.currentTransport = Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site); if (TransportProtocol.HTTPS == this.currentTransport) { Common.AcceptServerCertificate(); } }
/// <summary> /// Initialize the protocol adapter. /// </summary> /// <param name="testSite">Transfer ITestSite into adapter, make adapter can use ITestSite's function.</param> public override void Initialize(ITestSite testSite) { base.Initialize(testSite); testSite.DefaultProtocolDocShortName = "MS-VERSS"; AdapterHelper.Initialize(testSite); if (this.service == null) { string globalConfigFileName = Common.GetConfigurationPropertyValue("CommonConfigurationFileName", testSite); Common.MergeGlobalConfig(globalConfigFileName, testSite); Common.CheckCommonProperties(this.Site, true); Common.MergeSHOULDMAYConfig(testSite); this.service = Proxy.CreateProxy <VersionsSoap>(testSite); this.service.Url = Common.GetConfigurationPropertyValue("MSVERSSServiceUrl", testSite); SoapVersion soapVersion = Common.GetConfigurationPropertyValue <SoapVersion>("SoapVersion", this.Site); switch (soapVersion) { case SoapVersion.SOAP11: this.service.SoapVersion = SoapProtocolVersion.Soap11; break; default: this.service.SoapVersion = SoapProtocolVersion.Soap12; break; } TransportProtocol transportType = Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site); switch (transportType) { case TransportProtocol.HTTPS: Common.AcceptServerCertificate(); this.transportProtocol = TransportProtocol.HTTPS; break; default: this.transportProtocol = TransportProtocol.HTTP; break; } } string domain = Common.GetConfigurationPropertyValue("Domain", testSite); string userName = Common.GetConfigurationPropertyValue("UserName", testSite); string userPassword = Common.GetConfigurationPropertyValue("Password", testSite); this.service.Credentials = new NetworkCredential(userName, userPassword, domain); }
/// <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> /// This operation is used to initialize sites service with authority information. /// </summary> /// <param name="userAuthentication">This parameter used to assign the authentication information of web service.</param> public void InitializeWebService(UserAuthenticationOption userAuthentication) { this.service = Proxy.CreateProxy <SitesSoap>(this.Site); // Configure the soap service timeout. string soapServiceTimeOut = Common.GetConfigurationPropertyValue(Constants.SoapServiceTimeOut, this.Site); this.service.Timeout = Convert.ToInt32(soapServiceTimeOut) * 1000; TransportProtocol transport = Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site); switch (transport) { case TransportProtocol.HTTP: this.transportProtocol = TransportType.HTTP; break; default: this.transportProtocol = TransportType.HTTPS; break; } SoapVersion soapVersion = Common.GetConfigurationPropertyValue <SoapVersion>("SoapVersion", this.Site); switch (soapVersion) { case SoapVersion.SOAP11: this.service.SoapVersion = SoapProtocolVersion.Soap11; break; default: this.service.SoapVersion = SoapProtocolVersion.Soap12; break; } this.service.Url = Common.GetConfigurationPropertyValue(Constants.ServiceUrl, this.Site); if (this.transportProtocol == TransportType.HTTPS) { Common.AcceptServerCertificate(); } this.SetLoginUser(userAuthentication); }
/// <summary> /// Send http request with specified method and header to get the corresponding response. /// </summary> /// <param name="method">Http request method.</param> /// <param name="request">The header and content.</param> /// <returns>The response from server.</returns> public HttpWebResponse SendMessage(HttpMethod method, Request request) { HttpWebResponse response = null; string url = string.Format("{0}/{1}", Common.GetConfigurationPropertyValue("TargetServiceUrl", this.testsite), request.Parameter); HttpWebRequest webRequest = (HttpWebRequest)HttpWebRequest.Create(url); webRequest.Method = method.ToString(); webRequest.Accept = request.Accept; webRequest.ContentType = request.ContentType; if (method == HttpMethod.POST && !string.IsNullOrEmpty(request.Slug)) { webRequest.Headers.Add("slug", request.Slug); } if (method == HttpMethod.PUT || method == HttpMethod.MERGE) { webRequest.Headers.Add("If-Match", request.ETag); } webRequest.Credentials = new NetworkCredential( Common.GetConfigurationPropertyValue("UserName", this.testsite), Common.GetConfigurationPropertyValue("Password", this.testsite), Common.GetConfigurationPropertyValue("Domain", this.testsite)); if (Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.testsite) == TransportProtocol.HTTPS) { Common.AcceptServerCertificate(); } if (!string.IsNullOrEmpty(request.Content)) { byte[] postBytes = Encoding.ASCII.GetBytes(request.Content); Stream postStream = webRequest.GetRequestStream(); postStream.Write(postBytes, 0, postBytes.Length); postStream.Close(); } response = webRequest.GetResponse() as HttpWebResponse; return(response); }
/// <summary> /// Initialize SUT control adapter. /// </summary> /// <param name="testSite">The test site instance associated with the current adapter.</param> public override void Initialize(ITestSite testSite) { base.Initialize(testSite); this.listsService = new ListsSoap(); string domain = Common.GetConfigurationPropertyValue("Domain", testSite); string userName = Common.GetConfigurationPropertyValue("UserName", testSite); string userPassword = Common.GetConfigurationPropertyValue("Password", testSite); this.listsService.Credentials = new NetworkCredential(userName, userPassword, domain); this.listsService.Url = Common.GetConfigurationPropertyValue("ListwsServiceUrl", testSite); this.listsService.SoapVersion = Common.GetConfigurationPropertyValue <SoapProtocolVersion>("SoapVersion", this.Site); TransportProtocol transport = Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site); if (transport == TransportProtocol.HTTPS) { Common.AcceptServerCertificate(); } }
/// <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) { base.Initialize(testSite); // Set the protocol name of current test suite testSite.DefaultProtocolDocShortName = "MS-VIEWSS"; // Load Common configuration this.LoadCommonConfiguration(); // Check whether the common properties are valid. Common.CheckCommonProperties(this.Site, true); // Merge the SHOULD MAY config files in the test site. Common.MergeSHOULDMAYConfig(this.Site); // Initialize the proxy. this.viewssProxy = Proxy.CreateProxy <ViewsSoap>(this.Site, false, true, false); // Get target service fully qualified URL this.viewssProxy.Url = Common.GetConfigurationPropertyValue("TargetServiceUrl", this.Site); string userName = Common.GetConfigurationPropertyValue("UserName", this.Site); string password = Common.GetConfigurationPropertyValue("Password", this.Site); string domain = Common.GetConfigurationPropertyValue("Domain", this.Site); this.viewssProxy.Credentials = new NetworkCredential(userName, password, domain); // Set SOAP version according to the configuration file. this.SetSoapVersion(); if (TransportProtocol.HTTPS == Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site)) { Common.AcceptServerCertificate(); } // Configure the service timeout. int soapTimeOut = Common.GetConfigurationPropertyValue <int>("ServiceTimeOut", this.Site); // 60000 means the SOAP Timeout in minute. this.viewssProxy.Timeout = soapTimeOut * 60000; }
/// <summary> /// Overrides IAdapter's Initialize(), to set default protocol short name of the testSite. /// </summary> /// <param name="testSite">Transfer ITestSite into Adapter,Make adapter can use ITestSite's function.</param> public override void Initialize(ITestSite testSite) { base.Initialize(testSite); // Set the protocol name of current test suite testSite.DefaultProtocolDocShortName = "MS-CPSWS"; // Load Common configuration this.LoadCommonConfiguration(); Common.CheckCommonProperties(this.Site, true); // Load SHOULDMAY configuration Common.MergeSHOULDMAYConfig(this.Site); // Initialize the proxy. this.cpswsClient = this.GetClaimProviderWebServiceClient(); // Set Credentials information Common.AcceptServerCertificate(); }
/// <summary> /// The Overridden Initialize method, it includes the initialization logic of this adapter. /// </summary> /// <param name="testSite">The ITestSite member of ManagedAdapterBase</param> public override void Initialize(ITestSite testSite) { base.Initialize(testSite); TransportProtocol transport = Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site); if (TransportProtocol.HTTPS == transport) { Common.AcceptServerCertificate(); } // In this moment, the thread user should not be impersonated. if (null != WindowsIdentity.GetCurrent(true)) { string errorMsg = string.Format("Current thread[{0}]: The thread user should not be impersonated in adapter initialization.", Thread.CurrentThread.ManagedThreadId); throw new InvalidOperationException(errorMsg); } this.PatternOfRequestWOPIViewFile = Common.GetConfigurationPropertyValue("RequestWOPIViewFileUrlPattern", this.Site); this.PatternOfRequestWOPIViewFolder = Common.GetConfigurationPropertyValue("RequestWOPIViewFolderUrlPattern", this.Site); this.currentTransport = Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site); }
/// <summary> /// Overrides IAdapter's Initialize(). /// </summary> /// <param name="testSite">A parameter represents an ITestSite instance.</param> public override void Initialize(ITestSite testSite) { base.Initialize(testSite); testSite.DefaultProtocolDocShortName = "MS-MEETS"; // Initialize the MeetingSoap. this.service = Proxy.CreateProxy <MeetingsSoap>(this.Site); // Load common configuration. this.LoadCommonConfiguration(); // Load SHOULDMAY configuration this.LoadCurrentSutSHOULDMAYConfiguration(); this.service.Url = Common.GetConfigurationPropertyValue("TargetServiceUrl", this.Site); string userName = Common.GetConfigurationPropertyValue("UserName", this.Site); string password = Common.GetConfigurationPropertyValue("Password", this.Site); string domain = Common.GetConfigurationPropertyValue("Domain", this.Site); this.service.Credentials = new NetworkCredential(userName, password, domain); this.SetSoapVersion(this.service); // When request Url include HTTPS prefix, avoid closing base connection. // Local client will accept all certificates after executing this function. TransportProtocol transport = Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site); if (transport == TransportProtocol.HTTPS) { Common.AcceptServerCertificate(); } // Configure the service timeout. string soapTimeOut = Common.GetConfigurationPropertyValue("ServiceTimeOut", this.Site); // 60000 means the configure SOAP Timeout is in milliseconds. this.service.Timeout = Convert.ToInt32(soapTimeOut) * 60000; }
/// <summary> /// The Overridden Initialize method /// </summary> /// <param name="testSite">The ITestSite member of ManagedAdapterBase</param> public override void Initialize(ITestSite testSite) { base.Initialize(testSite); // Set the protocol name of current test suite testSite.DefaultProtocolDocShortName = "MS-OUTSPS"; // Initialize the ListsSoap proxy class instance without the schema validation. this.listsProxy = Proxy.CreateProxy <ListsSoap>(this.Site, false, false, true); // Merge the common configuration into local configuration string conmmonConfigFileName = Common.GetConfigurationPropertyValue("CommonConfigurationFileName", this.Site); Common.MergeGlobalConfig(conmmonConfigFileName, this.Site); Common.CheckCommonProperties(this.Site, true); // Merge the SHOULDMAY configuration file. Common.MergeSHOULDMAYConfig(this.Site); this.listsProxy.Url = this.GetTargetServiceUrl(); string userName = Common.GetConfigurationPropertyValue("UserName", this.Site); string password = Common.GetConfigurationPropertyValue("Password", this.Site); string domain = Common.GetConfigurationPropertyValue("Domain", this.Site); this.listsProxy.Credentials = new NetworkCredential(userName, password, domain); this.SetSoapVersion(); if (TransportProtocol.HTTPS == Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site)) { Common.AcceptServerCertificate(); } // Configure the service timeout. int soapTimeOut = Common.GetConfigurationPropertyValue <int>("ServiceTimeOut", this.Site); // 60000 means the configure SOAP Timeout is in minute. this.listsProxy.Timeout = soapTimeOut * 60000; }
/// <summary> /// Initialize the adapter instance. /// </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) { base.Initialize(testSite); // Initialize the proxy. this.listProxy = new ListsSoap(); // Get target service fully qualified URL this.listProxy.Url = Common.GetConfigurationPropertyValue("ListsServiceUrl", this.Site); string userName = Common.GetConfigurationPropertyValue("UserName", this.Site); string password = Common.GetConfigurationPropertyValue("Password", this.Site); string domain = Common.GetConfigurationPropertyValue("Domain", this.Site); this.listProxy.Credentials = new NetworkCredential(userName, password, domain); // Set soap version according to the configuration file. this.SetSoapVersion(); if (TransportProtocol.HTTPS == Common.GetConfigurationPropertyValue <TransportProtocol>("TransportType", this.Site)) { Common.AcceptServerCertificate(); } }
/// <summary> /// This method is used to send the cell storage request to the server. /// </summary> /// <param name="url">Specifies the URL of the file to edit.</param> /// <param name="subRequests">Specifies the sub request array.</param> /// <param name="requestToken">Specifies a non-negative request token integer that uniquely identifies the Request <seealso cref="Request"/>.</param> /// <param name="version">Specifies the version number of the request, whose value should only be 2.</param> /// <param name="minorVersion">Specifies the minor version number of the request, whose value should only be 0 or 2.</param> /// <param name="interval">Specifies a nonnegative integer in seconds, which the protocol client will repeat this request, the default value is null.</param> /// <param name="metaData">Specifies a 32-bit value that specifies information about the scenario and urgency of the request, the default value is null.</param> /// <param name="lastModifiedTime">Specify the last modified time, which is expressed as a tick count.</param> /// <param name="parentFolderResourceID">If UseResourceID is true, this parameter tells the host to create a file in the given folder ResourceID, regardless of the request URL value.</param> /// <param name="shouldReturnDisambiguatedFileName">If an upload request fails with a coherency failure, this flag specifies whether the host should return a suggested/available file name that the client can try instead</param> /// <param name="resourceID">Specify the invariant ResourceID for a file that uniquely identifies the file whose response is being generated</param> /// <param name="useResourceID">Specify if the protocol server MAY perform ResourceID specific behavior for the file whose contents or metadata contents are requested for uploading to the server or downloading from the server. </param> /// <returns>Returns the CellStorageResponse message received from the server.</returns> public CellStorageResponse CellStorageRequest( string url, SubRequestType[] subRequests, string requestToken = "1", ushort?version = 2, ushort?minorVersion = 2, uint?interval = null, int?metaData = null, string lastModifiedTime = null, string parentFolderResourceID = null, bool?shouldReturnDisambiguatedFileName = null, string resourceID = null, bool?useResourceID = null) { // If the transport is HTTPS, then try to accept the certificate. if ("HTTPS".Equals(Common.GetConfigurationPropertyValue("TransportType", this.Site), StringComparison.OrdinalIgnoreCase)) { Common.AcceptServerCertificate(); } ICellStoragesChannel channel = channelManager.CreateChannel <ICellStoragesChannel>(SharedContext.Current); // Store the SubRequestToken, subRequest type pairs this.subResponseValidationWrappers.Clear(); if (subRequests != null) { foreach (SubRequestType item in subRequests) { this.subResponseValidationWrappers.Add(new SubResponseValidationWrapper { SubToken = item.SubRequestToken, SubRequestType = item.GetType().Name }); } } // Create web request message. RequestMessageBodyWriter fsshttpBodyWriter = new RequestMessageBodyWriter(version, minorVersion); fsshttpBodyWriter.AddRequest(url, subRequests, requestToken, interval, metaData, lastModifiedTime, parentFolderResourceID, shouldReturnDisambiguatedFileName, resourceID, useResourceID); this.lastRawRequestXml = fsshttpBodyWriter.MessageBodyXml; // Try to log the request body information this.Site.Log.Add(LogEntryKind.Debug, "The raw xml request message is:\r\n{0}", this.lastRawRequestXml.OuterXml); Message request = Message.CreateMessage(MessageVersion.Soap11, ActionURL, fsshttpBodyWriter); try { // Invoke the web service Message response = channel.ExecuteCellStorageRequest(request); // Extract and de-serialize the response. CellStorageResponse cellStorageResponseObjects = this.GetCellStorageResponseObject(response); // Restore the current version type SharedContext.Current.CellStorageVersionType = cellStorageResponseObjects.ResponseVersion; SharedContext.Current.FileUrl = url; // Schema Validation for the response. this.ValidateGenericType(cellStorageResponseObjects, requestToken); this.ValidateSpecificType(cellStorageResponseObjects); request.Close(); return(cellStorageResponseObjects); } catch (EndpointNotFoundException ex) { // Here try to catch the EndpointNotFoundException due to X-WOPI-ServerError. if (ex.InnerException is WebException) { if (((ex.InnerException as WebException).Response as HttpWebResponse).StatusCode == HttpStatusCode.NotFound) { request.Close(); return(null); } else if ((ex.InnerException as WebException).Response.Headers.AllKeys.Contains <string>("X-WOPI-ServerError")) { throw new WOPIServerErrorException( (ex.InnerException as System.Net.WebException).Response.Headers["X-WOPI-ServerError"], ex.InnerException); } } request.Close(); throw; } catch (ProtocolException) { request.Close(); return(null); } }