public override void WriteStartElement(string prefix, string localName, string ns) { base.WriteStartElement(prefix, localName, ns); if (localName == "Envelope" && state == XmlWriteState.None) { state = XmlWriteState.EvelopeWritten; if (state == XmlWriteState.EvelopeWritten) { //WriteAttributeString("xmlns", "ps", null, @"http://schemas.microsoft.com/Passport/SoapServices/PPCRL"); //WriteAttributeString("xmlns", "psf", null, @"http://schemas.microsoft.com/Passport/SoapServices/SOAPFault"); WriteAttributeString("xmlns", "wsse", null, @"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"); WriteAttributeString("xmlns", "wssc", null, @"http://schemas.xmlsoap.org/ws/2005/02/sc"); WriteAttributeString("xmlns", "wsu", null, @"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"); WriteAttributeString("xmlns", "wst", null, @"http://schemas.xmlsoap.org/ws/2005/02/trust"); WriteAttributeString("xmlns", "wsp", null, @"http://schemas.xmlsoap.org/ws/2004/09/policy"); WriteAttributeString("xmlns", "wsa", null, @"http://www.w3.org/2005/08/addressing"); WriteAttributeString("xmlns", "saml", null, @"urn:oasis:names:tc:SAML:1.0:assertion"); state = XmlWriteState.SpecialNSWritten; } } if (localName == "Assertion" && state == XmlWriteState.SpecialNSWritten) { WriteAttributeString("xmlns", "saml", null, @"urn:oasis:names:tc:SAML:1.0:assertion"); } if (localName == "Body" && state != XmlWriteState.BeginWriteBody) { state = XmlWriteState.BeginWriteBody; } }