2012-07-01 125 views
-1

我想發佈一個XML到銀行。它返回我的XML響應。經典的asp和XML解析錯誤

我使用此代碼:

Function HTTPPost(sUrl, sRequest) 
    set oHTTP = CreateObject("Microsoft.XMLHTTP") 
    oHTTP.open "POST", sUrl,false 
    oHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 
    oHTTP.setRequestHeader "Content-Length", Len(sRequest) 
    oHTTP.send sRequest 
    HTTPPost = oHTTP.responseText 
End Function 

sonuc = HTTPPost(serviceUrl, requestXML) 
Dim objXMLDoc 
Set objXMLDoc = CreateObject("Microsoft.XMLDOM") 
objXMLDoc.async = False 
objXMLDoc.load(sonuc)   
Dim Node 
Set Node = objXMLDoc.documentElement.selectSingleNode("//RRN") 
Response.write Node.text 

我試圖找回

<RRN>218323000090</RRN>

與對象此錯誤的要求: 'documentElement'

這是銀行迴應:

<?xml version="1.0" encoding="utf-16"?> 
    <PosResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
     <Host> 
     <AuthCode /> 
     <RRN>218323000090</RRN> 
     <Date>0701</Date> 
     <Time>230834</Time> 
     <RC>58</RC> 
     </Host> 
     <Result> 
     <Code>58</Code> 
     <Text /> 
     <ErrorMessage /> 
     </Result> 
     <TrnxID>842c0d26-3abd-4597-ba10-d92674e16303</TrnxID> 
     <TrnxType>Sale</TrnxType> 
     <CustomData> 
     <Item Name="KazanilanPuan" Value="0" /> 
     <Item Name="KalanPuan" Value="0" /> 
     <Item Name="HarcananPuan" Value="0" /> 
     <Item Name="HarcananPara" Value="0" /> 
     </CustomData> 
    </PosResponse> 
+0

檢查是否你得到'sonuc' XML –

+0

sonuc是XML響應。 – user510886

回答