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