Produced by Araxis Merge on 2/1/2017 2:56:46 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | C:\Araxis_Merge_Comprasion\Pub_un\BTSSS_CIF_122016.zip\BTSSS_CIF_12_20_16\clean\CRM\trunk\SDK\SampleCode\CS\HelperCode | WsdlTokenManager.cs | Tue Dec 20 19:51:44 2016 UTC |
| 2 | Wed Feb 1 19:56:46 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 348 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | // ======= ========== ========== ========== ========== ========== ========== == | |||||
| 2 | // | |||||
| 3 | // This f ile is par t of the M icrosoft D ynamics CR M SDK code samples. | |||||
| 4 | // | |||||
| 5 | // Copyri ght (C) Mi crosoft Co rporation. All righ ts reserve d. | |||||
| 6 | // | |||||
| 7 | // This s ource code is intend ed only as a supplem ent to Mic rosoft | |||||
| 8 | // Develo pment Tool s and/or o n-line doc umentation . See the se other | |||||
| 9 | // materi als for de tailed inf ormation r egarding M icrosoft c ode sample s. | |||||
| 10 | // | |||||
| 11 | // THIS C ODE AND IN FORMATION ARE PROVID ED "AS IS" WITHOUT W ARRANTY OF ANY | |||||
| 12 | // KIND, EITHER EXP RESSED OR IMPLIED, I NCLUDING B UT NOT LIM ITED TO TH E | |||||
| 13 | // IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND/OR F ITNESS FOR A | |||||
| 14 | // PARTIC ULAR PURPO SE. | |||||
| 15 | // | |||||
| 16 | // ======= ========== ========== ========== ========== ========== ========== == | |||||
| 17 | using Syst em; | |||||
| 18 | using Syst em.Globali zation; | |||||
| 19 | using Syst em.Identit yModel.Tok ens; | |||||
| 20 | using Syst em.IO; | |||||
| 21 | using Syst em.Net; | |||||
| 22 | using Syst em.Service Model; | |||||
| 23 | using Syst em.Service Model.Desc ription; | |||||
| 24 | using Syst em.Service Model.Secu rity; | |||||
| 25 | using Syst em.Text; | |||||
| 26 | using Syst em.Xml; | |||||
| 27 | ||||||
| 28 | using Micr osoft.Iden tityModel. Protocols. WSTrust; | |||||
| 29 | ||||||
| 30 | using Micr osoft.Crm. Services.U tility; | |||||
| 31 | ||||||
| 32 | namespace Microsoft. Crm.Sdk.Sa mples | |||||
| 33 | { | |||||
| 34 | /// <s ummary> | |||||
| 35 | /// Ut ility to a uthenticat e Microsof t account and Micros oft Office 365 (i.e. OSDP / Or gId) users | |||||
| 36 | /// wi thout usin g the clas ses expose d in Micro soft.Xrm.S dk.dll | |||||
| 37 | /// </ summary> | |||||
| 38 | public static cl ass WsdlTo kenManager | |||||
| 39 | { | |||||
| 40 | pr ivate stat ic string Federation MetadataUr lFormat = "https://n exus.passp ort{0}.com /federatio nmetadata/ 2007-06/Fe derationMe taData.xml "; | |||||
| 41 | ||||||
| 42 | pr ivate cons t string D eviceToken ResponseXP ath = | |||||
| 43 | @"S:Enve lope/S:Bod y/wst:Requ estSecurit yTokenResp onse/wst:R equestedSe curityToke n"; | |||||
| 44 | pr ivate cons t string U serTokenRe sponseXPat h = | |||||
| 45 | @"S:Enve lope/S:Bod y/wst:Requ estSecurit yTokenResp onse/wst:R equestedSe curityToke n"; | |||||
| 46 | ||||||
| 47 | #r egion Temp lates | |||||
| 48 | pr ivate cons t string D eviceToken Template = @"<?xml v ersion=""1 .0"" encod ing=""UTF- 8""?> | |||||
| 49 | <s :Envelope | |||||
| 50 | xmlns:s="" http://www .w3.org/20 03/05/soap -envelope" " | |||||
| 51 | xmlns:wsse =""http:// docs.oasis -open.org/ wss/2004/0 1/oasis-20 0401-wss-w ssecurity- secext-1.0 .xsd"" | |||||
| 52 | xmlns:wsp= ""http://s chemas.xml soap.org/w s/2004/09/ policy"" | |||||
| 53 | xmlns:wsu= ""http://d ocs.oasis- open.org/w ss/2004/01 /oasis-200 401-wss-ws security-u tility-1.0 .xsd"" | |||||
| 54 | xmlns:wsa= ""http://w ww.w3.org/ 2005/08/ad dressing"" | |||||
| 55 | xmlns:wst= ""http://s chemas.xml soap.org/w s/2005/02/ trust""> | |||||
| 56 | <s:Header > | |||||
| 57 | <wsa:Act ion s:must Understand =""1"">htt p://schema s.xmlsoap. org/ws/200 5/02/trust /RST/Issue </wsa:Acti on> | |||||
| 58 | <wsa:To s:mustUnde rstand=""1 "">http:// Passport.N ET/tb</wsa :To> | |||||
| 59 | <wsse:Se curity> | |||||
| 60 | <wsse: UsernameTo ken wsu:Id =""devices oftware""> | |||||
| 61 | <wss e:Username >{0:device Name}</wss e:Username > | |||||
| 62 | <wss e:Password >{1:passwo rd}</wsse: Password> | |||||
| 63 | </wsse :UsernameT oken> | |||||
| 64 | </wsse:S ecurity> | |||||
| 65 | </s:Header > | |||||
| 66 | <s:Body> | |||||
| 67 | <wst:Req uestSecuri tyToken Id =""RST0""> | |||||
| 68 | <ws t:RequestT ype>http:/ /schemas.x mlsoap.org /ws/2005/0 2/trust/Is sue</wst:R equestType > | |||||
| 69 | <ws p:AppliesT o> | |||||
| 70 | <wsa:Endpo intReferen ce> | |||||
| 71 | <wsa:Ad dress>http ://Passpor t.NET/tb</ wsa:Addres s> | |||||
| 72 | </wsa:Endp ointRefere nce> | |||||
| 73 | </w sp:Applies To> | |||||
| 74 | </wst: RequestSec urityToken > | |||||
| 75 | </s:Body> | |||||
| 76 | </ s:Envelope > | |||||
| 77 | "; | |||||
| 78 | ||||||
| 79 | pr ivate cons t string U serTokenTe mplate = @ "<?xml ver sion=""1.0 "" encodin g=""UTF-8" "?> | |||||
| 80 | <s :Envelope | |||||
| 81 | xmlns:s="" http://www .w3.org/20 03/05/soap -envelope" " | |||||
| 82 | xmlns:wsse =""http:// docs.oasis -open.org/ wss/2004/0 1/oasis-20 0401-wss-w ssecurity- secext-1.0 .xsd"" | |||||
| 83 | xmlns:wsp= ""http://s chemas.xml soap.org/w s/2004/09/ policy"" | |||||
| 84 | xmlns:wsu= ""http://d ocs.oasis- open.org/w ss/2004/01 /oasis-200 401-wss-ws security-u tility-1.0 .xsd"" | |||||
| 85 | xmlns:wsa= ""http://w ww.w3.org/ 2005/08/ad dressing"" | |||||
| 86 | xmlns:wst= ""http://s chemas.xml soap.org/w s/2005/02/ trust""> | |||||
| 87 | <s:Header > | |||||
| 88 | <wsa:Act ion s:must Understand =""1"">htt p://schema s.xmlsoap. org/ws/200 5/02/trust /RST/Issue </wsa:Acti on> | |||||
| 89 | <wsa:To s:mustUnde rstand=""1 "">http:// Passport.N ET/tb</wsa :To> | |||||
| 90 | <ps:AuthI nfo Id=""P PAuthInfo" " xmlns:ps =""http:// schemas.mi crosoft.co m/LiveID/S oapService s/v1""> | |||||
| 91 | <ps :HostingAp p>{0:clien tId}</ps:H ostingApp> | |||||
| 92 | </ps:A uthInfo> | |||||
| 93 | <wsse: Security> | |||||
| 94 | <ws se:Usernam eToken wsu :Id=""user ""> | |||||
| 95 | <wsse:User name>{1:us erName}</w sse:Userna me> | |||||
| 96 | <wsse:Pass word>{2:pa ssword}</w sse:Passwo rd> | |||||
| 97 | </w sse:Userna meToken> | |||||
| 98 | {3: binarySecu rityToken} | |||||
| 99 | </wsse :Security> | |||||
| 100 | </s:Header > | |||||
| 101 | <s:Body> | |||||
| 102 | <wst:Req uestSecuri tyToken Id =""RST0""> | |||||
| 103 | <ws t:RequestT ype>http:/ /schemas.x mlsoap.org /ws/2005/0 2/trust/Is sue</wst:R equestType > | |||||
| 104 | <ws p:AppliesT o> | |||||
| 105 | <wsa:Endpo intReferen ce> | |||||
| 106 | <wsa:Ad dress>{4:p artnerUrl} </wsa:Addr ess> | |||||
| 107 | </wsa:Endp ointRefere nce> | |||||
| 108 | </w sp:Applies To> | |||||
| 109 | <ws p:PolicyRe ference UR I=""{5:pol icy}""/> | |||||
| 110 | </wst: RequestSec urityToken > | |||||
| 111 | </s:Body> | |||||
| 112 | </ s:Envelope >"; | |||||
| 113 | ||||||
| 114 | pr ivate cons t string B inarySecur ityToken = @"<wsse:B inarySecur ityToken V alueType=" "urn:livei d:device"" > | |||||
| 115 | { 0:deviceTo kenValue} | |||||
| 116 | </w sse:Binary SecurityTo ken>"; | |||||
| 117 | #e ndregion | |||||
| 118 | ||||||
| 119 | // / <summary > | |||||
| 120 | // / This sho ws the met hod to ret rieve the security t icket for the Micros oft accoun t user or OrgId user | |||||
| 121 | // / without using any certificat e for auth entication . | |||||
| 122 | // / </summar y> | |||||
| 123 | // / <param n ame="crede ntials">Us er credent ials that should be used to co nnect to t he server< /param> | |||||
| 124 | // / <param n ame="appli esTo">Indi cates the AppliesTo that is re quired for the token </param> | |||||
| 125 | // / <param n ame="polic y">Policy that shoul d be used when commu nicating w ith the se rver</para m> | |||||
| 126 | pu blic stati c Security Token Auth enticate(C lientCrede ntials cre dentials, string app liesTo, st ring polic y) | |||||
| 127 | { | |||||
| 128 | return A uthenticat e(credenti als, appli esTo, poli cy, null); | |||||
| 129 | } | |||||
| 130 | ||||||
| 131 | // / <summary > | |||||
| 132 | // / This sho ws the met hod to ret rieve the security t icket for the Micros oft accoun t user or OrgId user | |||||
| 133 | // / without using any certificat e for auth entication . | |||||
| 134 | // / </summar y> | |||||
| 135 | // / <param n ame="crede ntials">Us er credent ials that should be used to co nnect to t he server< /param> | |||||
| 136 | // / <param n ame="appli esTo">Indi cates the AppliesTo that is re quired for the token </param> | |||||
| 137 | // / <param n ame="polic y">Policy that shoul d be used when commu nicating w ith the se rver</para m> | |||||
| 138 | // / <param n ame="issue rUri">URL for the cu rrent toke n issuer</ param> | |||||
| 139 | pu blic stati c Security Token Auth enticate(C lientCrede ntials cre dentials, string app liesTo, st ring polic y, Uri iss uerUri) | |||||
| 140 | { | |||||
| 141 | string s erviceUrl = issuerUr i.ToString (); | |||||
| 142 | // if se rviceUrl s tarts with "https:// login.live .com", it means Micr osoft acco unt authen tication i s needed o therwise O SDP authen tication. | |||||
| 143 | if (!Str ing.IsNull OrEmpty(se rviceUrl) && service Url.Starts With("http s://login. live.com") ) | |||||
| 144 | { | |||||
| 145 | serv iceUrl = G etServiceE ndpoint(is suerUri); | |||||
| 146 | ||||||
| 147 | //Au thenticate the devic e | |||||
| 148 | Clie ntCredenti als device Credential s = Device IdManager. LoadOrRegi sterDevice (issuerUri ); | |||||
| 149 | stri ng deviceT oken = Iss ueDeviceTo ken(servic eUrl, devi ceCredenti als); | |||||
| 150 | //Us e the devi ce token t o authenti cate the u ser | |||||
| 151 | retu rn Issue(s erviceUrl, credentia ls, applie sTo, polic y, Guid.Ne wGuid(), d eviceToken ); | |||||
| 152 | } | |||||
| 153 | // Defau lt to OSDP authentic ation. | |||||
| 154 | return I ssue(servi ceUrl, cre dentials, appliesTo, policy, G uid.NewGui d(), null) ; | |||||
| 155 | ||||||
| 156 | } | |||||
| 157 | ||||||
| 158 | #r egion Priv ate Method s | |||||
| 159 | pr ivate stat ic Securit yToken Iss ue(string serviceUrl , ClientCr edentials credential s, string partner, | |||||
| 160 | string p olicy, Gui d clientId , string d eviceToken ) | |||||
| 161 | { | |||||
| 162 | string s oapEnvelop e; | |||||
| 163 | ||||||
| 164 | if (null != device Token) | |||||
| 165 | { | |||||
| 166 | soap Envelope = string.Fo rmat(Cultu reInfo.Inv ariantCult ure, | |||||
| 167 | User TokenTempl ate, clien tId.ToStri ng(), | |||||
| 168 | cred entials.Us erName.Use rName, cre dentials.U serName.Pa ssword, | |||||
| 169 | Stri ng.Format( CultureInf o.Invarian tCulture, BinarySecu rityToken, deviceTok en), | |||||
| 170 | part ner, polic y); | |||||
| 171 | } | |||||
| 172 | else | |||||
| 173 | { | |||||
| 174 | soap Envelope = string.Fo rmat(Cultu reInfo.Inv ariantCult ure, | |||||
| 175 | User TokenTempl ate, clien tId.ToStri ng(), | |||||
| 176 | cred entials.Us erName.Use rName, cre dentials.U serName.Pa ssword, St ring.Empty , | |||||
| 177 | part ner, polic y); | |||||
| 178 | } | |||||
| 179 | XmlDocum ent doc = CallOnline SoapServic es(service Url, "POST ", soapEnv elope); | |||||
| 180 | ||||||
| 181 | XmlNames paceManage r namespac eManager = CreateNam espaceMana ger(doc.Na meTable); | |||||
| 182 | ||||||
| 183 | XmlNode serialized TokenNode = SelectNo de(doc, na mespaceMan ager, User TokenRespo nseXPath); | |||||
| 184 | if (null == serial izedTokenN ode) | |||||
| 185 | { | |||||
| 186 | thro w new Inva lidOperati onExceptio n("Unable to Issue U ser Token due to err or" + Envi ronment.Ne wLine + Fo rmatXml(do c)); | |||||
| 187 | } | |||||
| 188 | return C onvertToTo ken(serial izedTokenN ode.InnerX ml); | |||||
| 189 | } | |||||
| 190 | ||||||
| 191 | pr ivate stat ic string IssueDevic eToken(str ing servic eUrl, Clie ntCredenti als device Credential s) | |||||
| 192 | { | |||||
| 193 | string s oapEnvelop e = string .Format(Cu ltureInfo. InvariantC ulture, | |||||
| 194 | Devi ceTokenTem plate, dev iceCredent ials.UserN ame.UserNa me, device Credential s.UserName .Password) ; | |||||
| 195 | XmlDocum ent doc = CallOnline SoapServic es(service Url, "POST ", soapEnv elope); | |||||
| 196 | ||||||
| 197 | XmlNames paceManage r namespac eManager = CreateNam espaceMana ger(doc.Na meTable); | |||||
| 198 | XmlNode tokenNode = SelectNo de(doc, na mespaceMan ager, Devi ceTokenRes ponseXPath ); | |||||
| 199 | if (null == tokenN ode) | |||||
| 200 | { | |||||
| 201 | thro w new Inva lidOperati onExceptio n("Unable to Issue D evice Toke n due to e rror" + En vironment. NewLine + FormatXml( doc)); | |||||
| 202 | } | |||||
| 203 | ||||||
| 204 | return t okenNode.I nnerXml; | |||||
| 205 | } | |||||
| 206 | ||||||
| 207 | pr ivate stat ic string FormatXml( XmlDocumen t doc) | |||||
| 208 | { | |||||
| 209 | //Create the write r settings | |||||
| 210 | XmlWrite rSettings settings = new XmlWr iterSettin gs(); | |||||
| 211 | settings .Indent = true; | |||||
| 212 | settings .OmitXmlDe claration = true; | |||||
| 213 | ||||||
| 214 | //Write the data | |||||
| 215 | using (S tringWrite r stringWr iter = new StringWri ter(Cultur eInfo.Inva riantCultu re)) | |||||
| 216 | { | |||||
| 217 | usin g (XmlWrit er writer = XmlWrite r.Create(s tringWrite r, setting s)) | |||||
| 218 | { | |||||
| 219 | doc.Save(w riter); | |||||
| 220 | } | |||||
| 221 | ||||||
| 222 | //Re turn the w riter's co ntents | |||||
| 223 | retu rn stringW riter.ToSt ring(); | |||||
| 224 | } | |||||
| 225 | } | |||||
| 226 | ||||||
| 227 | pr ivate stat ic string GetService Endpoint(U ri issuerU ri) | |||||
| 228 | { | |||||
| 229 | string p assportEnv ironment = DeviceIdM anager.Dis coverEnvir onment(iss uerUri); | |||||
| 230 | string f ederationM etadataUrl = string. Format(Cul tureInfo.I nvariantCu lture, Fed erationMet adataUrlFo rmat, | |||||
| 231 | stri ng.IsNullO rEmpty(pas sportEnvir onment) ? null : "-" + passpor tEnvironme nt); | |||||
| 232 | ||||||
| 233 | XmlDocum ent doc = CallOnline SoapServic es(federat ionMetadat aUrl, "GET ", null); | |||||
| 234 | ||||||
| 235 | XmlNames paceManage r namespac eManager = new XmlNa mespaceMan ager(doc.N ameTable); | |||||
| 236 | namespac eManager.A ddNamespac e("fed", " http://doc s.oasis-op en.org/wsf ed/federat ion/200706 "); | |||||
| 237 | namespac eManager.A ddNamespac e("wsa", " http://www .w3.org/20 05/08/addr essing"); | |||||
| 238 | namespac eManager.A ddNamespac e("xsi", " http://www .w3.org/20 01/XMLSche ma-instanc e"); | |||||
| 239 | namespac eManager.A ddNamespac e("core", "urn:oasis :names:tc: SAML:2.0:m etadata"); | |||||
| 240 | ||||||
| 241 | return S electNode( doc, names paceManage r, | |||||
| 242 | @"// core:Entit yDescripto r/core:Rol eDescripto r[@xsi:typ e='fed:App licationSe rviceType' ]/fed:Appl icationSer viceEndpoi nt/wsa:End pointRefer ence/wsa:A ddress").I nnerText.T rim(); | |||||
| 243 | } | |||||
| 244 | ||||||
| 245 | pr ivate stat ic XmlDocu ment CallO nlineSoapS ervices(st ring servi ceUrl, | |||||
| 246 | string m ethod, str ing soapMe ssageEnvel ope) | |||||
| 247 | { | |||||
| 248 | // Buid the web re quest | |||||
| 249 | string u rl = servi ceUrl; | |||||
| 250 | WebReque st request = WebRequ est.Create (url); | |||||
| 251 | request. Method = m ethod; | |||||
| 252 | request. Timeout = 180000; | |||||
| 253 | if (meth od == "POS T") | |||||
| 254 | { | |||||
| 255 | // I f we are " posting" t hen this i s always a SOAP mess age | |||||
| 256 | requ est.Conten tType = "a pplication /soap+xml; charset=U TF-8"; | |||||
| 257 | } | |||||
| 258 | ||||||
| 259 | // If a SOAP envel ope is sup plied, the n we need to write t o the requ est stream | |||||
| 260 | // If th ere isn't a SOAP mes sage suppl ied then c ontinue on to just pr ocess the raw XML | |||||
| 261 | if (!str ing.IsNull OrEmpty(so apMessageE nvelope)) | |||||
| 262 | { | |||||
| 263 | byte [] bytes = Encoding. UTF8.GetBy tes(soapMe ssageEnvel ope); | |||||
| 264 | usin g (Stream str = requ est.GetReq uestStream ()) | |||||
| 265 | { | |||||
| 266 | str.Write( bytes, 0, bytes.Leng th); | |||||
| 267 | str.Close( ); | |||||
| 268 | } | |||||
| 269 | } | |||||
| 270 | ||||||
| 271 | // Read the respon se into an XmlDocume nt and ret urn that d oc | |||||
| 272 | string x ml; | |||||
| 273 | using (W ebResponse response = request. GetRespons e()) | |||||
| 274 | { | |||||
| 275 | usin g (StreamR eader read er = new S treamReade r(response .GetRespon seStream() )) | |||||
| 276 | { | |||||
| 277 | xml = read er.ReadToE nd(); | |||||
| 278 | } | |||||
| 279 | } | |||||
| 280 | ||||||
| 281 | XmlDocum ent docume nt = new X mlDocument (); | |||||
| 282 | document .LoadXml(x ml); | |||||
| 283 | return d ocument; | |||||
| 284 | } | |||||
| 285 | ||||||
| 286 | pr ivate stat ic Securit yToken Con vertToToke n(string x ml) | |||||
| 287 | { | |||||
| 288 | WS2007Fe derationHt tpBinding binding = new WS2007 Federation HttpBindin g(WSFedera tionHttpSe curityMode .Transport WithMessag eCredentia l, | |||||
| 289 | fals e); | |||||
| 290 | Microsof t.Identity Model.Prot ocols.WSTr ust.WSTrus tChannelFa ctory fact ory = new Microsoft. IdentityMo del.Protoc ols.WSTrus t.WSTrustC hannelFact ory(bindin g, new End pointAddre ss("https: //null-End Point")); | |||||
| 291 | factory. TrustVersi on = Trust Version.WS TrustFeb20 05; | |||||
| 292 | ||||||
| 293 | Microsof t.Identity Model.Prot ocols.WSTr ust.WSTrus tChannel t rustChanne l = (Micro soft.Ident ityModel.P rotocols.W STrust.WST rustChanne l)factory. CreateChan nel(); | |||||
| 294 | ||||||
| 295 | RequestS ecurityTok enResponse response = trustCha nnel.WSTru stResponse Serializer .CreateIns tance(); | |||||
| 296 | response .Requested SecurityTo ken = new RequestedS ecurityTok en(LoadXml (xml).Docu mentElemen t); | |||||
| 297 | response .IsFinal = true; | |||||
| 298 | ||||||
| 299 | RequestS ecurityTok en request Token = ne w RequestS ecurityTok en(WSTrust Feb2005Con stants.Req uestTypes. Issue); | |||||
| 300 | requestT oken.KeyTy pe = WSTru stFeb2005C onstants.K eyTypes.Sy mmetric; | |||||
| 301 | ||||||
| 302 | return t rustChanne l.GetToken FromRespon se(request Token, res ponse); | |||||
| 303 | } | |||||
| 304 | ||||||
| 305 | pr ivate stat ic XmlDocu ment LoadX ml(string xml) | |||||
| 306 | { | |||||
| 307 | XmlReade rSettings settings = new XmlRe aderSettin gs(); | |||||
| 308 | settings .IgnoreWhi tespace = true; | |||||
| 309 | settings .Conforman ceLevel = Conformanc eLevel.Fra gment; | |||||
| 310 | ||||||
| 311 | using (S tringReade r memoryRe ader = new StringRea der(xml)) | |||||
| 312 | { | |||||
| 313 | usin g (XmlRead er reader = XmlReade r.Create(m emoryReade r, setting s)) | |||||
| 314 | { | |||||
| 315 | //Create t he xml doc ument | |||||
| 316 | XmlDocumen t doc = ne w XmlDocum ent(); | |||||
| 317 | doc.XmlRes olver = nu ll; | |||||
| 318 | ||||||
| 319 | //Load the data from the reade r | |||||
| 320 | doc.Load(r eader); | |||||
| 321 | ||||||
| 322 | return doc ; | |||||
| 323 | } | |||||
| 324 | } | |||||
| 325 | } | |||||
| 326 | ||||||
| 327 | pr ivate stat ic XmlNode SelectNod e(XmlDocum ent docume nt, | |||||
| 328 | XmlNames paceManage r namespac eManager, string xPa thToNode) | |||||
| 329 | { | |||||
| 330 | XmlNodeL ist nodes = document .SelectNod es(xPathTo Node, name spaceManag er); | |||||
| 331 | if (node s != null && nodes.C ount > 0 & & nodes[0] != null) | |||||
| 332 | { | |||||
| 333 | retu rn nodes[0 ]; | |||||
| 334 | } | |||||
| 335 | return n ull; | |||||
| 336 | } | |||||
| 337 | ||||||
| 338 | pr ivate stat ic XmlName spaceManag er CreateN amespaceMa nager(XmlN ameTable n ameTable) | |||||
| 339 | { | |||||
| 340 | XmlNames paceManage r namespac eManager = new XmlNa mespaceMan ager(nameT able); | |||||
| 341 | namespac eManager.A ddNamespac e("wst", " http://sch emas.xmlso ap.org/ws/ 2005/02/tr ust"); | |||||
| 342 | namespac eManager.A ddNamespac e("S", "ht tp://www.w 3.org/2003 /05/soap-e nvelope"); | |||||
| 343 | namespac eManager.A ddNamespac e("wsu", " http://doc s.oasis-op en.org/wss /2004/01/o asis-20040 1-wss-wsse curity-uti lity-1.0.x sd"); | |||||
| 344 | return n amespaceMa nager; | |||||
| 345 | } | |||||
| 346 | #e ndregion | |||||
| 347 | } | |||||
| 348 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.