Re: Parsing SOAP XML with Classic ASP
Quote:
Originally Posted by
2kaud
Which line is causing the error?
Sorry, same line.
Re: Parsing SOAP XML with Classic ASP
Quote:
Originally Posted by
Arjay
If objDoc.GetElementsByTagName("Status") doesn't find any objects, then attempting to access the first object in a list (with item(0)) is going to result in an error. You need to check if isSuccess is null and isSuccess.item is null (or has values).
OK, I follow. How do you suggest I write that? Please keep in mind that this is not a language I'm used to dealing with, so the most specific answer possible would be most helpful.
Re: Parsing SOAP XML with Classic ASP
Which version of my suggestions in post #12 are you trying? If the first suggestion and the error line is still the one containing .GetElementsByTagName() then there is still an issue with .GetElementsByTagName().
If you are using the second suggestion, then try using the first and see if the error moves to the if statement.
Re: Parsing SOAP XML with Classic ASP
Quote:
Originally Posted by
Auciker
OK, I follow. How do you suggest I write that? Please keep in mind that this is not a language I'm used to dealing with, so the most specific answer possible would be most helpful.
I don't code in this language either, but it's probably something like:
Code:
isSuccess = objDoc.getElementsByTagName("Status")
...
If isSuccess = Null AND isSuccess.item(0).text = "Success" Then
Not sure the syntax of how to check for null and do an AND statement, but that is the gist of it.
Re: Parsing SOAP XML with Classic ASP
A sister site to this one has a forum for ASP and VBScript. You might like to try posting there
http://www.vbforums.com/forumdisplay...-ASP-VB-Script
Re: Parsing SOAP XML with Classic ASP
Quote:
Originally Posted by
2kaud
Which version of my suggestions in post #12 are you trying? If the first suggestion and the error line is still the one containing .GetElementsByTagName() then there is still an issue with .GetElementsByTagName().
If you are using the second suggestion, then try using the first and see if the error moves to the if statement.
I've tried the first suggestion. Moving it to the second line won't work, as it has to get passed line 66 (fatal error line) to get to the "fixed" line on 68.
Code:
Microsoft VBScript runtime error '800a01a8'
Object required: '[object]'
/inc/verify.asp, line 66
Line 66 currently reads:
Code:
isSuccess = objDoc.getElementsByTagName("Status").item(0).text
Re: Parsing SOAP XML with Classic ASP
Quote:
Originally Posted by
Arjay
I don't code in this language either, but it's probably something like:
Code:
isSuccess = objDoc.getElementsByTagName("Status")
...
If isSuccess = Null AND isSuccess.item(0).text = "Success" Then
Not sure the syntax of how to check for null and do an AND statement, but that is the gist of it.
The change you're recommending is on line 68, but the code stops at line 66.
Re: Parsing SOAP XML with Classic ASP
Quote:
Originally Posted by
2kaud
I just did so, thanks for the direction!
Re: Parsing SOAP XML with Classic ASP
Try changing line 66 to
Code:
isSuccess = objDoc.getElementsByTagName("Status")
Does the error move to a different line or stay on line 66?
Re: Parsing SOAP XML with Classic ASP
Quote:
Originally Posted by
2kaud
Try changing line 66 to
Code:
isSuccess = objDoc.getElementsByTagName("Status")
Does the error move to a different line or stay on line 66?
I did try that early on, but it gave the following error:
Code:
Microsoft VBScript runtime error '800a01c2'
Wrong number of arguments or invalid property assignment
/inc/verify.asp, line 66
I just tried it again with the same results.
Re: Parsing SOAP XML with Classic ASP
Quote:
Originally Posted by
Auciker
The change you're recommending is on line 68, but the code stops at line 66.
Fantastic, is objDoc null?
Re: Parsing SOAP XML with Classic ASP
Quote:
Originally Posted by
Arjay
Fantastic, is objDoc null?
No, it should exist and be carrying the value "Success". This is the case in the API client I have successfully tested. I set an If/Else statement that if it returns any answer that does not include
Code:
<Status>Success</Status>
it is taken as a failed authentication and should redirect to the login#error page. This should include null.
Re: Parsing SOAP XML with Classic ASP
Quote:
Originally Posted by
Auciker
No, it should exist and be carrying the value "Success". This is the case in the API client I have successfully tested. I set an If/Else statement that if it returns any answer that does not include
Code:
<Status>Success</Status>
it is taken as a failed authentication and should redirect to the login#error page. This should include null.
You need to check to make sure what you think is getting loaded into the DOM is actually getting loaded. Back up and write out the strReturn value to the screen before loading the xmldoc.
Code:
Response.Write "<p>" + strReturn + "</p>"
Btw, I found a website where you can test script online. I was able to get something working in javascript, but not in VBScript. In fact, the VBScript samples on the site wouldn't work in my IE11 browser.
See http://www.xmlfiles.com/dom/dom_access.asp