I am using the following function on a .as4 file from a public records site:
Private Function ReturnHTML(sURL)
Dim objXMLHTTP
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
objXMLHTTP.Open "GET", sURL, False
objXMLHTTP.Send
ReturnHTML = objXMLHTTP.responseText
set objXMLHTTP = nothing
End Function
I am only receiving the following:
VOLUSIA COUNTY 24 HOUR ARREST REPORT AS OF 07/22/2009
BOOKING # SEX/RACE/DOB
The complete file looks like below. Why am I only receiving only the first part of the file? What can I do to retrieve the whole file? Status is 200, readystate is 4.
VOLUSIA COUNTY 24 HOUR ARREST REPORT AS OF 07/22/2009
I think maybe you should change async to true when you create the object and put in some wait time and error handling. This is how I've done it.
Private Function ReturnHTML(sURL)
Dim objXMLHTTP
Set objXMLHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0")
objXMLHTTP.Open "GET", sURL, True
objXMLHTTP.Send
On Error Resume Next
'Wait for up to 15 seconds to receive the data.
If objXMLHTTP.ReadyState <> 4 Then
objXMLHTTP.WaitForResponse 15
End If
If (objXMLHTTP.ReadyState <> 4) Or (objXMLHTTP.Status <> 200) Then
'Abort the request.
objXMLHTTP.Abort
ReturnHTML = "Service Unavailable"
Else
ReturnHTML = objXMLHTTP.ResponseText
End If
End Function
Please remember to Mark as Answer if this answered your question.
I tried your code exactly as is, I've tried different variations over the last few days, I get the same result.
Seems the page is immediately giving me a readystate of 4, and I get the first portion of the file. I get the same exact result each time, and I'm wondering why.
I appreciate your input though, haven't found anyone yet who can tell me what is going wrong here.
It's interesting... I downloaded the .as4 file and opened it in a command line text editor on my Linux machine and I'm seeing an odd string of characters right where yours cuts off, but I don't see those characters in a graphical text editor. Right after
SEX/RACE/DOB, I see ^@^@^@^@^@^@^@^@^@^@^@. I don't see those characters anywhere else in the file, but I'd be willing to bet that is what's breaking it. I don't know off-hand if there is a way to interpret the file or those characters in a different way,
but I can take another look on Monday when I have an IIS installation to play around with.
Please remember to Mark as Answer if this answered your question.
I greatly appreciate the help. I don't have any linux experience, but I kind of suspected there was something in the file breaking it, but I didn't know how to find it. I'd tried notepad and it showed nothing. I'm not sure what .as4 files are best opened
in, but I'm guessing its created in a linux program and not in a windows environment.
I appreciate the help, I've been searching for help for days and everything I've seen has told me what I'm trying to do should be possible.
I would imagine the file is an IBM AS/400 file of some sort. If you could figure out what the content type of this file is or what character set it uses, you might be able to use something like this right after the objXMLHTTP.Open line...
I think the problem is that it is trying to interpret those characters and it doesn't know how to, so it just bails. If that is the case, you can't just replace those characters because it won't even read them, but if you can figure out how to make
it read those characters, that should get it working.
Please remember to Mark as Answer if this answered your question.
Marked as answer by Vince Xu - MSFT on Aug 07, 2009 10:04 AM
cnjmorris
0 Points
5 Posts
Partial Results With MSXML2.ServerXMLHTTP
Jul 31, 2009 04:10 PM|LINK
I am using the following function on a .as4 file from a public records site:
Private Function ReturnHTML(sURL)
Dim objXMLHTTP
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
objXMLHTTP.Open "GET", sURL, False
objXMLHTTP.Send
ReturnHTML = objXMLHTTP.responseText
set objXMLHTTP = nothing
End Function
I am only receiving the following:
VOLUSIA COUNTY 24 HOUR ARREST REPORT AS OF 07/22/2009
BOOKING # SEX/RACE/DOB
The complete file looks like below. Why am I only receiving only the first part of the file? What can I do to retrieve the whole file? Status is 200, readystate is 4.
VOLUSIA COUNTY 24 HOUR ARREST REPORT AS OF 07/22/2009
BOOKING # SEX/RACE/DOB CASE ACT-PROB
NAME(S) ARST-AGCY/LOCA/DIS SCHEDULE
ADDRESS JUDGE BOND-AMT
CHARGES
WS736013 F/W 060963 CTC0836625MMAES *
KOVACS,KATHERINE LOUISE VCSO/JABH/OAWS
1130 JOSEPHINE ST JDG: SCHUMANN,BELLE 0002500.00
NEW SMYRNA BCH FL 32168 C/6614XDQ 2 VOP DUI (SCHUMANN)
*02 C/4924FJS 8 VOP VIOL DL REST (SCH
*
*
--------------------------------------------------------------------------------
WS737168 F/W 031084 CTC0941646MMAES
ROBERTS,JENNIFER LEIGH SDPD/JABH/INFO
1280 HOLLAND BLVD JDG: FIELDS,DAWN 0000500.00
DELTONA FL 32738 M/DISORDERLY CONDUCT (BS)
--------------------------------------------------------------------------------
WS737202 F/W 061290 CTC0906886MMAWS
SynergyNT
Participant
1641 Points
355 Posts
Re: Partial Results With MSXML2.ServerXMLHTTP
Jul 31, 2009 08:29 PM|LINK
I think maybe you should change async to true when you create the object and put in some wait time and error handling. This is how I've done it.
Private Function ReturnHTML(sURL) Dim objXMLHTTP Set objXMLHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0") objXMLHTTP.Open "GET", sURL, True objXMLHTTP.Send On Error Resume Next 'Wait for up to 15 seconds to receive the data. If objXMLHTTP.ReadyState <> 4 Then objXMLHTTP.WaitForResponse 15 End If If (objXMLHTTP.ReadyState <> 4) Or (objXMLHTTP.Status <> 200) Then 'Abort the request. objXMLHTTP.Abort ReturnHTML = "Service Unavailable" Else ReturnHTML = objXMLHTTP.ResponseText End If End Functioncnjmorris
0 Points
5 Posts
Re: Partial Results With MSXML2.ServerXMLHTTP
Jul 31, 2009 09:09 PM|LINK
I tried your code exactly as is, I've tried different variations over the last few days, I get the same result.
Seems the page is immediately giving me a readystate of 4, and I get the first portion of the file. I get the same exact result each time, and I'm wondering why.
I appreciate your input though, haven't found anyone yet who can tell me what is going wrong here.
SynergyNT
Participant
1641 Points
355 Posts
Re: Partial Results With MSXML2.ServerXMLHTTP
Jul 31, 2009 11:52 PM|LINK
Can you post the URL you are using so I can see if I can figure out what's going wrong?
cnjmorris
0 Points
5 Posts
Re: Partial Results With MSXML2.ServerXMLHTTP
Aug 01, 2009 02:40 AM|LINK
Some forums don't allow that, wasn't sure if it was okay. Thanks.
http://www.clerk.org/inquiry/cr/arrest/ReportFiles/07262009.as4
SynergyNT
Participant
1641 Points
355 Posts
Re: Partial Results With MSXML2.ServerXMLHTTP
Aug 01, 2009 03:18 AM|LINK
It's interesting... I downloaded the .as4 file and opened it in a command line text editor on my Linux machine and I'm seeing an odd string of characters right where yours cuts off, but I don't see those characters in a graphical text editor. Right after SEX/RACE/DOB, I see ^@^@^@^@^@^@^@^@^@^@^@. I don't see those characters anywhere else in the file, but I'd be willing to bet that is what's breaking it. I don't know off-hand if there is a way to interpret the file or those characters in a different way, but I can take another look on Monday when I have an IIS installation to play around with.
cnjmorris
0 Points
5 Posts
Re: Partial Results With MSXML2.ServerXMLHTTP
Aug 01, 2009 03:39 AM|LINK
I greatly appreciate the help. I don't have any linux experience, but I kind of suspected there was something in the file breaking it, but I didn't know how to find it. I'd tried notepad and it showed nothing. I'm not sure what .as4 files are best opened in, but I'm guessing its created in a linux program and not in a windows environment.
I appreciate the help, I've been searching for help for days and everything I've seen has told me what I'm trying to do should be possible.
cnjmorris
0 Points
5 Posts
Re: Partial Results With MSXML2.ServerXMLHTTP
Aug 03, 2009 05:01 PM|LINK
Any idea how I might get around those odd characters that are breaking the file for me?
SynergyNT
Participant
1641 Points
355 Posts
Re: Partial Results With MSXML2.ServerXMLHTTP
Aug 03, 2009 05:51 PM|LINK
I would imagine the file is an IBM AS/400 file of some sort. If you could figure out what the content type of this file is or what character set it uses, you might be able to use something like this right after the objXMLHTTP.Open line...
I think the problem is that it is trying to interpret those characters and it doesn't know how to, so it just bails. If that is the case, you can't just replace those characters because it won't even read them, but if you can figure out how to make it read those characters, that should get it working.