public static MakeConnectionMessageInfo Create(XmlDictionaryReader reader) { MakeConnectionMessageInfo makeConnectionInfo = new MakeConnectionMessageInfo(); if (reader.IsStartElement(MakeConnectionConstants.MakeConnectionMessage.Name, MakeConnectionConstants.Namespace)) { reader.ReadStartElement(); reader.MoveToContent(); while (reader.IsStartElement()) { if (reader.IsStartElement(MakeConnectionConstants.MakeConnectionMessage.AddressElement, MakeConnectionConstants.Namespace)) { if (!string.IsNullOrEmpty(makeConnectionInfo.Address)) { makeConnectionInfo.MultipleAddressHeaders = true; reader.Skip(); } else { makeConnectionInfo.Address = reader.ReadElementContentAsString(); } } else if (reader.IsStartElement(MakeConnectionConstants.MakeConnectionMessage.IdentifierElement, MakeConnectionConstants.Namespace)) { if (makeConnectionInfo.Identifier != null) { makeConnectionInfo.MultipleIdentifierHeaders = true; reader.Skip(); } else { makeConnectionInfo.Identifier = reader.ReadElementContentAsUniqueId(); } } else { if (string.IsNullOrEmpty(makeConnectionInfo.UnknownSelection)) { makeConnectionInfo.UnknownSelection = reader.LocalName; } reader.Skip(); } } reader.ReadEndElement(); } return makeConnectionInfo; }
public static CloseSequenceResponseInfo Create(XmlDictionaryReader reader) { if (reader == null) { Fx.Assert("Argument reader cannot be null."); } CloseSequenceResponseInfo closeSequenceResponseInfo = new CloseSequenceResponseInfo(); XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(ReliableMessagingVersion.WSReliableMessaging11); reader.ReadStartElement(DXD.Wsrm11Dictionary.CloseSequenceResponse, wsrmNs); reader.ReadStartElement(XD.WsrmFeb2005Dictionary.Identifier, wsrmNs); closeSequenceResponseInfo.Identifier = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); return closeSequenceResponseInfo; }
public InvalidAcknowledgementFault(FaultCode code, FaultReason reason, XmlDictionaryReader detailReader, ReliableMessagingVersion reliableMessagingVersion) : base(code, "InvalidAcknowledgement", reason, true, false) { UniqueId id; bool flag; WsrmAcknowledgmentInfo.ReadAck(reliableMessagingVersion, detailReader, out id, out this.ranges, out flag); base.SequenceID = id; while (detailReader.IsStartElement()) { detailReader.Skip(); } detailReader.ReadEndElement(); }
protected override void OnReadBodyContents(XmlDictionaryReader reader) { base.OnReadBodyContents(reader); reader.ReadStartElement("ResourceCreated", "http://schemas.xmlsoap.org/ws/2004/09/transfer"); reader.Skip(); reader.ReadStartElement("ReferenceParameters", "http://www.w3.org/2005/08/addressing"); XmlUtility.DeserializeObjectReference(reader, out this._objectReference); this._instance = reader.ReadElementString("instance", "http://schemas.microsoft.com/2008/1/ActiveDirectory"); reader.ReadEndElement(); reader.ReadEndElement(); DirectoryControlSerializer.Deserialize(reader, out this._controls, false, false); reader.ReadEndElement(); }
public static XmlDictionaryReader GetReaderAtDetailContents11(string detailName, string detailNamespace, XmlDictionaryReader headerReader) { XmlDictionaryString namespaceUri = DXD.Wsrm11Dictionary.Namespace; headerReader.ReadFullStartElement(XD.WsrmFeb2005Dictionary.SequenceFault, namespaceUri); headerReader.Skip(); headerReader.ReadFullStartElement(XD.Message12Dictionary.FaultDetail, namespaceUri); if (((headerReader.NodeType == XmlNodeType.Element) && !(headerReader.NamespaceURI != detailNamespace)) && !(headerReader.LocalName != detailName)) { return headerReader; } headerReader.Close(); return null; }
public static CreateSequenceResponseInfo Create(AddressingVersion addressingVersion, ReliableMessagingVersion reliableMessagingVersion, XmlDictionaryReader reader) { CreateSequenceResponseInfo info = new CreateSequenceResponseInfo(); WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(reliableMessagingVersion); reader.ReadStartElement(dictionary.CreateSequenceResponse, namespaceUri); reader.ReadStartElement(dictionary.Identifier, namespaceUri); info.Identifier = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); if (reader.IsStartElement(dictionary.Expires, namespaceUri)) { reader.ReadElementContentAsTimeSpan(); } if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) && reader.IsStartElement(DXD.Wsrm11Dictionary.IncompleteSequenceBehavior, namespaceUri)) { string str2 = reader.ReadElementContentAsString(); if (((str2 != "DiscardEntireSequence") && (str2 != "DiscardFollowingFirstGap")) && (str2 != "NoDiscard")) { string message = System.ServiceModel.SR.GetString("CSResponseWithInvalidIncompleteSequenceBehavior"); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(message)); } } if (reader.IsStartElement(dictionary.Accept, namespaceUri)) { reader.ReadStartElement(); info.AcceptAcksTo = EndpointAddress.ReadFrom(addressingVersion, reader, dictionary.AcksTo, namespaceUri); while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); } while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); return info; }
public static CloseSequenceResponseInfo Create(XmlDictionaryReader reader) { CloseSequenceResponseInfo info = new CloseSequenceResponseInfo(); XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(ReliableMessagingVersion.WSReliableMessaging11); reader.ReadStartElement(DXD.Wsrm11Dictionary.CloseSequenceResponse, namespaceUri); reader.ReadStartElement(XD.WsrmFeb2005Dictionary.Identifier, namespaceUri); info.Identifier = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); return info; }
public virtual void ReadXml( XmlDictionaryReader reader ) { if ( reader == null ) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "reader" ); } reader.MoveToContent(); if ( reader.IsStartElement( XD.XmlSignatureDictionary.KeyInfo.Value, XD.XmlSignatureDictionary.Namespace.Value ) ) { // <KeyInfo> reader.ReadStartElement(); while ( reader.IsStartElement() ) { // <RetrievalMethod> if ( reader.IsStartElement( XmlSignatureConstants.Elements.RetrievalMethod, XD.XmlSignatureDictionary.Namespace.Value ) ) { string method = reader.GetAttribute( XD.XmlSignatureDictionary.URI.Value ); if ( !string.IsNullOrEmpty( method ) ) { _retrieval = method; } reader.Skip(); } // check if internal serializer can handle clause else if ( _keyInfoSerializer.CanReadKeyIdentifierClause( reader ) ) { _ski.Add( _keyInfoSerializer.ReadKeyIdentifierClause( reader ) ); } // trace we skipped over an element else if ( reader.IsStartElement() ) { string xml = reader.ReadOuterXml(); if ( DiagnosticUtility.ShouldTraceWarning ) { TraceUtility.TraceString( System.Diagnostics.TraceEventType.Warning, SR.GetString( SR.ID8023, reader.Name, reader.NamespaceURI, xml ) ); } } reader.MoveToContent(); } reader.MoveToContent(); reader.ReadEndElement(); } }
public override SecurityKeyIdentifierClause ReadKeyIdentifierClauseCore(XmlDictionaryReader reader) { string encryptionMethod = null; string carriedKeyName = null; SecurityKeyIdentifier encryptingKeyIdentifier = null; byte[] encryptedKey = null; reader.ReadStartElement(XD.XmlEncryptionDictionary.EncryptedKey, NamespaceUri); if (reader.IsStartElement(XD.XmlEncryptionDictionary.EncryptionMethod, NamespaceUri)) { encryptionMethod = reader.GetAttribute(XD.XmlEncryptionDictionary.AlgorithmAttribute, null); bool isEmptyElement = reader.IsEmptyElement; reader.ReadStartElement(); if (!isEmptyElement) { while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); } } if (this.securityTokenSerializer.CanReadKeyIdentifier(reader)) { encryptingKeyIdentifier = this.securityTokenSerializer.ReadKeyIdentifier(reader); } reader.ReadStartElement(XD.XmlEncryptionDictionary.CipherData, NamespaceUri); reader.ReadStartElement(XD.XmlEncryptionDictionary.CipherValue, NamespaceUri); encryptedKey = reader.ReadContentAsBase64(); reader.ReadEndElement(); reader.ReadEndElement(); if (reader.IsStartElement(XD.XmlEncryptionDictionary.CarriedKeyName, NamespaceUri)) { reader.ReadStartElement(); carriedKeyName = reader.ReadString(); reader.ReadEndElement(); } reader.ReadEndElement(); return new EncryptedKeyIdentifierClause(encryptedKey, encryptionMethod, encryptingKeyIdentifier, carriedKeyName); }
private void ReadFrom(XmlDictionaryReader reader) { try { reader.ReadFullStartElement(this.coordinationXmlDictionaryStrings.RegisterResponse, this.coordinationXmlDictionaryStrings.Namespace); this.CoordinatorProtocolService = EndpointAddress.ReadFrom(MessagingVersionHelper.AddressingVersion(this.protocolVersion), reader, this.coordinationXmlDictionaryStrings.CoordinatorProtocolService, this.coordinationXmlDictionaryStrings.Namespace); while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); } catch (XmlException exception) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidMessageException(Microsoft.Transactions.SR.GetString("InvalidMessageBody"), exception)); } }
public static WsrmAckRequestedInfo ReadHeader(ReliableMessagingVersion reliableMessagingVersion, XmlDictionaryReader reader, MessageHeaderInfo header) { WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(reliableMessagingVersion); reader.ReadStartElement(); reader.ReadStartElement(dictionary.Identifier, namespaceUri); UniqueId sequenceID = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005) && reader.IsStartElement(dictionary.MessageNumber, namespaceUri)) { reader.ReadStartElement(); WsrmUtilities.ReadSequenceNumber(reader, true); reader.ReadEndElement(); } while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); return new WsrmAckRequestedInfo(sequenceID, header); }
public virtual void ReadXml(XmlDictionaryReader reader) { if (reader == null) { throw DiagnosticUtil.ExceptionUtil.ThrowHelperArgumentNull("reader"); } reader.MoveToContent(); if (reader.IsStartElement("KeyInfo", "http://www.w3.org/2000/09/xmldsig#")) { reader.ReadStartElement(); while (reader.IsStartElement()) { if (reader.IsStartElement("RetrievalMethod", "http://www.w3.org/2000/09/xmldsig#")) { string attribute = reader.GetAttribute("URI"); if (!string.IsNullOrEmpty(attribute)) { this._retrieval = attribute; } reader.Skip(); } else if (this._keyInfoSerializer.CanReadKeyIdentifierClause(reader)) { this._ski.Add(this._keyInfoSerializer.ReadKeyIdentifierClause(reader)); } else if (reader.IsStartElement()) { string str2 = reader.ReadOuterXml(); //if (DiagnosticUtil.TraceUtil.ShouldTrace(TraceEventType.Warning)) //{ // DiagnosticUtil.TraceUtil.TraceString(TraceEventType.Warning, SR.GetString("ID8023", new object[] { reader.Name, reader.NamespaceURI, str2 }), new object[0]); //} } reader.MoveToContent(); } reader.MoveToContent(); reader.ReadEndElement(); } }
public static CloseSequenceInfo Create(XmlDictionaryReader reader) { CloseSequenceInfo info = new CloseSequenceInfo(); XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(ReliableMessagingVersion.WSReliableMessaging11); Wsrm11Dictionary dictionary = DXD.Wsrm11Dictionary; reader.ReadStartElement(dictionary.CloseSequence, namespaceUri); reader.ReadStartElement(XD.WsrmFeb2005Dictionary.Identifier, namespaceUri); info.Identifier = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); if (reader.IsStartElement(dictionary.LastMsgNumber, namespaceUri)) { reader.ReadStartElement(); info.LastMsgNumber = WsrmUtilities.ReadSequenceNumber(reader, false); reader.ReadEndElement(); } while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); return info; }
public override SecurityKeyIdentifier ReadKeyIdentifierCore( XmlDictionaryReader reader ) { reader.ReadStartElement( LocalName, NamespaceUri ); SecurityKeyIdentifier keyIdentifier = new SecurityKeyIdentifier(); while ( reader.IsStartElement() ) { SecurityKeyIdentifierClause clause = this.securityTokenSerializer.ReadKeyIdentifierClause( reader ); if ( clause == null ) { reader.Skip(); } else { keyIdentifier.Add( clause ); } } if ( keyIdentifier.Count == 0 ) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new XmlException( SR.GetString( SR.ErrorDeserializingKeyIdentifierClause ) ) ); } reader.ReadEndElement(); return keyIdentifier; }
public static TerminateSequenceInfo Create(ReliableMessagingVersion reliableMessagingVersion, XmlDictionaryReader reader) { if (reader == null) { Fx.Assert("Argument reader cannot be null."); } TerminateSequenceInfo terminateSequenceInfo = new TerminateSequenceInfo(); WsrmFeb2005Dictionary wsrmFeb2005Dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(reliableMessagingVersion); reader.ReadStartElement(wsrmFeb2005Dictionary.TerminateSequence, wsrmNs); reader.ReadStartElement(wsrmFeb2005Dictionary.Identifier, wsrmNs); terminateSequenceInfo.Identifier = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) { if (reader.IsStartElement(DXD.Wsrm11Dictionary.LastMsgNumber, wsrmNs)) { reader.ReadStartElement(); terminateSequenceInfo.LastMsgNumber = WsrmUtilities.ReadSequenceNumber(reader, false); reader.ReadEndElement(); } } while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); return terminateSequenceInfo; }
protected static void ReadFrom(XmlDictionaryReader reader, XmlDictionaryString localName, XmlDictionaryString ns) { try { if (!reader.IsStartElement(localName, ns)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidMessageException(Microsoft.Transactions.SR.GetString("InvalidMessageBody"))); } bool isEmptyElement = reader.IsEmptyElement; reader.ReadStartElement(); if (!isEmptyElement) { while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); } } catch (XmlException exception) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidMessageException(Microsoft.Transactions.SR.GetString("InvalidMessageBody"), exception)); } }
void MoveToSecurityHeader(XmlDictionaryReader reader, int headerIndex, bool captureAttributes) { MoveToHeaderBlock(reader, captureAttributes); reader.ReadStartElement(); while (true) { if (reader.NodeType != XmlNodeType.Element) { reader.MoveToContent(); } if (headerIndex == 0) { break; } reader.Skip(); headerIndex--; } }
void MoveToBody(XmlDictionaryReader reader) { if (reader.NodeType != XmlNodeType.Element) { reader.MoveToContent(); } reader.ReadStartElement(); if (reader.IsStartElement(XD.MessageDictionary.Header, this.Version.Envelope.DictionaryNamespace)) { reader.Skip(); } if (reader.NodeType != XmlNodeType.Element) { reader.MoveToContent(); } }
public static string GetSubcode(XmlDictionaryReader headerReader, ReliableMessagingVersion reliableMessagingVersion) { string subCode = null; try { WsrmFeb2005Dictionary wsrmFeb2005Dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(reliableMessagingVersion); string ns; headerReader.ReadStartElement(wsrmFeb2005Dictionary.SequenceFault, wsrmNs); headerReader.ReadStartElement(wsrmFeb2005Dictionary.FaultCode, wsrmNs); XmlUtil.ReadContentAsQName(headerReader, out subCode, out ns); if (ns != WsrmIndex.GetNamespaceString(reliableMessagingVersion)) subCode = null; headerReader.ReadEndElement(); while (headerReader.IsStartElement()) headerReader.Skip(); headerReader.ReadEndElement(); } finally { headerReader.Close(); } return subCode; }
public InvalidAcknowledgementFault(FaultCode code, FaultReason reason, XmlDictionaryReader detailReader, ReliableMessagingVersion reliableMessagingVersion) : base(code, WsrmFeb2005Strings.InvalidAcknowledgement, reason, true, false) { UniqueId sequenceId; bool final; WsrmAcknowledgmentInfo.ReadAck(reliableMessagingVersion, detailReader, out sequenceId, out this.ranges, out final); this.SequenceID = sequenceId; while (detailReader.IsStartElement()) { detailReader.Skip(); } detailReader.ReadEndElement(); }
private void ReadFrom(XmlDictionaryReader reader) { try { reader.ReadFullStartElement(this.coordinationXmlDictionaryStrings.CreateCoordinationContextResponse, this.coordinationXmlDictionaryStrings.Namespace); this.CoordinationContext = Microsoft.Transactions.Wsat.Messaging.CoordinationContext.ReadFrom(reader, this.coordinationXmlDictionaryStrings.CoordinationContext, this.coordinationXmlDictionaryStrings.Namespace, this.protocolVersion); while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); } catch (XmlException exception) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidMessageException(Microsoft.Transactions.SR.GetString("InvalidMessageBody"), exception)); } catch (InvalidCoordinationContextException exception2) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidMessageException(Microsoft.Transactions.SR.GetString("InvalidMessageBody"), exception2)); } }
static void ParseToken(XmlDictionaryReader reader, out string id, out string userName, out string password) { id = null; userName = null; password = null; reader.MoveToContent(); id = reader.GetAttribute(XD.UtilityDictionary.IdAttribute, XD.UtilityDictionary.Namespace); reader.ReadStartElement(XD.SecurityJan2004Dictionary.UserNameTokenElement, XD.SecurityJan2004Dictionary.Namespace); while (reader.IsStartElement()) { if (reader.IsStartElement(XD.SecurityJan2004Dictionary.UserNameElement, XD.SecurityJan2004Dictionary.Namespace)) { userName = reader.ReadElementString(); } else if (reader.IsStartElement(XD.SecurityJan2004Dictionary.PasswordElement, XD.SecurityJan2004Dictionary.Namespace)) { password = ParsePassword(reader); } else if (reader.IsStartElement(XD.SecurityJan2004Dictionary.NonceElement, XD.SecurityJan2004Dictionary.Namespace)) { // Nonce can be safely ignored reader.Skip(); } else if (reader.IsStartElement(XD.UtilityDictionary.CreatedElement, XD.UtilityDictionary.Namespace)) { // wsu:Created can be safely ignored reader.Skip(); } else { XmlHelper.OnUnexpectedChildNodeError(SecurityJan2004Strings.UserNameTokenElement, reader); } } reader.ReadEndElement(); if (userName == null) XmlHelper.OnRequiredElementMissing(SecurityJan2004Strings.UserNameElement, SecurityJan2004Strings.Namespace); }
public static WsrmSequencedMessageInfo ReadHeader(ReliableMessagingVersion reliableMessagingVersion, XmlDictionaryReader reader, MessageHeaderInfo header) { WsrmFeb2005Dictionary wsrmFeb2005Dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(reliableMessagingVersion); reader.ReadStartElement(); reader.ReadStartElement(wsrmFeb2005Dictionary.Identifier, wsrmNs); UniqueId sequenceID = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); reader.ReadStartElement(wsrmFeb2005Dictionary.MessageNumber, wsrmNs); Int64 sequenceNumber = WsrmUtilities.ReadSequenceNumber(reader); reader.ReadEndElement(); bool lastMessage = false; if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005) { if (reader.IsStartElement(wsrmFeb2005Dictionary.LastMessage, wsrmNs)) { WsrmUtilities.ReadEmptyElement(reader); lastMessage = true; } } while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); return new WsrmSequencedMessageInfo(sequenceID, sequenceNumber, lastMessage, header); }
public override void ReadExtensions( XmlDictionaryReader reader ) { reader.MoveToContent(); if ( reader.IsStartElement( XmlEncryptionConstants.Elements.ReferenceList, XmlEncryptionConstants.Namespace ) ) { reader.ReadStartElement(); // could have data or key references. these are the only two possible elements sec 3.6 xml enc. // 3.6 The ReferenceList Element specifies there is a choice. Once one is chosen, it is fixed. if ( reader.IsStartElement( XmlEncryptionConstants.Elements.DataReference, XmlEncryptionConstants.Namespace ) ) { while ( reader.IsStartElement() ) { if ( reader.IsStartElement( XmlEncryptionConstants.Elements.DataReference, XmlEncryptionConstants.Namespace ) ) { string dataRef = reader.GetAttribute( XmlEncryptionConstants.Attributes.Uri ); if ( !string.IsNullOrEmpty( dataRef ) ) { _dataReferences.Add( dataRef ); } reader.Skip(); } else if ( reader.IsStartElement( XmlEncryptionConstants.Elements.KeyReference, XmlEncryptionConstants.Namespace ) ) { throw DiagnosticUtility.ThrowHelperXml( reader, SR.GetString( SR.ID4189 ) ); } else { string xml = reader.ReadOuterXml(); if ( DiagnosticUtility.ShouldTraceWarning ) { TraceUtility.TraceString( System.Diagnostics.TraceEventType.Warning, SR.GetString( SR.ID8024, reader.Name, reader.NamespaceURI, xml ) ); } } } } else if ( reader.IsStartElement( XmlEncryptionConstants.Elements.KeyReference, XmlEncryptionConstants.Namespace ) ) { while ( reader.IsStartElement() ) { if ( reader.IsStartElement( XmlEncryptionConstants.Elements.KeyReference, XmlEncryptionConstants.Namespace ) ) { string keyRef = reader.GetAttribute( XmlEncryptionConstants.Attributes.Uri ); if ( !string.IsNullOrEmpty( keyRef ) ) { _keyReferences.Add( keyRef ); } reader.Skip(); } else if ( reader.IsStartElement( XmlEncryptionConstants.Elements.DataReference, XmlEncryptionConstants.Namespace ) ) { throw DiagnosticUtility.ThrowHelperXml( reader, SR.GetString( SR.ID4190 ) ); } else { string xml = reader.ReadOuterXml(); if ( DiagnosticUtility.ShouldTraceWarning ) { TraceUtility.TraceString( System.Diagnostics.TraceEventType.Warning, SR.GetString( SR.ID8024, reader.Name, reader.NamespaceURI, xml ) ); } } } } else { // there must be at least one reference. throw DiagnosticUtility.ThrowHelperXml( reader, SR.GetString( SR.ID4191 ) ); } reader.MoveToContent(); if ( reader.IsStartElement( XmlEncryptionConstants.Elements.CarriedKeyName, XmlEncryptionConstants.Namespace ) ) { reader.ReadStartElement(); _carriedName = reader.ReadString(); reader.ReadEndElement(); } // </ReferenceList> reader.ReadEndElement(); } }
public static CreateSequenceResponseInfo Create(AddressingVersion addressingVersion, ReliableMessagingVersion reliableMessagingVersion, XmlDictionaryReader reader) { if (reader == null) { Fx.Assert("Argument reader cannot be null."); } CreateSequenceResponseInfo createSequenceResponse = new CreateSequenceResponseInfo(); WsrmFeb2005Dictionary wsrmFeb2005Dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(reliableMessagingVersion); reader.ReadStartElement(wsrmFeb2005Dictionary.CreateSequenceResponse, wsrmNs); reader.ReadStartElement(wsrmFeb2005Dictionary.Identifier, wsrmNs); createSequenceResponse.Identifier = reader.ReadContentAsUniqueId(); reader.ReadEndElement(); if (reader.IsStartElement(wsrmFeb2005Dictionary.Expires, wsrmNs)) { reader.ReadElementContentAsTimeSpan(); } if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) { if (reader.IsStartElement(DXD.Wsrm11Dictionary.IncompleteSequenceBehavior, wsrmNs)) { string incompleteSequenceBehavior = reader.ReadElementContentAsString(); if ((incompleteSequenceBehavior != Wsrm11Strings.DiscardEntireSequence) && (incompleteSequenceBehavior != Wsrm11Strings.DiscardFollowingFirstGap) && (incompleteSequenceBehavior != Wsrm11Strings.NoDiscard)) { string reason = SR.GetString(SR.CSResponseWithInvalidIncompleteSequenceBehavior); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(reason)); } // Otherwise ignore the value. } } if (reader.IsStartElement(wsrmFeb2005Dictionary.Accept, wsrmNs)) { reader.ReadStartElement(); createSequenceResponse.AcceptAcksTo = EndpointAddress.ReadFrom(addressingVersion, reader, wsrmFeb2005Dictionary.AcksTo, wsrmNs); while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); } while (reader.IsStartElement()) { reader.Skip(); } reader.ReadEndElement(); return createSequenceResponse; }
static PollingDuplexSession ReadHeaderValue(XmlDictionaryReader reader) { string str = null; string str2 = null; if (reader.IsStartElement("Duplex", "http://schemas.microsoft.com/2008/04/netduplex")) { reader.ReadStartElement(); reader.MoveToContent(); while (reader.IsStartElement()) { if (reader.IsStartElement("SessionId", "http://schemas.microsoft.com/2008/04/netduplex")) { if (!string.IsNullOrEmpty(str2)) { throw new InvalidOperationException("Multiple sessionId elements in a duplex header."); } str2 = reader.ReadElementContentAsString(); if (string.IsNullOrEmpty(str2)) { throw new InvalidOperationException("Invalid sessionId element content in a duplex header."); } } else { if (reader.IsStartElement("Address", "http://schemas.microsoft.com/2008/04/netduplex")) { if (!string.IsNullOrEmpty(str)) { throw new InvalidOperationException("Multiple address elements in a duplex header."); } str = reader.ReadElementContentAsString(); if (string.IsNullOrEmpty(str)) { throw new InvalidOperationException("Invalid address element in a duplex header."); } continue; } if (reader.IsStartElement("CloseSession", "http://schemas.microsoft.com/2008/04/netduplex")) { reader.Skip(); continue; } reader.Skip(); } } reader.ReadEndElement(); } if (str == null) { throw new InvalidOperationException("Missing address in a duplex header."); } if (str2 == null) { throw new InvalidOperationException("Missing sessionId in a duplex header."); } return new PollingDuplexSession(str, str2); }
private object DeserializeParameter(XmlDictionaryReader reader, PartInfo part) { if (reader.AttributeCount > 0 && reader.MoveToAttribute(_xsiNilLocalName.Value, _xsiNilNamespace.Value) && reader.ReadContentAsBoolean()) { reader.Skip(); return null; } return part.ReadValue(reader); }
public static WsrmAcknowledgmentInfo ReadHeader(ReliableMessagingVersion reliableMessagingVersion, XmlDictionaryReader reader, MessageHeaderInfo header) { WsrmFeb2005Dictionary wsrmFeb2005Dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(reliableMessagingVersion); UniqueId sequenceID; SequenceRangeCollection rangeCollection; bool final; ReadAck(reliableMessagingVersion, reader, out sequenceID, out rangeCollection, out final); int bufferRemaining = -1; // Parse the extensibility section. while (reader.IsStartElement()) { if (reader.IsStartElement(wsrmFeb2005Dictionary.BufferRemaining, XD.WsrmFeb2005Dictionary.NETNamespace)) { if (bufferRemaining != -1) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException( SR.GetString(SR.UnexpectedXmlChildNode, reader.Name, reader.NodeType, MessageStrings.Body))); } reader.ReadStartElement(); bufferRemaining = reader.ReadContentAsInt(); reader.ReadEndElement(); if (bufferRemaining < 0) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException( SR.GetString(SR.InvalidBufferRemaining, bufferRemaining))); } // Found BufferRemaining, continue parsing. continue; } if (reader.IsStartElement(wsrmFeb2005Dictionary.AcknowledgementRange, wsrmNs)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException( SR.GetString(SR.UnexpectedXmlChildNode, reader.Name, reader.NodeType, MessageStrings.Body))); } else if (reader.IsStartElement(wsrmFeb2005Dictionary.Nack, wsrmNs)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException( SR.GetString(SR.UnexpectedXmlChildNode, reader.Name, reader.NodeType, MessageStrings.Body))); } else if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) { Wsrm11Dictionary wsrm11Dictionary = DXD.Wsrm11Dictionary; if (reader.IsStartElement(wsrm11Dictionary.None, wsrmNs) || reader.IsStartElement(wsrm11Dictionary.Final, wsrmNs)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException( SR.GetString(SR.UnexpectedXmlChildNode, reader.Name, reader.NodeType, wsrmFeb2005Dictionary.SequenceAcknowledgement))); } } // Advance the reader in all cases. reader.Skip(); } reader.ReadEndElement(); return new WsrmAcknowledgmentInfo(sequenceID, rangeCollection, final, bufferRemaining, header); }
private static JsonPrimitive ReadPrimitive(string type, XmlDictionaryReader jsonReader) { JsonValue result = null; switch (type) { case NullAttributeValue: jsonReader.Skip(); result = null; break; case BooleanAttributeValue: result = jsonReader.ReadElementContentAsBoolean(); break; case StringAttributeValue: result = jsonReader.ReadElementContentAsString(); break; case NumberAttributeValue: string temp = jsonReader.ReadElementContentAsString(); result = ConvertStringToJsonNumber(temp); break; } SkipWhitespace(jsonReader); return (JsonPrimitive)result; }
public override SecurityKeyIdentifierClause ReadClause( XmlDictionaryReader reader, byte[] derivationNonce, int derivationLength, string tokenType ) { System.Xml.UniqueId uri = XmlHelper.GetAttributeAsUniqueId( reader, XD.SecurityJan2004Dictionary.URI, null ); System.Xml.UniqueId generation = ReadGeneration( reader ); if ( reader.IsEmptyElement ) { reader.Read(); } else { reader.ReadStartElement(); while ( reader.IsStartElement() ) { reader.Skip(); } reader.ReadEndElement(); } return new SecurityContextKeyIdentifierClause( uri, generation, derivationNonce, derivationLength ); }