782. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2/1/2017 2:57:06 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.

782.1 Files compared

# 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\VB\HelperCode WsdlTokenManager.vb Tue Dec 20 19:51:48 2016 UTC
2 Wed Feb 1 19:57:06 2017 UTC

782.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 0 0
Changed 0 0
Inserted 0 0
Removed 1 311

782.3 Comparison options

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

782.4 Active regular expressions

No regular expressions were active.

782.5 Comparison detail

1   ' ======== ========== ========== ========== ========== ========== ========== =        
2   '        
3   '  This fi le is part  of the Mi crosoft Dy namics CRM  SDK code  samples.        
4   '        
5   '  Copyrig ht (C) Mic rosoft Cor poration.   All right s reserved .        
6   '        
7   '  This so urce code  is intende d only as  a suppleme nt to Micr osoft        
8   '  Develop ment Tools  and/or on -line docu mentation.   See thes e other        
9   '  materia ls for det ailed info rmation re garding Mi crosoft co de samples .        
10   '        
11   '  THIS CO DE AND INF ORMATION A RE PROVIDE D "AS IS"  WITHOUT WA RRANTY OF  ANY        
12   '  KIND, E ITHER EXPR ESSED OR I MPLIED, IN CLUDING BU T NOT LIMI TED TO THE        
13   '  IMPLIED  WARRANTIE S OF MERCH ANTABILITY  AND/OR FI TNESS FOR  A        
14   '  PARTICU LAR PURPOS E.        
15   '        
16   ' ======== ========== ========== ========== ========== ========== ========== =        
17   Imports Sy stem.Globa lization        
18   Imports Sy stem.Ident ityModel.T okens        
19   Imports Sy stem.IO        
20   Imports Sy stem.Net        
21   Imports Sy stem.Servi ceModel        
22   Imports Sy stem.Servi ceModel.De scription        
23   Imports Sy stem.Servi ceModel.Se curity        
24   Imports Sy stem.Text        
25   Imports Sy stem.Xml        
26          
27   Imports Mi crosoft.Id entityMode l.Protocol s.WSTrust        
28          
29   Imports Mi crosoft.Cr m.Services .Utility        
30          
31   Namespace  Microsoft. Crm.Sdk.Sa mples        
32       ''' <s ummary>        
33       ''' Ut ility to a uthenticat e Microsof t account  and Micros oft Office  365 (i.e.  OSDP / Or gId) users          
34       ''' wi thout usin g the clas ses expose d in Micro soft.Xrm.S dk.dll        
35       ''' </ summary>        
36       Public  NotInheri table Clas s WsdlToke nManager        
37           Pr ivate Shar ed Federat ionMetadat aUrlFormat  As String  = "https: //nexus.pa ssport{0}. com/federa tionmetada ta/2007-06 /Federatio nMetaData. xml"        
38          
39           Pr ivate Cons t DeviceTo kenRespons eXPath As  String = " S:Envelope /S:Body/ws t:RequestS ecurityTok enResponse /wst:Reque stedSecuri tyToken"        
40           Pr ivate Cons t UserToke nResponseX Path As St ring = "S: Envelope/S :Body/wst: RequestSec urityToken Response/w st:Request edSecurity Token"        
41          
42   #Region "T emplates"        
43           Pr ivate Cons t DeviceTo kenTemplat e As Strin g = _        
44                "<?xml v ersion=""1 .0"" encod ing=""UTF- 8""?>" & C ontrolChar s.CrLf & _        
45                "         <s:Envelo pe " & Con trolChars. CrLf & _        
46                "           xmlns:s =""http:// www.w3.org /2003/05/s oap-envelo pe"" " & C ontrolChar s.CrLf & _        
47                "           xmlns:w sse=""http ://docs.oa sis-open.o rg/wss/200 4/01/oasis -200401-ws s-wssecuri ty-secext- 1.0.xsd""  " & Contro lChars.CrL f & _        
48                "           xmlns:w sp=""http: //schemas. xmlsoap.or g/ws/2004/ 09/policy" " " & Cont rolChars.C rLf & _        
49                "           xmlns:w su=""http: //docs.oas is-open.or g/wss/2004 /01/oasis- 200401-wss -wssecurit y-utility- 1.0.xsd""  " & Contro lChars.CrL f & _        
50                "           xmlns:w sa=""http: //www.w3.o rg/2005/08 /addressin g"" " & Co ntrolChars .CrLf & _        
51                "           xmlns:w st=""http: //schemas. xmlsoap.or g/ws/2005/ 02/trust"" >" & Contr olChars.Cr Lf & _        
52                "            <s:Hea der>" & Co ntrolChars .CrLf & _        
53                "             <wsa: Action s:m ustUnderst and=""1""> http://sch emas.xmlso ap.org/ws/ 2005/02/tr ust/RST/Is sue</wsa:A ction>" &  ControlCha rs.CrLf &  _        
54                "             <wsa: To s:mustU nderstand= ""1"">http ://Passpor t.NET/tb</ wsa:To>     " & Contr olChars.Cr Lf & _        
55                "             <wsse :Security> " & Contro lChars.CrL f & _        
56                "               <ws se:Usernam eToken wsu :Id=""devi cesoftware "">" & Con trolChars. CrLf & _        
57                "                 < wsse:Usern ame>{0:dev iceName}</ wsse:Usern ame>" & Co ntrolChars .CrLf & _        
58                "                 < wsse:Passw ord>{1:pas sword}</ws se:Passwor d>" & Cont rolChars.C rLf & _        
59                "               </w sse:Userna meToken>"  & ControlC hars.CrLf  & _        
60                "             </wss e:Security >" & Contr olChars.Cr Lf & _        
61                "           </s:Hea der>" & Co ntrolChars .CrLf & _        
62                "           <s:Body >" & Contr olChars.Cr Lf & _        
63                "             <wst: RequestSec urityToken  Id=""RST0 "">" & Con trolChars. CrLf & _        
64                "                   <wst:Reque stType>htt p://schema s.xmlsoap. org/ws/200 5/02/trust /Issue</ws t:RequestT ype>" & Co ntrolChars .CrLf & _        
65                "                   <wsp:Appli esTo>" & C ontrolChar s.CrLf & _        
66                "                      <wsa:En dpointRefe rence>" &  ControlCha rs.CrLf &  _        
67                "                         <wsa :Address>h ttp://Pass port.NET/t b</wsa:Add ress>" & C ontrolChar s.CrLf & _        
68                "                      </wsa:E ndpointRef erence>" &  ControlCh ars.CrLf &  _        
69                "                   </wsp:Appl iesTo>" &  ControlCha rs.CrLf &  _        
70                "               </w st:Request SecurityTo ken>" & Co ntrolChars .CrLf & _        
71                "           </s:Bod y>" & Cont rolChars.C rLf & _        
72                "         </s:Envel ope>" & Co ntrolChars .CrLf & _        
73                "         "        
74          
75           Pr ivate Cons t UserToke nTemplate  As String  = _        
76                "<?xml v ersion=""1 .0"" encod ing=""UTF- 8""?>" & C ontrolChar s.CrLf & _        
77                "    <s: Envelope "  & Control Chars.CrLf  & _        
78                "      x mlns:s=""h ttp://www. w3.org/200 3/05/soap- envelope""  " & Contr olChars.Cr Lf & _        
79                "      x mlns:wsse= ""http://d ocs.oasis- open.org/w ss/2004/01 /oasis-200 401-wss-ws security-s ecext-1.0. xsd"" " &  ControlCha rs.CrLf &  _        
80                "      x mlns:wsp=" "http://sc hemas.xmls oap.org/ws /2004/09/p olicy"" "  & ControlC hars.CrLf  & _        
81                "      x mlns:wsu=" "http://do cs.oasis-o pen.org/ws s/2004/01/ oasis-2004 01-wss-wss ecurity-ut ility-1.0. xsd"" " &  ControlCha rs.CrLf &  _        
82                "      x mlns:wsa=" "http://ww w.w3.org/2 005/08/add ressing""  " & Contro lChars.CrL f & _        
83                "      x mlns:wst=" "http://sc hemas.xmls oap.org/ws /2005/02/t rust"">" &  ControlCh ars.CrLf &  _        
84                "        <s:Header> " & Contro lChars.CrL f & _        
85                "         <wsa:Acti on s:mustU nderstand= ""1"">http ://schemas .xmlsoap.o rg/ws/2005 /02/trust/ RST/Issue< /wsa:Actio n>" & Cont rolChars.C rLf & _        
86                "         <wsa:To s :mustUnder stand=""1" ">http://P assport.NE T/tb</wsa: To>    " &  ControlCh ars.CrLf &  _        
87                "        <ps:AuthIn fo Id=""PP AuthInfo""  xmlns:ps= ""http://s chemas.mic rosoft.com /LiveID/So apServices /v1"">" &  ControlCha rs.CrLf &  _        
88                "              <ps: HostingApp >{0:client Id}</ps:Ho stingApp>"  & Control Chars.CrLf  & "           </ps:A uthInfo>"  & ControlC hars.CrLf  & _        
89                "           <wsse:S ecurity>"  & ControlC hars.CrLf  & _        
90                "              <wss e:Username Token wsu: Id=""user" ">" & Cont rolChars.C rLf & _        
91                "                 < wsse:Usern ame>{1:use rName}</ws se:Usernam e>" & Cont rolChars.C rLf & _        
92                "                 < wsse:Passw ord>{2:pas sword}</ws se:Passwor d>" & Cont rolChars.C rLf & _        
93                "              </ws se:Usernam eToken>" &  ControlCh ars.CrLf &  _        
94                "              {3:b inarySecur ityToken}"  & Control Chars.CrLf  & _        
95                "           </wsse: Security>"  & Control Chars.CrLf  & _        
96                "      < /s:Header> " & Contro lChars.CrL f & _        
97                "      < s:Body>" &  ControlCh ars.CrLf &  _        
98                "         <wst:Requ estSecurit yToken Id= ""RST0"">"  & Control Chars.CrLf  & _        
99                "              <wst :RequestTy pe>http:// schemas.xm lsoap.org/ ws/2005/02 /trust/Iss ue</wst:Re questType> " & Contro lChars.CrL f & _        
100                "              <wsp :AppliesTo >" & Contr olChars.Cr Lf & _        
101                "                 < wsa:Endpoi ntReferenc e>" & Cont rolChars.C rLf & _        
102                "                     <wsa:Add ress>{4:pa rtnerUrl}< /wsa:Addre ss>" & Con trolChars. CrLf & _        
103                "                 < /wsa:Endpo intReferen ce>" & Con trolChars. CrLf & _        
104                "              </ws p:AppliesT o>" & Cont rolChars.C rLf & _        
105                "              <wsp :PolicyRef erence URI =""{5:poli cy}""/>" &  ControlCh ars.CrLf &  _        
106                "           </wst:R equestSecu rityToken> " & Contro lChars.CrL f & _        
107                "      < /s:Body>"  & ControlC hars.CrLf  & _        
108                "    </s :Envelope> "        
109           Pr ivate Cons t BinarySe curityToke n As Strin g = _        
110                "<wsse:B inarySecur ityToken V alueType=" "urn:livei d:device"" >" & Contr olChars.Cr Lf & _        
111                "                     {0:devic eTokenValu e}" & Cont rolChars.C rLf & _        
112                "</wsse: BinarySecu rityToken> "        
113   #End Regio n        
114          
115           '' ' <summary >        
116           '' ' This sho ws the met hod to ret rieve the  security t icket for  the Micros oft accoun t user or  OrgId user        
117           '' ' without  using any  certificat e for auth entication .             
118           '' ' </summar y>        
119           '' ' <param n ame="crede ntials">Us er credent ials that  should be  used to co nnect to t he server< /param>        
120           '' ' <param n ame="appli esTo">Indi cates the  AppliesTo  that is re quired for  the token </param>        
121           '' ' <param n ame="polic y">Policy  that shoul d be used  when commu nicating w ith the se rver</para m>        
122           Pr ivate Sub  New()        
123           En d Sub        
124           Pu blic Share d Function  Authentic ate(ByVal  credential s As Clien tCredentia ls, ByVal  appliesTo  As String,  ByVal pol icy As Str ing) _        
125                   As Se curityToke n        
126                Return A uthenticat e(credenti als, appli esTo, poli cy, Nothin g)        
127           En d Function        
128          
129           '' ' <summary >        
130           '' ' This sho ws the met hod to ret rieve the  security t icket for  the Micros oft accoun t user or  OrgId user        
131           '' ' without  using any  certificat e for auth entication .             
132           '' ' </summar y>        
133           '' ' <param n ame="crede ntials">Us er credent ials that  should be  used to co nnect to t he server< /param>        
134           '' ' <param n ame="appli esTo">Indi cates the  AppliesTo  that is re quired for  the token </param>        
135           '' ' <param n ame="polic y">Policy  that shoul d be used  when commu nicating w ith the se rver</para m>        
136           '' ' <param n ame="issue rUri">URL  for the cu rrent toke n issuer</ param>         
137           Pu blic Share d Function  Authentic ate(ByVal  credential s As Clien tCredentia ls, ByVal  appliesTo  As String,  ByVal pol icy As Str ing, _        
138                                                   ByVal  issuerUri  As Uri) As  SecurityT oken        
139                Dim serv iceUrl As  String = i ssuerUri.T oString()        
140                ' if ser viceUrl st arts with  "https://l ogin.live. com", it m eans Micro soft accou nt authent ication is  needed ot herwise OS DP authent ication.        
141                If (Not  String.IsN ullOrEmpty (serviceUr l)) AndAls o serviceU rl.StartsW ith("https ://login.l ive.com")  Then        
142                    serv iceUrl = G etServiceE ndpoint(is suerUri)        
143          
144                    'Aut henticate  the device        
145                    Dim  deviceCred entials As  ClientCre dentials =  DeviceIdM anager.Loa dOrRegiste rDevice(is suerUri)        
146                    Dim  deviceToke n As Strin g = IssueD eviceToken (serviceUr l, deviceC redentials )        
147                    'Use  the devic e token to  authentic ate the us er        
148                    Retu rn Issue(s erviceUrl,  credentia ls, applie sTo, polic y, Guid.Ne wGuid(), d eviceToken )        
149                End If        
150                ' Defaul t to OSDP  authentica tion.        
151                Return I ssue(servi ceUrl, cre dentials,  appliesTo,  policy, G uid.NewGui d(), Nothi ng)        
152           En d Function        
153          
154   #Region "P rivate Met hods"        
155           Pr ivate Shar ed Functio n Issue(By Val servic eUrl As St ring, ByVa l credenti als As Cli entCredent ials, ByVa l partner  As String,  _        
156                                            By Val policy  As String , ByVal cl ientId As  Guid, ByVa l deviceTo ken As Str ing) As Se curityToke n        
157                Dim soap Envelope A s String        
158          
159                If Nothi ng IsNot d eviceToken  Then        
160                    soap Envelope =  String.Fo rmat(Cultu reInfo.Inv ariantCult ure, UserT okenTempla te, client Id.ToStrin g(), crede ntials.Use rName.User Name, cred entials.Us erName.Pas sword, Str ing.Format (CultureIn fo.Invaria ntCulture,  BinarySec urityToken , deviceTo ken), part ner, polic y)        
161                Else        
162                    soap Envelope =  String.Fo rmat(Cultu reInfo.Inv ariantCult ure, UserT okenTempla te, client Id.ToStrin g(), crede ntials.Use rName.User Name, cred entials.Us erName.Pas sword, Str ing.Empty,  partner,  policy)        
163                End If        
164                Dim doc  As XmlDocu ment = Cal lOnlineSoa pServices( serviceUrl , "POST",  soapEnvelo pe)        
165          
166                Dim name spaceManag er As XmlN amespaceMa nager = Cr eateNamesp aceManager (doc.NameT able)        
167          
168                Dim seri alizedToke nNode As X mlNode = S electNode( doc, names paceManage r, UserTok enResponse XPath)        
169                If Nothi ng Is seri alizedToke nNode Then        
170                    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))        
171                End If        
172                Return C onvertToTo ken(serial izedTokenN ode.InnerX ml)        
173           En d Function        
174          
175           Pr ivate Shar ed Functio n IssueDev iceToken(B yVal servi ceUrl As S tring, ByV al deviceC redentials  As Client Credential s) As Stri ng        
176                Dim soap Envelope A s String =  String.Fo rmat(Cultu reInfo.Inv ariantCult ure, Devic eTokenTemp late, _        
177                                                               devic eCredentia ls.UserNam e.UserName , deviceCr edentials. UserName.P assword)        
178                Dim doc  As XmlDocu ment = Cal lOnlineSoa pServices( serviceUrl , "POST",  soapEnvelo pe)        
179          
180                Dim name spaceManag er As XmlN amespaceMa nager = Cr eateNamesp aceManager (doc.NameT able)        
181                Dim toke nNode As X mlNode = S electNode( doc, names paceManage r, DeviceT okenRespon seXPath)        
182                If Nothi ng Is toke nNode Then        
183                    Thro w New Inva lidOperati onExceptio n("Unable  to Issue D evice Toke n due to e rror" & En vironment. NewLine &  FormatXml( doc))        
184                End If        
185          
186                Return t okenNode.I nnerXml        
187           En d Function        
188          
189           Pr ivate Shar ed Functio n FormatXm l(ByVal do c As XmlDo cument) As  String        
190                'Create  the writer  settings        
191                Dim sett ings As Ne w XmlWrite rSettings( )        
192                settings .Indent =  True        
193                settings .OmitXmlDe claration  = True        
194          
195                'Write t he data        
196                Using st ringWriter _Renamed A s New Stri ngWriter(C ultureInfo .Invariant Culture)        
197                    Usin g writer A s XmlWrite r = XmlWri ter.Create (stringWri ter_Rename d, setting s)        
198                         doc.Save(w riter)        
199                    End  Using        
200          
201                    'Ret urn the wr iter's con tents        
202                    Retu rn stringW riter_Rena med.ToStri ng()        
203                End Usin g        
204           En d Function        
205          
206           Pr ivate Shar ed Functio n GetServi ceEndpoint (ByVal iss uerUri As  Uri) As St ring        
207                Dim pass portEnviro nment As S tring = De viceIdMana ger.Discov erEnvironm ent(issuer Uri)        
208                Dim fede rationMeta dataUrl As  String =  String.For mat(Cultur eInfo.Inva riantCultu re, Federa tionMetada taUrlForma t, _        
209                                                            If(Strin g.IsNullOr Empty(pass portEnviro nment), No thing, "-"  & passpor tEnvironme nt))        
210          
211                Dim doc  As XmlDocu ment = Cal lOnlineSoa pServices( federation MetadataUr l, "GET",  Nothing)        
212          
213                Dim name spaceManag er As New  XmlNamespa ceManager( doc.NameTa ble)        
214                namespac eManager.A ddNamespac e("fed", " http://doc s.oasis-op en.org/wsf ed/federat ion/200706 ")        
215                namespac eManager.A ddNamespac e("wsa", " http://www .w3.org/20 05/08/addr essing")        
216                namespac eManager.A ddNamespac e("xsi", " http://www .w3.org/20 01/XMLSche ma-instanc e")        
217                namespac eManager.A ddNamespac e("core",  "urn:oasis :names:tc: SAML:2.0:m etadata")        
218          
219                Return S electNode( doc, names paceManage r, "//core :EntityDes criptor/co re:RoleDes criptor[@x si:type='f ed:Applica tionServic eType']" &  _        
220                                    "/fed:Appl icationSer viceEndpoi nt/wsa:End pointRefer ence/wsa:A ddress").I nnerText.T rim()        
221           En d Function        
222          
223           Pr ivate Shar ed Functio n CallOnli neSoapServ ices(ByVal  serviceUr l As Strin g, ByVal m ethod As S tring, ByV al soapMes sageEnvelo pe As Stri ng) As Xml Document        
224                ' Buid t he web req uest        
225                Dim url  As String  = serviceU rl        
226                Dim requ est As Web Request =  WebRequest .Create(ur l)        
227                request. Method = m ethod        
228                request. Timeout =  180000        
229                If metho d = "POST"  Then        
230                    ' If  we are "p osting" th en this is  always a  SOAP messa ge        
231                    requ est.Conten tType = "a pplication /soap+xml;  charset=U TF-8"        
232                End If        
233          
234                ' If a S OAP envelo pe is supp lied, then  we need t o write to  the reque st stream        
235                ' If the re isn't a  SOAP mess age suppli ed then co ntinue ont o just pro cess the r aw XML        
236                If Not S tring.IsNu llOrEmpty( soapMessag eEnvelope)  Then        
237                    Dim  bytes() As  Byte = En coding.UTF 8.GetBytes (soapMessa geEnvelope )        
238                    Usin g str As S tream = re quest.GetR equestStre am()        
239                         str.Write( bytes, 0,  bytes.Leng th)        
240                         str.Close( )        
241                    End  Using        
242                End If        
243          
244                ' Read t he respons e into an  XmlDocumen t and retu rn that do c        
245                Dim xml  As String        
246                Using re sponse As  WebRespons e = reques t.GetRespo nse()        
247                    Usin g reader A s New Stre amReader(r esponse.Ge tResponseS tream())        
248                         xml = read er.ReadToE nd()        
249                    End  Using        
250                End Usin g        
251          
252                Dim docu ment As Ne w XmlDocum ent()        
253                document .LoadXml(x ml)        
254                Return d ocument        
255           En d Function        
256          
257           Pr ivate Shar ed Functio n ConvertT oToken(ByV al xml As  String) As  SecurityT oken        
258                Dim bind ing As New  WS2007Fed erationHtt pBinding(W SFederatio nHttpSecur ityMode.Tr ansportWit hMessageCr edential,  False)        
259                Dim fact ory As New  Microsoft .IdentityM odel.Proto cols.WSTru st.WSTrust ChannelFac tory(bindi ng, New En dpointAddr ess("https ://null-En dPoint"))        
260                factory. TrustVersi on = Trust Version.WS TrustFeb20 05        
261          
262                Dim trus tChannel A s Microsof t.Identity Model.Prot ocols.WSTr ust.WSTrus tChannel =  CType(fac tory.Creat eChannel() , Microsof t.Identity Model.Prot ocols.WSTr ust.WSTrus tChannel)        
263          
264                Dim resp onse As Re questSecur ityTokenRe sponse = t rustChanne l.WSTrustR esponseSer ializer.Cr eateInstan ce()        
265                response .Requested SecurityTo ken = New  RequestedS ecurityTok en(LoadXml (xml).Docu mentElemen t)        
266                response .IsFinal =  True        
267          
268                Dim requ estToken A s New Requ estSecurit yToken(WST rustFeb200 5Constants .RequestTy pes.Issue)        
269                requestT oken.KeyTy pe = WSTru stFeb2005C onstants.K eyTypes.Sy mmetric        
270          
271                Return t rustChanne l.GetToken FromRespon se(request Token, res ponse)        
272           En d Function        
273          
274           Pr ivate Shar ed Functio n LoadXml( ByVal xml  As String)  As XmlDoc ument        
275                Dim sett ings As Ne w XmlReade rSettings( )        
276                settings .IgnoreWhi tespace =  True        
277                settings .Conforman ceLevel =  Conformanc eLevel.Fra gment        
278          
279                Using me moryReader  As New St ringReader (xml)        
280                    Usin g reader A s XmlReade r = XmlRea der.Create (memoryRea der, setti ngs)        
281                         'Create th e xml docu ment        
282                         Dim doc As  New XmlDo cument()        
283                         doc.XmlRes olver = No thing        
284          
285                         'Load the  data from  the reader        
286                         doc.Load(r eader)        
287          
288                         Return doc        
289                    End  Using        
290                End Usin g        
291           En d Function        
292          
293           Pr ivate Shar ed Functio n SelectNo de(ByVal d ocument As  XmlDocume nt, ByVal  namespaceM anager As  XmlNamespa ceManager,  _        
294                                                  ByVal x PathToNode  As String ) As XmlNo de        
295                Dim node s As XmlNo deList = d ocument.Se lectNodes( xPathToNod e, namespa ceManager)        
296                If nodes  IsNot Not hing AndAl so nodes.C ount > 0 A ndAlso nod es(0) IsNo t Nothing  Then        
297                    Retu rn nodes(0 )        
298                End If        
299                Return N othing        
300           En d Function        
301          
302           Pr ivate Shar ed Functio n CreateNa mespaceMan ager(ByVal  nameTable  As XmlNam eTable) As  XmlNamesp aceManager        
303                Dim name spaceManag er As New  XmlNamespa ceManager( nameTable)        
304                namespac eManager.A ddNamespac e("wst", " http://sch emas.xmlso ap.org/ws/ 2005/02/tr ust")        
305                namespac eManager.A ddNamespac e("S", "ht tp://www.w 3.org/2003 /05/soap-e nvelope")        
306                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")        
307                Return n amespaceMa nager        
308           En d Function        
309   #End Regio n        
310       End Cl ass        
311   End Namesp ace