• 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
  • 相关阅读:
    java中math类
    java中的值传递和引用传递(转)
    eclipse 字体和配色修改
    JAR WAR EAR包的区别
    java中基本类型
    tomcat 7.0 配置详解
    或许你需要一些可操作性更强的实践
    Assembly.CreateInstance()与Activator.CreateInstanc
    OOD沉思录2 类和对象的关系包含关系
    C#的插件开发
  • 原文地址:https://www.cnblogs.com/AnXinliang/p/5147496.html
Copyright © 2020-2023  润新知