Problem with xmlhttp post 
Author Message
 Problem with xmlhttp post

I have and activex application that post some data from a webpage back to an
asp page on the server. This pages job is to read the xml data and update
the database.  I am doing the same thing in reverse to load the activex
control on the web page and it works fine.  I can't figure out why I am not
getting the post data.  I have a message box on the activex so I know that
obSteam.readtext is loaded and there is a file being created call got.txt
but it is always empty.

Activex Code to post the data

Dim xmlhttp As XMLHTTP30
Set xmlhttp = New XMLHTTP30
Dim objStream As ADODB.Stream
Set objStream = New ADODB.Stream
objStream.Mode = 3   ' Read/Write mode
objStream.Open
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Fields.Append "imageguid", adVarChar, 100
rs.Fields.Append "annotationblob", adVarChar, 10000
rs.Fields.Append "annotationText", adVarChar, 1000
rs.Open
rs.AddNew
rs!imageguid = m_imageid
rs!Annotationblob = hexdata
rs!AnnotationText = TextString
rs.Save objStream, adPersistXML
Call xmlhttp.Open("POST", "URL", False)
xmlhttp.setRequestHeader "Content-Type", "text/text"
'xmlhttp.send objStream.ReadText
rs.Close
Set rs = Nothing

ASP Page, just to verify the data is getting there

<%
if Request("REQUEST_METHOD")="POST" then
   dim oo
   set oo = createobject("Microsoft.XMLDOM")
   oo.async=false
   oo.LoadXml(Request.form)
   set fso = Server.CreateObject("Scripting.FileSystemObject")
   set fp = fso.OpenTextFile("C:\GOT.TXT",2,true)
   fp.write oo.documentElement.xml
   fp.close
end if
%>

Thanks in adance for your help



Mon, 20 Sep 2004 07:25:33 GMT  
 Problem with xmlhttp post
I think I helped you before, but I may be mistaken.

You need to use Request.BinaryRead(Request.TotalBytes) instead of
Request.form.

HTH,

Adam


Quote:
> I have and activex application that post some data from a webpage back to
an
> asp page on the server. This pages job is to read the xml data and update
> the database.  I am doing the same thing in reverse to load the activex
> control on the web page and it works fine.  I can't figure out why I am
not
> getting the post data.  I have a message box on the activex so I know that
> obSteam.readtext is loaded and there is a file being created call got.txt
> but it is always empty.

> Activex Code to post the data

> Dim xmlhttp As XMLHTTP30
> Set xmlhttp = New XMLHTTP30
> Dim objStream As ADODB.Stream
> Set objStream = New ADODB.Stream
> objStream.Mode = 3   ' Read/Write mode
> objStream.Open
> Dim rs As ADODB.Recordset
> Set rs = New ADODB.Recordset
> rs.CursorLocation = adUseClient
> rs.Fields.Append "imageguid", adVarChar, 100
> rs.Fields.Append "annotationblob", adVarChar, 10000
> rs.Fields.Append "annotationText", adVarChar, 1000
> rs.Open
> rs.AddNew
> rs!imageguid = m_imageid
> rs!Annotationblob = hexdata
> rs!AnnotationText = TextString
> rs.Save objStream, adPersistXML
> Call xmlhttp.Open("POST", "URL", False)
> xmlhttp.setRequestHeader "Content-Type", "text/text"
> 'xmlhttp.send objStream.ReadText
> rs.Close
> Set rs = Nothing

> ASP Page, just to verify the data is getting there

> <%
> if Request("REQUEST_METHOD")="POST" then
>    dim oo
>    set oo = createobject("Microsoft.XMLDOM")
>    oo.async=false
>    oo.LoadXml(Request.form)
>    set fso = Server.CreateObject("Scripting.FileSystemObject")
>    set fp = fso.OpenTextFile("C:\GOT.TXT",2,true)
>    fp.write oo.documentElement.xml
>    fp.close
> end if
> %>

> Thanks in adance for your help



Mon, 20 Sep 2004 10:07:07 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. need help from expert on xmlhttp post

2. how to xmlhttp to post a file

3. Simulating POST method for forms using XMLHTTP

4. xmlhttp: retrieve POSTed data within ASP

5. Can XMLHTTP be used to POST?

6. Posting data to server using Microsoft.XMLHTTP doesn't work? Anybody could help me?

7. Second Post - (First Post is Gone) - Please Help!!

8. Notifying users of a Posted message (at post time)

9. FAQ - frequently asked questions - vba - please read before posting - unofficial - June posting

10. FAQ - frequently asked questions - vba - please read before posting - unofficial - May posting

11. FAQ - Frequently asked questions - vba - Please read before posting - unofficial April post

12. FAQ = Frequently Asked Questions - vba - Please read before posting questions - unofficial - March posting

 

 
Powered by phpBB® Forum Software