This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Microsoft XML > September 2005 > MSXML Error 8000000a





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author MSXML Error 8000000a
JimSantiago

2005-09-13, 7:46 pm

Hi all,

I'm using MSXML4 sp2 in a VB6 app, and I'm encountering this error:

error '8000000a' The data necessary to
complete this operation is not yet available.

when this property is accessed, with readyState 3:

Public Property Get Downloaded() As Long
If oX.readyState = 3 Then
On Error GoTo oXError
Downloaded = Len(oX.responseBody)
ElseIf oX.readyState = 4 Then
Downloaded = nFileSize
Else
Downloaded = 0
End If

GoTo oXDone

oXError:
Downloaded = -1
oXDone:
End Property



In the docs it says:
readyState (3) INTERACTIVE Some data has been received. You can call
responseBody and responseText to get the current partial results.

So I figured it was legal. Is there a way around this?

Thanks

Alex Krawarik [MSFT]

2005-09-13, 11:21 pm

The underlying object is a Stream, so I don't believe you have access to
responseText (et al) until readyState is 4. The exception you see bears this
out.

hth, Alex


"JimSantiago" <JimSantiago@discussions.microsoft.com> wrote in message
news:5D94408B-2E0F-42A5-AEB9-057AEF997588@microsoft.com...
> Hi all,
>
> I'm using MSXML4 sp2 in a VB6 app, and I'm encountering this error:
>
> error '8000000a' The data necessary to
> complete this operation is not yet available.
>
> when this property is accessed, with readyState 3:
>
> Public Property Get Downloaded() As Long
> If oX.readyState = 3 Then
> On Error GoTo oXError
> Downloaded = Len(oX.responseBody)
> ElseIf oX.readyState = 4 Then
> Downloaded = nFileSize
> Else
> Downloaded = 0
> End If
>
> GoTo oXDone
>
> oXError:
> Downloaded = -1
> oXDone:
> End Property
>
>
>
> In the docs it says:
> readyState (3) INTERACTIVE Some data has been received. You can call
> responseBody and responseText to get the current partial results.
>
> So I figured it was legal. Is there a way around this?
>
> Thanks
>



JimSantiago

2005-09-13, 11:21 pm

Thanks for the reply Alex.

The only thing that makes me question what you wrote is the MSXML4 docs
which say:
---
(3) INTERACTIVE Some data has been received. You can call responseBody and
responseText to get the current partial results.
---
But every time I try to access responseBody/responseText/responseStream with
readyState = 3, I get the error.

Maybe it's because I'm using VB instead of C/C++


"Alex Krawarik [MSFT]" wrote:

> The underlying object is a Stream, so I don't believe you have access to
> responseText (et al) until readyState is 4. The exception you see bears this
> out.
>
> hth, Alex
>
>
> "JimSantiago" <JimSantiago@discussions.microsoft.com> wrote in message
> news:5D94408B-2E0F-42A5-AEB9-057AEF997588@microsoft.com...
>
>
>

Han

2005-09-14, 4:21 am

Cases are you saw wrong part of document. The comment is related with
serverXmlHttp. On the other hand, with iXmlHttpRequest,

(3) INTERACTIVE
Some data has been received. Calling the responseBody and responseText
properties at this state to obtain partial results will return an error,
because status and response headers are not fully available.


--
Pohwan Han. Seoul. Have a nice day.
"JimSantiago" <JimSantiago@discussions.microsoft.com> wrote in message
news:1516A25F-1399-4B5B-B8EB-1A434EE9014B@microsoft.com...[color=darkred]
> Thanks for the reply Alex.
>
> The only thing that makes me question what you wrote is the MSXML4 docs
> which say:
> ---
> (3) INTERACTIVE Some data has been received. You can call responseBody and
> responseText to get the current partial results.
> ---
> But every time I try to access responseBody/responseText/responseStream
> with
> readyState = 3, I get the error.
>
> Maybe it's because I'm using VB instead of C/C++
>
>
> "Alex Krawarik [MSFT]" wrote:
>

JimSantiago

2005-09-14, 4:21 am

mm...sorry for not specifying - I am using ServerXMLHTTP objects.

Here's the class I'm writing:
======
Private oX As ServerXMLHTTP40
Private sF As String
Private sU As String
Private dStart As Date
Private nFileSize As Long

Private Sub Class_Initialize()
nFileSize = 0
Set oX = New ServerXMLHTTP40
End Sub

Private Sub Class_Terminate()
Set oX = Nothing
End Sub

Public Property Get SX() As ServerXMLHTTP
Set SX = oX
End Property

Public Property Get File() As String
File = sF
End Property

Public Property Let File(vNewValue As String)
sF = vNewValue
End Property

Public Property Get URL() As String
URL = sU
End Property

Public Property Let URL(sURL As String)
sU = sURL
End Property

Public Property Get Started() As Date
Started = dStart
End Property

Public Property Get Size() As Long
Size = nFileSize
End Property

Public Property Get Downloaded() As Long
If oX.readyState = 3 Then
On Error GoTo oXError
Downloaded = Len(oX.responseBody) ' this line don't work
ElseIf oX.readyState = 4 Then
Downloaded = nFileSize
Else
Downloaded = 0
End If

GoTo oXDone

oXError:
Downloaded = -1
oXDone:
End Property

Public Sub Start()

oX.open "HEAD", sU, True
oX.send

Do While oX.readyState <> 4
DoEvents
Loop

nFileSize = CLng(oX.getResponseHeader("Content-Length"))

oX.open "GET", sU, True
oX.send

End Sub
========
"Han" wrote:

> Cases are you saw wrong part of document. The comment is related with
> serverXmlHttp. On the other hand, with iXmlHttpRequest,
>
> (3) INTERACTIVE
> Some data has been received. Calling the responseBody and responseText
> properties at this state to obtain partial results will return an error,
> because status and response headers are not fully available.
>
>
> --
> Pohwan Han. Seoul. Have a nice day.
> "JimSantiago" <JimSantiago@discussions.microsoft.com> wrote in message
> news:1516A25F-1399-4B5B-B8EB-1A434EE9014B@microsoft.com...
>
>

Han

2005-09-14, 4:21 am

OK. I could reproduce your error with VBScript in HTA application(below). I
saw that just accessing the responseBody raises error. Strange is that same
code with Javascript doesn't raise error. alert(typeof(sxh.responseBody)); I
bet this is a bug or poor documentation.

<html>
<head>

<script language='vbscript'>
dim sxh

function load1()
set sxh=createobject("msxml2.serverXmlhttp.4.0")
sxh.onreadystatechange=getRef("httpready")
sxh.open "get", "http://localhost/x.asp", true
sxh.send
end function

function httpready()
if (sxh.readyState=3) then 'when 4, result is bytearray().
msgbox typename(sxh.responseBody)
end if
end function

</script>

</head>
<body onload='load1'>
<div id='d'></div>

--
Pohwan Han. Seoul. Have a nice day.
"JimSantiago" <JimSantiago@discussions.microsoft.com> wrote in message
news:2CC6C80E-C679-4E5B-9614-D4B14B711AA9@microsoft.com...[color=darkred]
> mm...sorry for not specifying - I am using ServerXMLHTTP objects.
>
> Here's the class I'm writing:
> ======
> Private oX As ServerXMLHTTP40
> Private sF As String
> Private sU As String
> Private dStart As Date
> Private nFileSize As Long
>
> Private Sub Class_Initialize()
> nFileSize = 0
> Set oX = New ServerXMLHTTP40
> End Sub
>
> Private Sub Class_Terminate()
> Set oX = Nothing
> End Sub
>
> Public Property Get SX() As ServerXMLHTTP
> Set SX = oX
> End Property
>
> Public Property Get File() As String
> File = sF
> End Property
>
> Public Property Let File(vNewValue As String)
> sF = vNewValue
> End Property
>
> Public Property Get URL() As String
> URL = sU
> End Property
>
> Public Property Let URL(sURL As String)
> sU = sURL
> End Property
>
> Public Property Get Started() As Date
> Started = dStart
> End Property
>
> Public Property Get Size() As Long
> Size = nFileSize
> End Property
>
> Public Property Get Downloaded() As Long
> If oX.readyState = 3 Then
> On Error GoTo oXError
> Downloaded = Len(oX.responseBody) ' this line don't work
> ElseIf oX.readyState = 4 Then
> Downloaded = nFileSize
> Else
> Downloaded = 0
> End If
>
> GoTo oXDone
>
> oXError:
> Downloaded = -1
> oXDone:
> End Property
>
> Public Sub Start()
>
> oX.open "HEAD", sU, True
> oX.send
>
> Do While oX.readyState <> 4
> DoEvents
> Loop
>
> nFileSize = CLng(oX.getResponseHeader("Content-Length"))
>
> oX.open "GET", sU, True
> oX.send
>
> End Sub
> ========
> "Han" wrote:
>

JimSantiago

2005-09-15, 7:39 pm

I think so too

Thanks for your help Han.

"Han" wrote:

> OK. I could reproduce your error with VBScript in HTA application(below). I
> saw that just accessing the responseBody raises error. Strange is that same
> code with Javascript doesn't raise error. alert(typeof(sxh.responseBody)); I
> bet this is a bug or poor documentation.
>
> <html>
> <head>
>
> <script language='vbscript'>
> dim sxh
>
> function load1()
> set sxh=createobject("msxml2.serverXmlhttp.4.0")
> sxh.onreadystatechange=getRef("httpready")
> sxh.open "get", "http://localhost/x.asp", true
> sxh.send
> end function
>
> function httpready()
> if (sxh.readyState=3) then 'when 4, result is bytearray().
> msgbox typename(sxh.responseBody)
> end if
> end function
>
> </script>
>
> </head>
> <body onload='load1'>
> <div id='d'></div>
>
> --
> Pohwan Han. Seoul. Have a nice day.
> "JimSantiago" <JimSantiago@discussions.microsoft.com> wrote in message
> news:2CC6C80E-C679-4E5B-9614-D4B14B711AA9@microsoft.com...
>
>

Alex Krawarik [MSFT]

2005-09-15, 7:39 pm

I've confirmed this is a bug in MSXML3. I tested MSXML3SP3, MSXML3SP5 and
MSXML3SP8 and the behavior is the same in all flavors for both XMLHTTP and
ServerXMLHTTP, in that the buffer is not accessible in async calls at
readystate 3.

(If anyone has a working example, I would sure love to see it!)

I did see the same thing in javascript, by the way, here is some sample
code. Note you need subtle things like "= =" and "load1()" in javascript.

<html>
<head>
<script language='javascript'>
var sxh;
function load1() {
sxh = new ActiveXObject("msxml2.ServerXmlhttp.3.0");
sxh.onreadystatechange = httpready;
sxh.open ("GET", "http://localhost/Tests/msxml/248109/ngmsg2.xml", true);
sxh.send();
}
function httpready() {
if (sxh.readyState == 4) {
alert(sxh.responseText.length);
}
if (sxh.readyState == 3) {
alert(sxh.responseText.length);
}
return true;
}
</script>
</head>
<body onload='load1()'>
<div id='d'></div>

[color=darkred]


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews