internal BodyWriter OnCreateBufferedCopy(int maxBufferSize, XmlDictionaryReaderQuotas quotas) { XmlBuffer buffer = new XmlBuffer(maxBufferSize); using (XmlDictionaryWriter writer = buffer.OpenSection(quotas)) { writer.WriteStartElement("a"); this.OnWriteBodyContents(writer); writer.WriteEndElement(); } buffer.CloseSection(); buffer.Close(); return new BufferedBodyWriter(buffer); }
public void SetMetadataReader(XmlDictionaryReader reader) { _hasMetadata = true; _metadataBuffer = null; if (reader != null) { _metadataBuffer = new XmlBuffer(short.MaxValue); XmlDictionaryWriter writer = _metadataBuffer.OpenSection(reader.Quotas); writer.WriteStartElement(EndpointAddress.DummyName, EndpointAddress.DummyNamespace); EndpointAddress.Copy(writer, reader); _metadataBuffer.CloseSection(); _metadataBuffer.Close(); } }
public void SetExtensionReader(XmlDictionaryReader reader) { _hasExtension = true; EndpointIdentity identity; int tmp; _extensionBuffer = EndpointAddress.ReadExtensions(reader, null, null, out identity, out tmp); if (_extensionBuffer != null) { _extensionBuffer.Close(); } if (identity != null) { _identity = identity; } }
private static XmlBuffer CreateXmlBuffer(XmlDictionaryReader unparsedExtensionsReader, int maxExtensionSize) { XmlBuffer buffer = new XmlBuffer(maxExtensionSize); using (XmlDictionaryWriter writer = buffer.OpenSection(unparsedExtensionsReader.Quotas)) { writer.WriteStartElement("extensionWrapper"); while (unparsedExtensionsReader.IsStartElement()) { writer.WriteNode(unparsedExtensionsReader, false); } writer.WriteEndElement(); } buffer.CloseSection(); buffer.Close(); return buffer; }
internal EndpointAddress(System.Uri uri, EndpointIdentity identity, AddressHeaderCollection headers, XmlDictionaryReader metadataReader, XmlDictionaryReader extensionReader, XmlDictionaryReader pspReader) { EndpointIdentity identity2; int num; if (uri == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("uri"); } XmlBuffer buffer = null; this.PossiblyPopulateBuffer(metadataReader, ref buffer, out this.metadataSection); buffer = ReadExtensions(extensionReader, null, buffer, out identity2, out num); if ((identity != null) && (identity2 != null)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("MultipleIdentities"), "extensionReader")); } this.PossiblyPopulateBuffer(pspReader, ref buffer, out this.pspSection); if (buffer != null) { buffer.Close(); } this.Init(uri, identity ?? identity2, headers, buffer, this.metadataSection, num, this.pspSection); }
internal EndpointAddress(System.Uri uri, EndpointIdentity identity, AddressHeaderCollection headers, XmlDictionaryReader metadataReader, XmlDictionaryReader extensionReader, XmlDictionaryReader pspReader) { EndpointIdentity identity2; int num; if (uri == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("uri"); } XmlBuffer buffer = null; this.PossiblyPopulateBuffer(metadataReader, ref buffer, out this.metadataSection); buffer = ReadExtensions(extensionReader, null, buffer, out identity2, out num); if ((identity != null) && (identity2 != null)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("MultipleIdentities"), "extensionReader")); } this.PossiblyPopulateBuffer(pspReader, ref buffer, out this.pspSection); if (buffer != null) { buffer.Close(); } this.Init(uri, identity ?? identity2, headers, buffer, this.metadataSection, num, this.pspSection); }
private static bool ReadContentsFrom200408(XmlDictionaryReader reader, out System.Uri uri, out AddressHeaderCollection headers, out EndpointIdentity identity, out XmlBuffer buffer, out int metadataSection, out int extensionSection, out int pspSection) { buffer = null; headers = null; extensionSection = -1; metadataSection = -1; pspSection = -1; reader.MoveToContent(); if (!reader.IsStartElement(XD.AddressingDictionary.Address, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateXmlException(reader, System.ServiceModel.SR.GetString("UnexpectedElementExpectingElement", new object[] { reader.LocalName, reader.NamespaceURI, XD.AddressingDictionary.Address.Value, XD.Addressing200408Dictionary.Namespace.Value }))); } string uriString = reader.ReadElementContentAsString(); reader.MoveToContent(); if (reader.IsStartElement(XD.AddressingDictionary.ReferenceProperties, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace)) { headers = AddressHeaderCollection.ReadServiceParameters(reader, true); } reader.MoveToContent(); if (reader.IsStartElement(XD.AddressingDictionary.ReferenceParameters, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace)) { if (headers != null) { List<AddressHeader> addressHeaders = new List<AddressHeader>(); foreach (AddressHeader header in headers) { addressHeaders.Add(header); } foreach (AddressHeader header2 in AddressHeaderCollection.ReadServiceParameters(reader)) { addressHeaders.Add(header2); } headers = new AddressHeaderCollection(addressHeaders); } else { headers = AddressHeaderCollection.ReadServiceParameters(reader); } } XmlDictionaryWriter writer = null; reader.MoveToContent(); if (reader.IsStartElement(XD.AddressingDictionary.PortType, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace)) { if (writer == null) { if (buffer == null) { buffer = new XmlBuffer(0x7fff); } writer = buffer.OpenSection(reader.Quotas); writer.WriteStartElement("Dummy", "http://Dummy"); } writer.WriteNode(reader, true); } reader.MoveToContent(); if (reader.IsStartElement(XD.AddressingDictionary.ServiceName, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace)) { if (writer == null) { if (buffer == null) { buffer = new XmlBuffer(0x7fff); } writer = buffer.OpenSection(reader.Quotas); writer.WriteStartElement("Dummy", "http://Dummy"); } writer.WriteNode(reader, true); } reader.MoveToContent(); while (reader.IsNamespaceUri(XD.PolicyDictionary.Namespace)) { if (writer == null) { if (buffer == null) { buffer = new XmlBuffer(0x7fff); } writer = buffer.OpenSection(reader.Quotas); writer.WriteStartElement("Dummy", "http://Dummy"); } writer.WriteNode(reader, true); reader.MoveToContent(); } if (writer != null) { writer.WriteEndElement(); buffer.CloseSection(); pspSection = buffer.SectionCount - 1; writer = null; } else { pspSection = -1; } if (reader.IsStartElement("Metadata", "http://schemas.xmlsoap.org/ws/2004/09/mex")) { if (writer == null) { if (buffer == null) { buffer = new XmlBuffer(0x7fff); } writer = buffer.OpenSection(reader.Quotas); writer.WriteStartElement("Dummy", "http://Dummy"); } writer.WriteNode(reader, true); } if (writer != null) { writer.WriteEndElement(); buffer.CloseSection(); metadataSection = buffer.SectionCount - 1; writer = null; } else { metadataSection = -1; } reader.MoveToContent(); buffer = ReadExtensions(reader, AddressingVersion.WSAddressingAugust2004, buffer, out identity, out extensionSection); if (buffer != null) { buffer.Close(); } if (uriString == "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous") { uri = AddressingVersion.WSAddressingAugust2004.AnonymousUri; if ((headers == null) && (identity == null)) { return true; } } else if (!System.Uri.TryCreate(uriString, UriKind.Absolute, out uri)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(System.ServiceModel.SR.GetString("InvalidUriValue", new object[] { uriString, XD.AddressingDictionary.Address.Value, AddressingVersion.WSAddressingAugust2004.Namespace }))); } return false; }
private static bool ReadContentsFrom10(XmlDictionaryReader reader, out System.Uri uri, out AddressHeaderCollection headers, out EndpointIdentity identity, out XmlBuffer buffer, out int metadataSection, out int extensionSection) { buffer = null; extensionSection = -1; metadataSection = -1; if (!reader.IsStartElement(XD.AddressingDictionary.Address, XD.Addressing10Dictionary.Namespace)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateXmlException(reader, System.ServiceModel.SR.GetString("UnexpectedElementExpectingElement", new object[] { reader.LocalName, reader.NamespaceURI, XD.AddressingDictionary.Address.Value, XD.Addressing10Dictionary.Namespace.Value }))); } string uriString = reader.ReadElementContentAsString(); if (reader.IsStartElement(XD.AddressingDictionary.ReferenceParameters, XD.Addressing10Dictionary.Namespace)) { headers = AddressHeaderCollection.ReadServiceParameters(reader); } else { headers = null; } if (reader.IsStartElement(XD.Addressing10Dictionary.Metadata, XD.Addressing10Dictionary.Namespace)) { reader.ReadFullStartElement(); buffer = new XmlBuffer(0x7fff); metadataSection = 0; XmlDictionaryWriter writer = buffer.OpenSection(reader.Quotas); writer.WriteStartElement("Dummy", "http://Dummy"); while ((reader.NodeType != XmlNodeType.EndElement) && !reader.EOF) { writer.WriteNode(reader, true); } writer.Flush(); buffer.CloseSection(); reader.ReadEndElement(); } buffer = ReadExtensions(reader, AddressingVersion.WSAddressing10, buffer, out identity, out extensionSection); if (buffer != null) { buffer.Close(); } if (uriString == "http://www.w3.org/2005/08/addressing/anonymous") { uri = AddressingVersion.WSAddressing10.AnonymousUri; if ((headers == null) && (identity == null)) { return true; } } else { if (uriString == "http://www.w3.org/2005/08/addressing/none") { uri = AddressingVersion.WSAddressing10.NoneUri; return false; } if (!System.Uri.TryCreate(uriString, UriKind.Absolute, out uri)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(System.ServiceModel.SR.GetString("InvalidUriValue", new object[] { uriString, XD.AddressingDictionary.Address.Value, XD.Addressing10Dictionary.Namespace.Value }))); } } return false; }
static bool ReadContentsFrom10(XmlDictionaryReader reader, out Uri uri, out AddressHeaderCollection headers, out EndpointIdentity identity, out XmlBuffer buffer, out int metadataSection, out int extensionSection) { buffer = null; extensionSection = -1; metadataSection = -1; // Cache address string if (!reader.IsStartElement(XD.AddressingDictionary.Address, XD.Addressing10Dictionary.Namespace)) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateXmlException(reader, SR.GetString(SR.UnexpectedElementExpectingElement, reader.LocalName, reader.NamespaceURI, XD.AddressingDictionary.Address.Value, XD.Addressing10Dictionary.Namespace.Value))); string address = reader.ReadElementContentAsString(); // Headers if (reader.IsStartElement(XD.AddressingDictionary.ReferenceParameters, XD.Addressing10Dictionary.Namespace)) { headers = AddressHeaderCollection.ReadServiceParameters(reader); } else { headers = null; } // Metadata if (reader.IsStartElement(XD.Addressing10Dictionary.Metadata, XD.Addressing10Dictionary.Namespace)) { reader.ReadFullStartElement(); // the wsa10:Metadata element is never stored in the buffer buffer = new XmlBuffer(short.MaxValue); metadataSection = 0; XmlDictionaryWriter writer = buffer.OpenSection(reader.Quotas); writer.WriteStartElement(DummyName, DummyNamespace); while (reader.NodeType != XmlNodeType.EndElement && !reader.EOF) { writer.WriteNode(reader, true); } writer.Flush(); buffer.CloseSection(); reader.ReadEndElement(); } // Extensions buffer = ReadExtensions(reader, AddressingVersion.WSAddressing10, buffer, out identity, out extensionSection); if (buffer != null) { buffer.Close(); } // Process Address if (address == Addressing10Strings.Anonymous) { uri = AddressingVersion.WSAddressing10.AnonymousUri; if (headers == null && identity == null) { return true; } } else if (address == Addressing10Strings.NoneAddress) { uri = AddressingVersion.WSAddressing10.NoneUri; return false; } else { if (!Uri.TryCreate(address, UriKind.Absolute, out uri)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.GetString(SR.InvalidUriValue, address, XD.AddressingDictionary.Address.Value, XD.Addressing10Dictionary.Namespace.Value))); } } return false; }
static bool ReadContentsFrom200408(XmlDictionaryReader reader, out Uri uri, out AddressHeaderCollection headers, out EndpointIdentity identity, out XmlBuffer buffer, out int metadataSection, out int extensionSection, out int pspSection) { buffer = null; headers = null; extensionSection = -1; metadataSection = -1; pspSection = -1; // Cache address string reader.MoveToContent(); if (!reader.IsStartElement(XD.AddressingDictionary.Address, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateXmlException(reader, SR.GetString(SR.UnexpectedElementExpectingElement, reader.LocalName, reader.NamespaceURI, XD.AddressingDictionary.Address.Value, XD.Addressing200408Dictionary.Namespace.Value))); } string address = reader.ReadElementContentAsString(); // ReferenceProperites reader.MoveToContent(); if (reader.IsStartElement(XD.AddressingDictionary.ReferenceProperties, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace)) { headers = AddressHeaderCollection.ReadServiceParameters(reader, true); } // ReferenceParameters reader.MoveToContent(); if (reader.IsStartElement(XD.AddressingDictionary.ReferenceParameters, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace)) { if (headers != null) { List<AddressHeader> headerList = new List<AddressHeader>(); foreach (AddressHeader ah in headers) { headerList.Add(ah); } AddressHeaderCollection tmp = AddressHeaderCollection.ReadServiceParameters(reader); foreach (AddressHeader ah in tmp) { headerList.Add(ah); } headers = new AddressHeaderCollection(headerList); } else { headers = AddressHeaderCollection.ReadServiceParameters(reader); } } XmlDictionaryWriter bufferWriter = null; // PortType reader.MoveToContent(); if (reader.IsStartElement(XD.AddressingDictionary.PortType, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace)) { if (bufferWriter == null) { if (buffer == null) buffer = new XmlBuffer(short.MaxValue); bufferWriter = buffer.OpenSection(reader.Quotas); bufferWriter.WriteStartElement(DummyName, DummyNamespace); } bufferWriter.WriteNode(reader, true); } // ServiceName reader.MoveToContent(); if (reader.IsStartElement(XD.AddressingDictionary.ServiceName, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace)) { if (bufferWriter == null) { if (buffer == null) buffer = new XmlBuffer(short.MaxValue); bufferWriter = buffer.OpenSection(reader.Quotas); bufferWriter.WriteStartElement(DummyName, DummyNamespace); } bufferWriter.WriteNode(reader, true); } // Policy reader.MoveToContent(); while (reader.IsNamespaceUri(XD.PolicyDictionary.Namespace)) { if (bufferWriter == null) { if (buffer == null) buffer = new XmlBuffer(short.MaxValue); bufferWriter = buffer.OpenSection(reader.Quotas); bufferWriter.WriteStartElement(DummyName, DummyNamespace); } bufferWriter.WriteNode(reader, true); reader.MoveToContent(); } // Finish PSP if (bufferWriter != null) { bufferWriter.WriteEndElement(); buffer.CloseSection(); pspSection = buffer.SectionCount - 1; bufferWriter = null; } else { pspSection = -1; } // Metadata if (reader.IsStartElement(System.ServiceModel.Description.MetadataStrings.MetadataExchangeStrings.Metadata, System.ServiceModel.Description.MetadataStrings.MetadataExchangeStrings.Namespace)) { if (bufferWriter == null) { if (buffer == null) buffer = new XmlBuffer(short.MaxValue); bufferWriter = buffer.OpenSection(reader.Quotas); bufferWriter.WriteStartElement(DummyName, DummyNamespace); } bufferWriter.WriteNode(reader, true); } // Finish metadata if (bufferWriter != null) { bufferWriter.WriteEndElement(); buffer.CloseSection(); metadataSection = buffer.SectionCount - 1; bufferWriter = null; } else { metadataSection = -1; } // Extensions reader.MoveToContent(); buffer = ReadExtensions(reader, AddressingVersion.WSAddressingAugust2004, buffer, out identity, out extensionSection); // Finished reading if (buffer != null) buffer.Close(); // Process Address if (address == Addressing200408Strings.Anonymous) { uri = AddressingVersion.WSAddressingAugust2004.AnonymousUri; if (headers == null && identity == null) return true; } else { if (!Uri.TryCreate(address, UriKind.Absolute, out uri)) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(SR.GetString(SR.InvalidUriValue, address, XD.AddressingDictionary.Address.Value, AddressingVersion.WSAddressingAugust2004.Namespace))); } return false; }
public void SetMetadataReader(XmlDictionaryReader reader) { hasMetadata = true; metadataBuffer = null; if (reader != null) { metadataBuffer = new XmlBuffer(short.MaxValue); XmlDictionaryWriter writer = metadataBuffer.OpenSection(reader.Quotas); writer.WriteStartElement(EndpointAddress.DummyName, EndpointAddress.DummyNamespace); EndpointAddress.Copy(writer, reader); metadataBuffer.CloseSection(); metadataBuffer.Close(); } }
internal EndpointAddress(Uri uri, EndpointIdentity identity, AddressHeaderCollection headers, XmlDictionaryReader metadataReader, XmlDictionaryReader extensionReader, XmlDictionaryReader pspReader) { if (uri == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("uri"); } XmlBuffer buffer = null; PossiblyPopulateBuffer(metadataReader, ref buffer, out metadataSection); EndpointIdentity ident2; int extSection; buffer = ReadExtensions(extensionReader, null, buffer, out ident2, out extSection); if (identity != null && ident2 != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.MultipleIdentities), "extensionReader")); } PossiblyPopulateBuffer(pspReader, ref buffer, out pspSection); if (buffer != null) { buffer.Close(); } Init(uri, identity ?? ident2, headers, buffer, metadataSection, extSection, pspSection); }
private static bool ReadContentsFrom200408(XmlDictionaryReader reader, out System.Uri uri, out AddressHeaderCollection headers, out EndpointIdentity identity, out XmlBuffer buffer, out int metadataSection, out int extensionSection, out int pspSection) { buffer = null; headers = null; extensionSection = -1; metadataSection = -1; pspSection = -1; reader.MoveToContent(); if (!reader.IsStartElement(XD.AddressingDictionary.Address, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateXmlException(reader, System.ServiceModel.SR.GetString("UnexpectedElementExpectingElement", new object[] { reader.LocalName, reader.NamespaceURI, XD.AddressingDictionary.Address.Value, XD.Addressing200408Dictionary.Namespace.Value }))); } string uriString = reader.ReadElementContentAsString(); reader.MoveToContent(); if (reader.IsStartElement(XD.AddressingDictionary.ReferenceProperties, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace)) { headers = AddressHeaderCollection.ReadServiceParameters(reader, true); } reader.MoveToContent(); if (reader.IsStartElement(XD.AddressingDictionary.ReferenceParameters, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace)) { if (headers != null) { List <AddressHeader> addressHeaders = new List <AddressHeader>(); foreach (AddressHeader header in headers) { addressHeaders.Add(header); } foreach (AddressHeader header2 in AddressHeaderCollection.ReadServiceParameters(reader)) { addressHeaders.Add(header2); } headers = new AddressHeaderCollection(addressHeaders); } else { headers = AddressHeaderCollection.ReadServiceParameters(reader); } } XmlDictionaryWriter writer = null; reader.MoveToContent(); if (reader.IsStartElement(XD.AddressingDictionary.PortType, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace)) { if (writer == null) { if (buffer == null) { buffer = new XmlBuffer(0x7fff); } writer = buffer.OpenSection(reader.Quotas); writer.WriteStartElement("Dummy", "http://Dummy"); } writer.WriteNode(reader, true); } reader.MoveToContent(); if (reader.IsStartElement(XD.AddressingDictionary.ServiceName, AddressingVersion.WSAddressingAugust2004.DictionaryNamespace)) { if (writer == null) { if (buffer == null) { buffer = new XmlBuffer(0x7fff); } writer = buffer.OpenSection(reader.Quotas); writer.WriteStartElement("Dummy", "http://Dummy"); } writer.WriteNode(reader, true); } reader.MoveToContent(); while (reader.IsNamespaceUri(XD.PolicyDictionary.Namespace)) { if (writer == null) { if (buffer == null) { buffer = new XmlBuffer(0x7fff); } writer = buffer.OpenSection(reader.Quotas); writer.WriteStartElement("Dummy", "http://Dummy"); } writer.WriteNode(reader, true); reader.MoveToContent(); } if (writer != null) { writer.WriteEndElement(); buffer.CloseSection(); pspSection = buffer.SectionCount - 1; writer = null; } else { pspSection = -1; } if (reader.IsStartElement("Metadata", "http://schemas.xmlsoap.org/ws/2004/09/mex")) { if (writer == null) { if (buffer == null) { buffer = new XmlBuffer(0x7fff); } writer = buffer.OpenSection(reader.Quotas); writer.WriteStartElement("Dummy", "http://Dummy"); } writer.WriteNode(reader, true); } if (writer != null) { writer.WriteEndElement(); buffer.CloseSection(); metadataSection = buffer.SectionCount - 1; writer = null; } else { metadataSection = -1; } reader.MoveToContent(); buffer = ReadExtensions(reader, AddressingVersion.WSAddressingAugust2004, buffer, out identity, out extensionSection); if (buffer != null) { buffer.Close(); } if (uriString == "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous") { uri = AddressingVersion.WSAddressingAugust2004.AnonymousUri; if ((headers == null) && (identity == null)) { return(true); } } else if (!System.Uri.TryCreate(uriString, UriKind.Absolute, out uri)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(System.ServiceModel.SR.GetString("InvalidUriValue", new object[] { uriString, XD.AddressingDictionary.Address.Value, AddressingVersion.WSAddressingAugust2004.Namespace }))); } return(false); }
private static bool ReadContentsFrom10(XmlDictionaryReader reader, out System.Uri uri, out AddressHeaderCollection headers, out EndpointIdentity identity, out XmlBuffer buffer, out int metadataSection, out int extensionSection) { buffer = null; extensionSection = -1; metadataSection = -1; if (!reader.IsStartElement(XD.AddressingDictionary.Address, XD.Addressing10Dictionary.Namespace)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(CreateXmlException(reader, System.ServiceModel.SR.GetString("UnexpectedElementExpectingElement", new object[] { reader.LocalName, reader.NamespaceURI, XD.AddressingDictionary.Address.Value, XD.Addressing10Dictionary.Namespace.Value }))); } string uriString = reader.ReadElementContentAsString(); if (reader.IsStartElement(XD.AddressingDictionary.ReferenceParameters, XD.Addressing10Dictionary.Namespace)) { headers = AddressHeaderCollection.ReadServiceParameters(reader); } else { headers = null; } if (reader.IsStartElement(XD.Addressing10Dictionary.Metadata, XD.Addressing10Dictionary.Namespace)) { reader.ReadFullStartElement(); buffer = new XmlBuffer(0x7fff); metadataSection = 0; XmlDictionaryWriter writer = buffer.OpenSection(reader.Quotas); writer.WriteStartElement("Dummy", "http://Dummy"); while ((reader.NodeType != XmlNodeType.EndElement) && !reader.EOF) { writer.WriteNode(reader, true); } writer.Flush(); buffer.CloseSection(); reader.ReadEndElement(); } buffer = ReadExtensions(reader, AddressingVersion.WSAddressing10, buffer, out identity, out extensionSection); if (buffer != null) { buffer.Close(); } if (uriString == "http://www.w3.org/2005/08/addressing/anonymous") { uri = AddressingVersion.WSAddressing10.AnonymousUri; if ((headers == null) && (identity == null)) { return(true); } } else { if (uriString == "http://www.w3.org/2005/08/addressing/none") { uri = AddressingVersion.WSAddressing10.NoneUri; return(false); } if (!System.Uri.TryCreate(uriString, UriKind.Absolute, out uri)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(System.ServiceModel.SR.GetString("InvalidUriValue", new object[] { uriString, XD.AddressingDictionary.Address.Value, XD.Addressing10Dictionary.Namespace.Value }))); } } return(false); }
public void SetExtensionReader(XmlDictionaryReader reader) { _hasExtension = true; EndpointIdentity identity; int tmp; _extensionBuffer = EndpointAddress.ReadExtensions(reader, null, null, out identity, out tmp); if (_extensionBuffer != null) { _extensionBuffer.Close(); } if (identity != null) { _identity = identity; } }