Question : XML Select Single Node returning nothing

Hi,

I'm writing a connector to Experian for a credit check. I did this in asp a few years ago and didn't have a problem. Now, I've updated the code as best I could and it's telling me that I don't have an object. My response is working, because I pull the full XML back from Experian. The main difference from the asp and the .net code is that I can't seem to figure out how to set async to false. I'm not sure if that's the problem or not - but it would make sense that my code is trying to run before it finishes loading the response.

I also have code to save the XML response to a text file, so I KNOW I'm getting it back.

Your help is greatly appreciated.

The last line of my code is where it's failing.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
'**************************************************************
            'MAKE THE CALL TO GET THE CREDIT SCORE
            'Try
            ' create an HttpWebRequest object to communicate with Experian
            objRequest = CType(WebRequest.Create(EcalsURL), HttpWebRequest)
            objRequest.Method = "POST"
            objRequest.ContentLength = post_string.Length
            objRequest.ContentType = "application/x-www-form-urlencoded"
            objRequest.Headers("Authorization") = "BASIC " & authorization_string


            ' post data is sent as a stream
            myWriter = Nothing
            myWriter = New StreamWriter(objRequest.GetRequestStream())
            myWriter.Write(post_string)
            myWriter.Close()

            ' returned values are returned as a stream, then read into a string
            objResponse = CType(objRequest.GetResponse(), HttpWebResponse)
            If objResponse.StatusCode = 200 Then
                responseStream = New StreamReader(objResponse.GetResponseStream())
                post_response = responseStream.ReadToEnd()
                responseStream.Close()

                objXML = New XmlDocument()
                objXML.LoadXml(post_response)

                Dim objStreamWriter As StreamWriter

                objStreamWriter = File.AppendText(Server.MapPath("Output.txt"))
                objStreamWriter.WriteLine(post_response)
                objStreamWriter.Close()

                myNode = objXML.SelectSingleNode("//CompletionCode")

                If Not myNode Is Nothing Then
...

Answer : XML Select Single Node returning nothing

Random Solutions  
 
programming4us programming4us