(A) TransferXML Function Public Function TransferXMl (ByVal rawdata As String) As Hashtable Dim xmlDoc As New XmlDocument Dim clientPrescriptionNodes As XmlNodeList Dim clientPrescriptionNode As XmlNode Dim bodymark As Boolean = False Dim TempHashtable As New Hashtable Dim valuestr As String Dim v () As String xmlDoc.LoadXml (rawdata) clientPrescriptionNodes = xmlDoc.GetElementsByTagName ( "webmethod") // webmethod means from which marks the start of the hash table to read childnode For Each clientPrescriptionNode in clientPrescriptionNodes Dim baseDataNodes As XmlNodeList Dim baseDataNode As XmlNode Dim bFirstInRow As Boolean
baseDataNodes = clientPrescriptionNode.ChildNodes bFirstInRow = True For Each baseDataNode In baseDataNodes If (bFirstInRow) Then bFirstInRow = False Else Console.Out.Write ( ",") End If If baseDataNode.Name = "body" Then // herein, refers to the body Layer Nested Nested Bodymark = True Console.out.write (BaseDataNode.Name & ":" Parameter ") TemphashTable.Add (" Body "," 1 ") Else Console.Write (BasedataNode.name & ":" & baseDataNode.outerxml.toTString) VALUESTR = Basedatanode.outerxml.tostring Valuestr = Replace (Valuestr, Chr (34), "$") V = VALUESTR.SPLIT ("$") Valuestr = V (1) TemphashTable. Add (BaseDataNode.Name, Valuestr) end if next console.out.writeline () Next.writeline () Next If bodymark = True Then clientPrescriptionNodes = xmlDoc.GetElementsByTagName ( "body") For Each clientPrescriptionNode In clientPrescriptionNodes Dim baseDataNodes1 As XmlNodeList Dim baseDataNode1 As XmlNode Dim bFirstInRow1 As Boolean
baseDataNodes1 = clientPrescriptionNode.ChildNodes bFirstInRow1 = True For Each baseDataNode1 In baseDataNodes1 If (bFirstInRow1) Then bFirstInRow1 = False Else Console.Out.Write ( ",") End If Console.Out.Write (baseDataNode1.Name & ":" & baseDataNode1. InnerText) TempHashtable.Add (baseDataNode1.Name, baseDataNode1.InnerText) Next Console.Out.WriteLine () Next End If TransferXMl = TempHashtable Exit function End function (two) GetReqResult function Public function GetReqResult (ByVal scontent As String) As Hashtable Dim snode AS String 'Name Dim Svalue AS String' Single Node Value DIM Mvalue As String = "" 'Multiple Node Values DIM ReqResult As New HashTable' HTTP Request Content List
Dim strReader As StringReader = New StringReader (scontent) Dim reader As XmlTextReader = New XmlTextReader (strReader) While (reader.Read ()) snode = reader.Name Select Case snode Case "action_id" // Each case represents a tag reader .Read () svalue = reader.Value ReqResult.add (snode, svalue) reader.read () case "service_id" reader.read () svalue = reader.Value ReqResult.add (snode, svalue) Reader.Read () CASE "MID" reader.read () svalue = reader.Value ReqResult.add (Snode, svalue) Reader.Read () case "Mobile_id" Reader.Read () svalue = Reader.Value ReqResult.add (Snode, Svalue) Reader. Read () Case Access_mode "// When there is two consecutive two times, use this method to dock Reader.Read () if mvalue =" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Read () End Select End While IF Mvalue <> "" The ReqResult.Add ("Access_Mode", Mvalue) end if getReqResult = ReqResult End Function ----------------------------------------------------------------------------------------------
----- (3) Methods When two functions are called DIM COLL AS NameValueCollection Dim Spram AS String Dim Reqbyte as Byte () 'HTTP Request Word Dimension Dim Result As HashTable' HTTP Request Content List Coll = Request .Headers Dim ResStr As String = "" Dim Resbyte As Byte () Dim c (19) As String reqbyte = Request.BinaryRead (Request.ContentLength) sParam = System.Text.Encoding.ASCII.GetString (reqbyte) If sParam <> "" Then getReqResult (spram) if transferxml (spram, result) THEN C (0) = lastvalue c (1) = Result.item ("Version") c (2) = Result.Item ("MsgType") ... ..... c (19) = Result.item ("featureStr") R= RESSTR " XML Version =" CHR (34) "1.0" CHR (34) "?>" RESSTR = Ress "<...> ......>" Resbyte = system.text.encoding.ascii.getbytes (RESSTR) response.binarywrite --------- ---------------------------- (4) Deposit XML into the SQL Server Database Private Sub SaveorderData (B Yval c () as string) DIM MyConnection As New SqlConnection Dim MyselectQuery As String Dim MyCommand As Sqlcommand Dim Brandstr AS StringTry