@@ -28,7 +28,7 @@ protected override Saml2SoapEnvelope BindInternal(Saml2Request saml2Request, str
2828
2929            BindInternal ( saml2Request ) ; 
3030
31-             SoapResponseXml  =  ToSoapXml ( ) . OuterXml ; 
31+             SoapResponseXml  =  ToSoapXml ( ) ; 
3232            return  this ; 
3333        } 
3434
@@ -44,7 +44,7 @@ protected override Saml2Request Read(HttpRequest request, Saml2Request saml2Requ
4444            if  ( ! ( saml2Request  is  Saml2ArtifactResolve  saml2ArtifactResolve ) ) 
4545                throw  new  ArgumentException ( "Only Saml2ArtifactResolve is supported" ) ; 
4646
47-             saml2ArtifactResolve . Read ( FromSoapXml ( request . Body ) . OuterXml ,  validate ,  detectReplayedTokens ) ; 
47+             saml2ArtifactResolve . Read ( FromSoapXml ( request . Body ) ,  validate ,  detectReplayedTokens ) ; 
4848            XmlDocument  =  saml2ArtifactResolve . XmlDocument ; 
4949            return  saml2ArtifactResolve ; 
5050        } 
@@ -77,7 +77,7 @@ public virtual async Task ResolveAsync(
7777            saml2ArtifactResolve . Destination  =  artifactDestination ; 
7878            XmlDocument  =  saml2ArtifactResolve . ToXml ( ) ; 
7979
80-             var  content  =  new  StringContent ( ToSoapXml ( ) . OuterXml ,  Encoding . UTF8 ,  "text/xml" ) ; 
80+             var  content  =  new  StringContent ( ToSoapXml ( ) ,  Encoding . UTF8 ,  "text/xml" ) ; 
8181            content . Headers . Add ( "SOAPAction" ,  "\" http://www.oasis-open.org/committees/security\" " ) ; 
8282
8383            using  ( var  response  =  cancellationToken . HasValue  ?  await  httpClient . PostAsync ( artifactDestination ,  content ,  cancellationToken . Value )  :  await  httpClient . PostAsync ( artifactDestination ,  content ) ) 
@@ -93,7 +93,7 @@ public virtual async Task ResolveAsync(
9393
9494                        var  ares  =  new  Saml2ArtifactResponse ( saml2ArtifactResolve . Config ,  saml2Request ) ; 
9595                        SetSignatureValidationCertificates ( ares ) ;                         
96-                         ares . Read ( FromSoapXml ( result ) . OuterXml ,  ares . SignatureValidationCertificates ? . Count ( )  >  0 ,  true ) ; 
96+                         ares . Read ( FromSoapXml ( result ) ,  ares . SignatureValidationCertificates ? . Count ( )  >  0 ,  true ) ; 
9797                        ares . Status  =  Saml2StatusCodes . Success ; 
9898                        break ; 
9999
@@ -103,13 +103,13 @@ public virtual async Task ResolveAsync(
103103            } 
104104        } 
105105
106-         protected  virtual  XmlDocument  ToSoapXml ( ) 
106+         protected  virtual  string  ToSoapXml ( ) 
107107        { 
108108            var  envelope  =  new  XElement ( Saml2Constants . SoapEnvironmentNamespaceX  +  Saml2Constants . Message . Envelope ) ; 
109109
110110            envelope . Add ( GetXContent ( ) ) ; 
111111
112-             return  envelope . ToXmlDocument ( ) ; 
112+             return  envelope . ToString ( SaveOptions . DisableFormatting ) ; 
113113        } 
114114
115115        protected  IEnumerable < XObject >  GetXContent ( ) 
@@ -118,7 +118,7 @@ protected IEnumerable<XObject> GetXContent()
118118            yield  return  new  XElement ( Saml2Constants . SoapEnvironmentNamespaceX  +  Saml2Constants . Message . Body ,  XmlDocument . ToXDocument ( ) . Root ) ; 
119119        } 
120120
121-         protected  virtual  XmlDocument  FromSoapXml ( string  xml ) 
121+         protected  virtual  string  FromSoapXml ( string  xml ) 
122122        { 
123123            var  xmlDoc  =  xml . ToXmlDocument ( ) ; 
124124
@@ -136,7 +136,7 @@ protected virtual XmlDocument FromSoapXml(string xml)
136136                throw  new  Saml2RequestException ( "SAML 2.0 Artifact SOAP error: "  +  faultcode  +  "\n "  +  faultstring ) ; 
137137            } 
138138
139-             return  bodyList [ 0 ] . InnerXml . ToXmlDocument ( ) ; 
139+             return  bodyList [ 0 ] . InnerXml ; 
140140        } 
141141
142142        private  XmlNodeList  GetNodesByLocalname ( XmlNode  xe ,  string  localName ) 
0 commit comments