zoukankan      html  css  js  c++  java
  • VB调用WebService(SOA2.0接口)(直接Post方式)并解析返回的XML

     1  SOA 2.0接口
     2 Function GetDepartmentCode(reqDeptCode)
     3     Dim soaRequestXML : soaRequestXML = ""
     4     Dim strCustomerSOAServer : strCustomerSOAServer = "www.td.com"    
    14 
    15     soaRequestXML ="<?xml version=""1.0"" encoding=""utf-8""?>"
    16     soaRequestXML = soaRequestXML & "<GetDepartmentCodeRequest xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns=""http://www.td.com/platform/CTI/BaseWsCore/v1"">"
    17     soaRequestXML = soaRequestXML & "<DepartmentCode xmlns="""">"&reqDeptCode&"</DepartmentCode>"
    18     soaRequestXML = soaRequestXML & "<Regions xmlns="""">H</Regions>"
    22     soaRequestXML = soaRequestXML & "</GetDepartmentCodeRequest>"
    23 
    24     dim url
    25     url="http://"&strCustomerSOAServer&"/td-core/api/GetDepartmentCode.xml"
    26     dim xmlHttp
    27     Set xmlHttp = CreateObject("Microsoft.XMLHTTP")
    28      xmlHttp.open "POST", url, False 
    29      xmlHttp.setRequestHeader "Content-Type", "application/xml;" 
    30      xmlHttp.send (soaRequestXML)
    31      While xmlHttp.readyState <> 4        
    32      Wend
    33     
    34 
    35     GetDepartmentCode = xmlHttp.responseText
    36 
    37 End Function
     1 调用上面接口方法 并解析返回的xml数据
     2 Sub ShowVdnSelect(strRouteDest)
     3     dim strVdnCode, strVdnName, strSelected, soapXml
     4     set soapXml = Server.CreateObject("microsoft.xmldom")
     5     soapXml.async=false
     6     soapXml.setProperty "SelectionLanguage","XPath"
     7         
     8     soapXml.loadXML(GetDepartmentCode("yiget"))
     9                         
    10     Response.Write "<select name='VDN_List' id='VDN_List'>"
    11     Response.Write "<option value=''>请选择一个服务组</option>"
    12 
    13     for each tempNode in soapXml.SelectNodes("//Vdn")
    14         strVdnCode = tempNode.SelectSingleNode("VdnCode").text
    15         strVdnName = tempNode.SelectSingleNode("VdnName").text
    16         
    17         
    18 if instr(AllowVDNList, ","& strVdnCode &",") then 19 if strRouteDest=strVdnCode then 20 strSelected=" selected" 21 else 22 strSelected="" 23 end if 24 25 if left(strVdnName,4)<>"公共组" then 26 Response.Write "<option value='" & strVdnCode & "'" & strSelected & ">" & strVdnCode & " " & strVdnName & "</option>" 27 end if 28 end if 29 'end if 30 next 31 32 Response.Write "</select>" 33 End Sub
  • 相关阅读:
    BZOJ2705: [SDOI2012]Longge的问题 欧拉函数
    BZOJ3884: 上帝与集合的正确用法 拓展欧拉定理
    BZOJ1296: [SCOI2009]粉刷匠 DP
    BZOJ5293: [Bjoi2018]求和 树上差分
    BZOJ1398: Vijos1382寻找主人 Necklace 字符串最小表示法
    BZOJ5189: [Usaco2018 Jan]Cow at Large 贪心+LCA
    BZOJ2654: tree 二分答案+最小生成树
    BZOJ1304: [CQOI2009]叶子的染色 树形dp
    BZOJ1632: [Usaco2007 Feb]Lilypad Pond SPFA+最短路计数
    BZOJ1726: [Usaco2006 Nov]Roadblocks第二短路 K短路
  • 原文地址:https://www.cnblogs.com/AnXinliang/p/5147496.html
Copyright © 2011-2022 走看看