private void WriteHeader(XmlDictionaryWriter writer) { var nonce = new byte[64]; RandomNumberGenerator.Create().GetBytes(nonce); string created = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.mszzzz"); writer.WriteStartElement("wsse", "UsernameToken", null); writer.WriteAttributeString("wsu:Id", "UsernameToken-1"); writer.WriteStartElement("wsse", "Username", null); writer.WriteString(SystemUser); writer.WriteEndElement();//End Username writer.WriteStartElement("wsse", "Password", null); writer.WriteAttributeString("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"); writer.WriteString(ComputePasswordDigest(SystemPassword, nonce, created)); writer.WriteEndElement();//End Password writer.WriteStartElement("wsse", "Nonce", null); writer.WriteAttributeString("EncodingType", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"); writer.WriteBase64(nonce, 0, nonce.Length); writer.WriteEndElement();//End Nonce writer.WriteStartElement("wsu", "Created", null); writer.WriteString(created); writer.WriteEndElement();//End Created writer.WriteEndElement();//End UsernameToken writer.Flush(); }
internal static void WriteAckRanges(XmlDictionaryWriter writer, ReliableMessagingVersion reliableMessagingVersion, UniqueId sequenceId, SequenceRangeCollection ranges) { WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(reliableMessagingVersion); writer.WriteStartElement(dictionary.Identifier, namespaceUri); writer.WriteValue(sequenceId); writer.WriteEndElement(); if (ranges.Count == 0) { if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005) { ranges = ranges.MergeWith((long) 0L); } else if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) { writer.WriteStartElement(DXD.Wsrm11Dictionary.None, namespaceUri); writer.WriteEndElement(); } } for (int i = 0; i < ranges.Count; i++) { writer.WriteStartElement(dictionary.AcknowledgementRange, namespaceUri); writer.WriteStartAttribute(dictionary.Lower, null); SequenceRange range = ranges[i]; writer.WriteValue(range.Lower); writer.WriteEndAttribute(); writer.WriteStartAttribute(dictionary.Upper, null); SequenceRange range2 = ranges[i]; writer.WriteValue(range2.Upper); writer.WriteEndAttribute(); writer.WriteEndElement(); } }
public void WriteJson(XmlDictionaryWriter writer) { writer.WriteStartElement(MetadataStrings.TypeString); writer.WriteAttributeString("type", "string"); writer.WriteString(String.Format("{0}{1}{2}", this.TypeName, MetadataStrings.NamespaceMarker, this.TypeNamespace)); writer.WriteEndElement(); writer.WriteStartElement(MetadataStrings.KeyString); writer.WriteAttributeString("type", "array"); foreach (string keyitem in this.Key) { writer.WriteStartElement("item"); writer.WriteAttributeString("type", "string"); writer.WriteValue(keyitem); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteStartElement(MetadataStrings.FieldsString); writer.WriteAttributeString("type", "object"); foreach (TypePropertyMetadata field in this.Properties) { field.WriteJson(writer); } writer.WriteEndElement(); this.WriteValidationRulesMetadata(writer); }
protected override void OnWriteBodyContents(XmlDictionaryWriter writer) { WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(this.reliableMessagingVersion); writer.WriteStartElement(dictionary.CreateSequenceResponse, namespaceUri); writer.WriteStartElement(dictionary.Identifier, namespaceUri); writer.WriteValue(this.identifier); writer.WriteEndElement(); if (this.expires.HasValue) { writer.WriteStartElement(dictionary.Expires, namespaceUri); writer.WriteValue(this.expires.Value); writer.WriteEndElement(); } if (this.reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) { Wsrm11Dictionary dictionary2 = DXD.Wsrm11Dictionary; writer.WriteStartElement(dictionary2.IncompleteSequenceBehavior, namespaceUri); writer.WriteValue(this.ordered ? dictionary2.DiscardFollowingFirstGap : dictionary2.NoDiscard); writer.WriteEndElement(); } if (this.acceptAcksTo != null) { writer.WriteStartElement(dictionary.Accept, namespaceUri); this.acceptAcksTo.WriteTo(this.addressingVersion, writer, dictionary.AcksTo, namespaceUri); writer.WriteEndElement(); } writer.WriteEndElement(); }
protected override void OnWriteAddressHeaderContents (XmlDictionaryWriter writer) { writer.WriteStartElement(XD.DotNetAtomicTransactionExternalDictionary.LocalTransactionId, XD.DotNetAtomicTransactionExternalDictionary.Namespace); writer.WriteValue(this.transactionId); writer.WriteEndElement(); if (this.contextId != null) { writer.WriteStartElement(XD.DotNetAtomicTransactionExternalDictionary.ContextId, XD.DotNetAtomicTransactionExternalDictionary.Namespace); writer.WriteValue(this.contextId); writer.WriteEndElement(); } if (this.tokenId != null) { writer.WriteStartElement(XD.DotNetAtomicTransactionExternalDictionary.TokenId, XD.DotNetAtomicTransactionExternalDictionary.Namespace); writer.WriteValue(this.tokenId); writer.WriteEndElement(); } }
protected override void OnWriteBodyContents(XmlDictionaryWriter writer) { XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(ReliableMessagingVersion.WSReliableMessaging11); writer.WriteStartElement(DXD.Wsrm11Dictionary.CloseSequenceResponse, namespaceUri); writer.WriteStartElement(XD.WsrmFeb2005Dictionary.Identifier, namespaceUri); writer.WriteValue(this.identifier); writer.WriteEndElement(); writer.WriteEndElement(); }
protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion) { writer.WriteStartElement("ID"); //writer.WriteString("{id}"); writer.WriteString("1408"); writer.WriteEndElement(); writer.WriteStartElement("MDP"); //writer.WriteString("{mdp}"); writer.WriteString("fophjkl32"); writer.WriteEndElement(); }
protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion) { if (this.address != null) { writer.WriteStartElement("netdx", "Address", "http://schemas.microsoft.com/2008/04/netduplex"); writer.WriteString(this.address); writer.WriteEndElement(); } writer.WriteStartElement("netdx", "SessionId", "http://schemas.microsoft.com/2008/04/netduplex"); writer.WriteString(this.sessionId); writer.WriteEndElement(); }
private void WriteHeader(XmlDictionaryWriter writer) { writer.WriteStartElement("wsse", "UsernameToken", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); writer.WriteXmlnsAttribute("wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"); writer.WriteStartElement("wsse", "Username", null); writer.WriteString(SystemUser); writer.WriteEndElement();//End Username writer.WriteStartElement("wsse", "Password", null); writer.WriteAttributeString("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"); writer.WriteString(SystemPassword); writer.WriteEndElement();//End Password writer.WriteEndElement();//End UsernameToken writer.Flush(); }
internal override void WriteContentsTo(XmlDictionaryWriter writer) { if (writer == null) throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writer"); writer.WriteStartElement(XD.XmlSignatureDictionary.Prefix.Value, XD.XmlSignatureDictionary.KeyInfo, XD.XmlSignatureDictionary.Namespace); writer.WriteStartElement(XD.XmlSignatureDictionary.Prefix.Value, XD.XmlSignatureDictionary.RsaKeyValue, XD.XmlSignatureDictionary.Namespace); RSA rsa = (RSA)this.IdentityClaim.Resource; RSAParameters parameters = rsa.ExportParameters(false); writer.WriteElementString(XD.XmlSignatureDictionary.Prefix.Value, XD.XmlSignatureDictionary.Modulus, XD.XmlSignatureDictionary.Namespace, Convert.ToBase64String(parameters.Modulus)); writer.WriteElementString(XD.XmlSignatureDictionary.Prefix.Value, XD.XmlSignatureDictionary.Exponent, XD.XmlSignatureDictionary.Namespace, Convert.ToBase64String(parameters.Exponent)); writer.WriteEndElement(); writer.WriteEndElement(); }
internal override void WriteContentsTo(XmlDictionaryWriter writer) { if (writer == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("writer"); } writer.WriteStartElement(XD.XmlSignatureDictionary.Prefix.Value, XD.XmlSignatureDictionary.KeyInfo, XD.XmlSignatureDictionary.Namespace); writer.WriteStartElement(XD.XmlSignatureDictionary.Prefix.Value, XD.XmlSignatureDictionary.X509Data, XD.XmlSignatureDictionary.Namespace); for (int i = 0; i < this.certificateCollection.Count; i++) { writer.WriteElementString(XD.XmlSignatureDictionary.X509Certificate, XD.XmlSignatureDictionary.Namespace, Convert.ToBase64String(this.certificateCollection[i].RawData)); } writer.WriteEndElement(); writer.WriteEndElement(); }
public override void WriteObject(XmlDictionaryWriter writer, object graph) { var data = EncodeObject(graph); writer.WriteStartElement("Data"); writer.WriteBase64(data, 0, data.Length); writer.WriteEndElement(); }
public void WriteTo(XmlDictionaryWriter writer) { writer.WriteStartElement(this.coordinationStrings.Prefix, this.coordinationXmlDictionaryStrings.Register, this.coordinationXmlDictionaryStrings.Namespace); XmlDictionaryString str = WSAtomicTransactionStrings.ProtocolToWellKnownName(this.Protocol, this.protocolVersion); writer.WriteStartElement(this.coordinationXmlDictionaryStrings.Protocol, this.coordinationXmlDictionaryStrings.Namespace); writer.WriteString(str); writer.WriteEndElement(); this.ParticipantProtocolService.WriteTo(MessagingVersionHelper.AddressingVersion(this.protocolVersion), writer, this.coordinationXmlDictionaryStrings.ParticipantProtocolService, this.coordinationXmlDictionaryStrings.Namespace); if (this.Loopback != Guid.Empty) { writer.WriteStartElement("mstx", XD.DotNetAtomicTransactionExternalDictionary.Loopback, XD.DotNetAtomicTransactionExternalDictionary.Namespace); writer.WriteValue(this.Loopback); writer.WriteEndElement(); } writer.WriteEndElement(); }
public override void WriteEndObject(XmlDictionaryWriter writer) { if (!skipName) { writer.WriteEndElement(); } }
protected override void OnWriteBodyContents(XmlDictionaryWriter writer) { writer.WriteStartElement("Renew", "http://schemas.xmlsoap.org/ws/2004/09/enumeration"); XmlUtility.SerializeEnumerationContext(writer, this._enumerationContext); XmlUtility.SerializeExpires(writer, this._expirationDateTime, this._expirationTimeSpan); writer.WriteEndElement(); }
protected override void OnWriteBodyContents(XmlDictionaryWriter writer) { WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(this.reliableMessagingVersion); writer.WriteStartElement(dictionary.TerminateSequence, namespaceUri); writer.WriteStartElement(dictionary.Identifier, namespaceUri); writer.WriteValue(this.identifier); writer.WriteEndElement(); if ((this.reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) && (this.lastMsgNumber > 0L)) { writer.WriteStartElement(DXD.Wsrm11Dictionary.LastMsgNumber, namespaceUri); writer.WriteValue(this.lastMsgNumber); writer.WriteEndElement(); } writer.WriteEndElement(); }
/// <summary>Called when the message body is written to an XML file.</summary> /// <param name="writer"> /// An <see cref="XmlDictionaryWriter"/> that is used to write this /// message body to an XML file. /// </param> protected override void OnWriteBodyContents(XmlDictionaryWriter writer) { WebUtil.CheckArgumentNull(writer, "writer"); try { writer.WriteStartElement(XmlConstants.WcfBinaryElementName); using (XmlWriterStream stream = new XmlWriterStream(writer)) { this.writerAction(stream); } writer.WriteEndElement(); } finally { if (this.service != null) { HttpContextServiceHost host = this.service.OperationContext.RequestMessage.HttpContextServiceHost; this.service.DisposeDataSource(); if (host != null) { if (host.ErrorFound) { var ctx = System.ServiceModel.OperationContext.Current; if (ctx != null) { ctx.Channel.Abort(); } } } } } }
protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion) { WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString dictionaryNamespace = this.DictionaryNamespace; writer.WriteStartElement(dictionary.Identifier, dictionaryNamespace); writer.WriteValue(this.sequenceID); writer.WriteEndElement(); writer.WriteStartElement(dictionary.MessageNumber, dictionaryNamespace); writer.WriteValue(this.sequenceNumber); writer.WriteEndElement(); if ((base.ReliableMessagingVersion == ReliableMessagingVersion.WSReliableMessagingFebruary2005) && this.lastMessage) { writer.WriteStartElement(dictionary.LastMessage, dictionaryNamespace); writer.WriteEndElement(); } }
protected override void OnWriteBodyContents(XmlDictionaryWriter writer) { WebUtil.CheckArgumentNull<XmlDictionaryWriter>(writer, "writer"); try { writer.WriteStartElement("Binary"); using (XmlWriterStream stream = new XmlWriterStream(writer)) { this.writerAction(stream); } writer.WriteEndElement(); } finally { if (this.service != null) { this.service.DisposeDataSource(); HttpContextServiceHost httpContextServiceHost = this.service.OperationContext.Host.HttpContextServiceHost; if ((httpContextServiceHost != null) && httpContextServiceHost.ErrorFound) { OperationContext current = OperationContext.Current; if (current != null) { current.Channel.Abort(); } } } } }
void WriteChunkCallback(XmlDictionaryWriter writer, object state) { ChunkState chunkState = (ChunkState)state; writer.WriteStartElement(ChunkingUtils.ChunkElement, ChunkingUtils.ChunkNs); writer.WriteBase64(chunkState.Buffer, 0, chunkState.Count); writer.WriteEndElement(); }
protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion) { WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString dictionaryNamespace = this.DictionaryNamespace; writer.WriteStartElement(dictionary.Identifier, dictionaryNamespace); writer.WriteValue(this.sequenceID); writer.WriteEndElement(); }
/// <summary> /// Writes the given content to output writer. /// </summary> /// <param name="writer">Output writer instance.</param> protected override void OnWriteBodyContents(XmlDictionaryWriter writer) { var buffer = this.contentEncoding.GetBytes(this.content); writer.WriteStartElement("Binary"); writer.WriteBase64(buffer, 0, buffer.Length); writer.WriteEndElement(); }
protected override void OnWriteBodyContents(XmlDictionaryWriter writer) { writer.WriteStartElement("html"); writer.WriteStartElement("head"); writer.WriteElementString("title", "Request Failed"); writer.WriteRaw(@"<style>BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px; } #content { margin-left: 30px; font-size: .70em; padding-bottom: 2em; } A:link { color: #336699; font-weight: bold; text-decoration: underline; } A:visited { color: #6699cc; font-weight: bold; text-decoration: underline; } A:active { color: #336699; font-weight: bold; text-decoration: underline; } h1 { background-color: #003366; border-bottom: #336699 6px solid; color: #ffffff; font-family: Tahoma; font-size: 26px; font-weight: normal;margin: 0em 0em 10px -20px; padding-bottom: 8px; padding-left: 30px;padding-top: 16px;} pre { font-size:small; background-color: #e5e5cc; padding: 5px; font-family: Courier New; margin-top: 0px; border: 1px #f0f0e0 solid; white-space: pre-wrap; white-space: -pre-wrap; word-wrap: break-word; } table { border-collapse: collapse; border-spacing: 0px; font-family: Verdana; font-size: 1em;} table th { border-right: 2px white solid; border-bottom: 2px white solid; font-weight: bold; background-color: #cecf9c;} table td { border-right: 2px white solid; border-bottom: 2px white solid; background-color: #e5e5cc;}</style>"); writer.WriteEndElement(); //head writer.WriteStartElement("body"); writer.WriteRaw("<div id='content'>"); writer.WriteElementString("h1", "Request Failed"); writer.WriteElementString("h3", Message); writer.WriteRaw("</div>"); writer.WriteEndElement(); //body writer.WriteEndElement(); //html }
/// <summary> /// Ends an object in the output /// </summary> public override void WriteEndObject(System.Xml.XmlDictionaryWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } writer.WriteEndElement(); }
protected override void OnWriteHeaderContents(XmlDictionaryWriter writer, MessageVersion messageVersion) { WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary; XmlDictionaryString dictionaryNamespace = this.DictionaryNamespace; WriteAckRanges(writer, base.ReliableMessagingVersion, this.sequenceID, this.ranges); if ((base.ReliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) && this.final) { writer.WriteStartElement(DXD.Wsrm11Dictionary.Final, dictionaryNamespace); writer.WriteEndElement(); } if (this.bufferRemaining != -1) { writer.WriteStartElement("netrm", dictionary.BufferRemaining, XD.WsrmFeb2005Dictionary.NETNamespace); writer.WriteValue(this.bufferRemaining); writer.WriteEndElement(); } }
protected override void OnWriteFilterElementContents(XmlDictionaryWriter writer) { writer.WriteStartElement("LdapQuery", "http://schemas.microsoft.com/2008/1/ActiveDirectory/Dialect/LdapQuery"); writer.WriteElementString("Filter", "http://schemas.microsoft.com/2008/1/ActiveDirectory/Dialect/LdapQuery", this.Filter); writer.WriteElementString("BaseObject", "http://schemas.microsoft.com/2008/1/ActiveDirectory/Dialect/LdapQuery", this.SearchBase); writer.WriteElementString("Scope", "http://schemas.microsoft.com/2008/1/ActiveDirectory/Dialect/LdapQuery", this.SearchScope); writer.WriteEndElement(); }
public void WriteTo(XmlDictionaryWriter writer, DictionaryManager dictionaryManager) { writer.WriteStartElement(this.prefix, dictionaryManager.XmlSignatureDictionary.Transforms, dictionaryManager.XmlSignatureDictionary.Namespace); for (int i = 0; i < this.TransformCount; i++) { this[i].WriteTo(writer, dictionaryManager); } writer.WriteEndElement(); }
protected override void OnWriteDetail(XmlDictionaryWriter writer, EnvelopeVersion version) { if (version == EnvelopeVersion.Soap12) { this.OnWriteStartDetail(writer, version); this.OnWriteDetailContents(writer); writer.WriteEndElement(); } }
protected override void OnWriteDetailContents(XmlDictionaryWriter writer) { WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary; ReliableMessagingVersion reliableMessagingVersion = base.GetReliableMessagingVersion(); XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(reliableMessagingVersion); writer.WriteStartElement(dictionary.SequenceAcknowledgement, namespaceUri); WsrmAcknowledgmentHeader.WriteAckRanges(writer, reliableMessagingVersion, base.SequenceID, this.ranges); writer.WriteEndElement(); }
protected override void OnWriteBodyContents(XmlDictionaryWriter writer) { writer.WriteStartElement("Binary"); XmlWriterStream stream = new XmlWriterStream(writer); this.writer(stream); stream.Close(); writer.WriteEndElement(); }
protected override void OnWriteBodyContents(XmlDictionaryWriter writer) { XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(ReliableMessagingVersion.WSReliableMessaging11); Wsrm11Dictionary wsrm11Dictionary = DXD.Wsrm11Dictionary; writer.WriteStartElement(wsrm11Dictionary.CloseSequence, wsrmNs); writer.WriteStartElement(XD.WsrmFeb2005Dictionary.Identifier, wsrmNs); writer.WriteValue(this.identifier); writer.WriteEndElement(); if (this.lastMsgNumber > 0) { writer.WriteStartElement(wsrm11Dictionary.LastMsgNumber, wsrmNs); writer.WriteValue(this.lastMsgNumber); writer.WriteEndElement(); } writer.WriteEndElement(); }
protected override void OnWriteBodyContents(System.Xml.XmlDictionaryWriter xmlWriter) { /* What the message should look like... * * <SaveGigRequest xmlns="http://www.thatindigogirl.com/samples/2006/06"> * <Item xmlns:b="http://schemas.thatindigogirl.com/samples/2006/06" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> * <b:Id>xs:int</b:Id> * <b:Title>xs:string</b:Title> * <b:Description>xs:string</b:Description> * <b:DateStart>xs:dateTime</b:DateStart> * <b:DateEnd>xs:dateTime</b:DateEnd> * <b:Url>xs:string</b:Url> * </Item> * </SaveGigRequest> */ xmlWriter.WriteStartElement("SaveGigRequest", ns); xmlWriter.WriteStartElement("Item", ns); LinkItemHelper.WriteLinkItem(this.m_linkItem, xmlWriter); xmlWriter.WriteEndElement(); //Item xmlWriter.WriteEndElement(); //GetGigResponse }
protected override void OnWriteBodyContents(System.Xml.XmlDictionaryWriter writer) { // TODO: RawMessageEncoder.StreamElementName should be public. writer.WriteStartElement("Binary"); // the expected Raw encoder "<Binary>" virtual xml tag if (bodyAsString != null) { byte[] buf = Encoding.UTF8.GetBytes(bodyAsString); writer.WriteBase64(buf, 0, buf.Length); } else { writer.WriteBase64(this.bodyAsBytes, this.offset, this.count); } writer.WriteEndElement(); }
public override void WriteEndElement() { writer.WriteEndElement(); }
/// <summary> /// Ends an object in the output /// </summary> public override void WriteEndObject(System.Xml.XmlDictionaryWriter writer) { writer.WriteEndElement(); }