1
我對XML和Web服務非常陌生,所以我正在尋找一些方向。我有一個經典的ASP Web應用程序(確定沒有笑話!),它使用Web服務從數據庫中檢索數據。我可以調用Web服務並且可以很好地接收SOAP響應。嘗試解析響應時出現問題。我的代碼來調用Web服務是這樣的...使用VBScript解析SOAP響應
Dim objXMLHttp, strEnvelop, strReturn
strEnvelope = <I build the soap message here>
set objXMLHttp = Server.CreateObject("MSXML2.XMLHTTP")
objXMLHttp.open "POST", "web service URL", false
objXMLHttp.setRequestHeader "Content-Type", "text/xml"
objXMLHttp.send strEnvelope
strReturn = objXMLHttp.responseText
所有這一切都很完美,strReturn有響應XML。 XML將是這個樣子......
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<Body xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<lookupCaseOutputCollection xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/lookupCase" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<lookupCaseOutput>
<C_CASE_ID>100000</C_CASE_ID>
<I_FIRST_NM>BERNADINE</I_FIRST_NM>
<I_MI_NM>C</I_MI_NM>
<I_LAST_NM>TWOTEETH</I_LAST_NM>
<I_DOB_DT>1977-06-26</I_DOB_DT>
</lookupCaseOutput>
</lookupCaseOutputCollection>
</Body>
</Envelope>
當談到時間來解析響應XML我得到儘可能...
Dim xmlDoc
set xmlDoc = CreateObject("MSXML2.DOMDocument")
xmlDoc.async = false
xmlDoc.Load strReturn
這就是我會被卡住。我需要能夠提取和顯示單個標籤C_CASE_ID,I_FIRST_NM等的值。我不知道如何做到這一點。有沒有人有任何建議/例子?
謝謝。
當然,因爲我張貼了這個問題,我看了看下的「相關」的主題,並發現了一個話題那完美地回答了我的問題。當然,它沒有顯示在我發佈之前的任何搜索中。人物 :-) – 2013-03-07 17:28:38