/// <summary> /// Verify the requirements of SubmitFile in Adapter. /// When the server returns a SubmitFile response successfully, /// which includes web service output message and soap fault. /// </summary> /// <param name="result">The response of SubmitFile.</param> /// <returns>Return the SubmitFileResult corresponding class instance.</returns> private SubmitFileResult VerifyAndParseSubmitFile(string result) { #region verify schema of SubmitFile // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R197 Site.CaptureRequirement( "MS-OFFICIALFILE", 197, @"[In SubmitFile] [This method is called to submit a file and its associated properties to the repository.] <wsdl:operation name=""SubmitFile"" xmlns:wsdl=""http://schemas.xmlsoap.org/wsdl/""> <wsdl:input message=""tns:SubmitFileSoapIn""/> <wsdl:output message=""tns:SubmitFileSoapOut""/> </wsdl:operation>"); // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R224 Site.CaptureRequirement( "MS-OFFICIALFILE", 224, @"[In SubmitFileSoapOut] The SOAP body contains the SubmitFileResponse element."); // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R198 Site.CaptureRequirement( "MS-OFFICIALFILE", 198, @"[In SubmitFile] The protocol client sends a SubmitFileSoapIn request WSDL message, and the protocol server MUST respond with a SubmitFileSoapOut response WSDL message."); // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R237 Site.CaptureRequirement( "MS-OFFICIALFILE", 237, @"[In SubmitFileResponse] The SubmitFileResponse element specifies the result data for the SubmitFile WSDL operation. <xs:element name=""SubmitFileResponse"" xmlns:xs=""http://www.w3.org/2001/XMLSchema""> <xs:complexType> <xs:sequence> <xs:element minOccurs=""0"" maxOccurs=""1"" name=""SubmitFileResult"" type=""xs:string""/> </xs:sequence> </xs:complexType> </xs:element>"); #endregion verify of SubmitFile #region schema of response result of SubmitFile // Validate the SubmitFileResult string which confirm to the specified XML definition. result = @"<SubmitFileResult xmlns=""http://schemas.microsoft.com/sharepoint/soap/recordsrepository/"">" + result + "</SubmitFileResult>"; Common.ValidationResult validationResult = Common.SchemaValidation.ValidateXml(this.Site, result); // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R238 Site.CaptureRequirementIfAreEqual <Common.ValidationResult>( Common.ValidationResult.Success, validationResult, "MS-OFFICIALFILE", 238, @"[In SubmitFileResponse] SubmitFileResult: Data details about the result, which is a string of an encoded XML fragment that MUST conform to the XML schema of the SubmitFileResult complex type."); // Parse the SubmitFileResult from xml to class. SubmitFileResult value = this.ParseSubmitFileResult(result); // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R239 Site.CaptureRequirementIfAreEqual <Common.ValidationResult>( Common.ValidationResult.Success, validationResult, "MS-OFFICIALFILE", 239, @"[In SubmitFileResult] The detailed data result for the SubmitFile WSDL operation. <xs:complexType name=""SubmitFileResult"" xmlns:xs=""http://www.w3.org/2001/XMLSchema""> <xs:sequence> <xs:element name=""ResultCode"" type=""tns:SubmitFileResultCode""/> <xs:choice> <xs:element minOccurs=""0"" name=""ResultUrl"" type=""xs:anyURI""/> <xs:element minOccurs=""0"" name=""AdditionalInformation"" type=""xs:string""/> </xs:choice> <xs:element minOccurs=""0"" name=""CustomProcessingResult"" type=""tns:CustomProcessingResult""/> </xs:sequence> </xs:complexType>"); if (value.CustomProcessingResult != null) { // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R244 Site.CaptureRequirementIfAreEqual <Common.ValidationResult>( Common.ValidationResult.Success, validationResult, "MS-OFFICIALFILE", 244, @"[In CustomProcessingResult] The result of custom processing of a legal hold. <xs:complexType name=""CustomProcessingResult"" xmlns:xs=""http://www.w3.org/2001/XMLSchema""> <xs:sequence> <xs:element minOccurs=""0"" name=""HoldsProcessingResult"" type=""tns:HoldProcessingResult""/> </xs:sequence> </xs:complexType"); // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R256 Site.CaptureRequirementIfAreEqual <Common.ValidationResult>( Common.ValidationResult.Success, validationResult, "MS-OFFICIALFILE", 256, @"[In HoldProcessingResult] The result of processing a legal hold. <xs:simpleType name=""HoldProcessingResult"" xmlns:xs=""http://www.w3.org/2001/XMLSchema""> <xs:restriction base=""xs:string""> <xs:enumeration value=""Success""/> <xs:enumeration value=""Failure""/> <xs:enumeration value=""InDropOffZone""/> </xs:restriction> </xs:simpleType>"); } // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R246 Site.CaptureRequirementIfAreEqual <Common.ValidationResult>( Common.ValidationResult.Success, validationResult, "MS-OFFICIALFILE", 246, @"[In SubmitFileResultCode] The result status code of a SubmitFile WSDL operation. <xs:simpleType name=""SubmitFileResultCode"" xmlns:xs=""http://www.w3.org/2001/XMLSchema""> <xs:restriction base=""xs:string""> <xs:enumeration value=""Success""/> <xs:enumeration value=""MoreInformation""/> <xs:enumeration value=""InvalidRouterConfiguration""/> <xs:enumeration value=""InvalidArgument""/> <xs:enumeration value=""InvalidUser""/> <xs:enumeration value=""NotFound""/> <xs:enumeration value=""FileRejected""/> <xs:enumeration value=""UnknownError""/> </xs:restriction> </xs:simpleType>"); #endregion schema of response result of SubmitFile return(value); }
/// <summary> /// Verify the requirements of GetServerInfo and parse the GetServerInfoResult from xml to class When the server returns a GetServerInfo response successfully. /// </summary> /// <param name="serverInfo">The response of GetServerInfo.</param> /// <returns>Return the GetServerInfoResult corresponding class instance.</returns> private ServerInfo VerifyAndParseGetServerInfo(string serverInfo) { #region Requirments of schema are verified directly according to the comment above. // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R185 Site.CaptureRequirement( "MS-OFFICIALFILE", 185, @"[In GetServerInfo] [This method is called to retrieve information about the repository, such as its type, version, and whether the repository is configured for routing.] <wsdl:operation name=""GetServerInfo"" xmlns:wsdl=""http://schemas.xmlsoap.org/wsdl/""> <wsdl:input message=""tns:GetServerInfoSoapIn""/> <wsdl:output message=""tns:GetServerInfoSoapOut""/> </wsdl:operation>"); // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R193 Site.CaptureRequirement( "MS-OFFICIALFILE", 193, @"[In GetServerInfoSoapOut] The SOAP body contains the GetServerInfoResponse element."); // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R195 Site.CaptureRequirement( "MS-OFFICIALFILE", 195, @"[In GetServerInfoResponse] The GetServerInfoResponse element specifies the result data for the GetServerInfo WSDL operation. <xs:element name=""GetServerInfoResponse"" xmlns:xs=""http://www.w3.org/2001/XMLSchema""> <xs:complexType> <xs:sequence> <xs:element minOccurs=""0"" maxOccurs=""1"" name=""GetServerInfoResult"" type=""xs:string""/> </xs:sequence> </xs:complexType> </xs:element>"); #endregion // Validate the GetServerInfoResult string which confirm to the specified XML definition. string result = @"<ServerInfoResult xmlns=""http://schemas.microsoft.com/sharepoint/soap/recordsrepository/"">" + serverInfo + "</ServerInfoResult>"; Common.ValidationResult validationResult = Common.SchemaValidation.ValidateXml(this.Site, result); // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R196 Site.CaptureRequirementIfAreEqual <Common.ValidationResult>( Common.ValidationResult.Success, validationResult, "MS-OFFICIALFILE", 196, @"[In GetServerInfoResponse] GetServerInfoResult: Type and version information for a protocol server, which MUST be an XML fragment that conforms to the XML schema of the ServerInfo complex type."); // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R34 Site.CaptureRequirementIfAreEqual <Common.ValidationResult>( Common.ValidationResult.Success, validationResult, "MS-OFFICIALFILE", 34, @"[In ServerInfo] Server information. <xs:complexType name=""ServerInfo"" xmlns:xs=""http://www.w3.org/2001/XMLSchema""> <xs:sequence> <xs:element name=""ServerType"" type=""xs:string""/> <xs:element name=""ServerVersion"" type=""xs:string""/> <xs:element name=""RoutingWeb"" type=""xs:string""/> </xs:sequence> </xs:complexType>"); // Parse the GetServerInfoResult from xml to class ServerInfo serverInfoInstance = this.ParseGetServerInfoResult(serverInfo); // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R1025 Site.CaptureRequirementIfAreNotEqual( string.Empty, serverInfoInstance.ServerVersion, "MS-OFFICIALFILE", 1025, @"[In ServerInfo] ServerVersion: MUST be non-empty."); // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R1023 Site.CaptureRequirementIfAreNotEqual( string.Empty, serverInfoInstance.ServerType, "MS-OFFICIALFILE", 1023, @"[In ServerInfo] ServerType: MUST be non-empty."); // Add log information for the Requirement R1024. bool isR1024Verified = serverInfoInstance.ServerType.Length <= 256; Site.Log.Add( LogEntryKind.Debug, "For R1024 the ServerType length MUST be less than or equal to 256 characters, but actual length {0}.", serverInfoInstance.ServerType.Length); // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R1024 Site.CaptureRequirementIfIsTrue( isR1024Verified, "MS-OFFICIALFILE", 1024, @"[In ServerInfo] ServerType: MUST be less than or equal to 256 characters in length."); // Add log information for the Requirement R1026. bool isR1026Verified = serverInfoInstance.ServerVersion.Length <= 256; Site.Log.Add( LogEntryKind.Debug, "For R1024 the ServerVersion length MUST be less than or equal to 256 characters, but actual length {0}.", serverInfoInstance.ServerVersion.Length); // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R1026 Site.CaptureRequirementIfIsTrue( isR1026Verified, "MS-OFFICIALFILE", 1026, @"[In ServerInfo] ServerVersion: MUST be less than or equal to 256 characters in length."); if (serverInfoInstance.RoutingWeb != null) { bool routingWebResult; bool isR1032Verified = bool.TryParse(serverInfoInstance.RoutingWeb, out routingWebResult); Site.Log.Add( LogEntryKind.Debug, "For R1032 the RoutingWeb length MUST conform to the XML schema of the BooleanType simple type, but actual value {0}.", serverInfoInstance.RoutingWeb); // Verify MS-OFFICIALFILE requirement: MS-OFFICIALFILE_R1032 Site.CaptureRequirementIfIsTrue( isR1032Verified, "MS-OFFICIALFILE", 1032, @"[In ServerInfo] RoutingWeb: If present, it MUST conform to the XML schema of the BooleanType simple type."); } return(serverInfoInstance); }