Login  
Search All Forums
Dart Home | PowerTCP Web for ActiveX | Custom Development Reply | PowerTCP Web for ActiveX Topics | Forums   
AuthorForum: PowerTCP Web for ActiveX
Topic: DartWeb.Http Object and Content-Length
User883

Posts: 1
Member Since: 03/01/01
posted March 1, 2001 10:02 AM

I'm using the DartWeb.Http object, and am having a problem posting an xml request to my xml portal. I noticed that when I use the same request with the microsoft XMLHTTP object the byte count is one less than when I Post the same request with your object. I'm not sure, but it looks like that's the only difference, and their object works, and yours doesn't. I've used your tools for other HTTP requests, and have never had a problem, and am trying to convince our clients to use your tool, but I won't be able to if I can't get it to work on my XML portal. 

Here's a quick sample:

Set ReqHeaders = createobject("dart.dartstrings")
Set RespHeaders = createobject("dart.dartstrings")

sRequest = "<?xml version = ""1.0""?> <!DOCTYPE REQUEST SYSTEM ""http://www.localhost.com/XMLPortal/xml.dtd"">" & _
"<REQUEST version=""1.0"">" & _
"</REQUEST>"


ReqHeaders.Delimiter = vbCrLf
reqHeaders.add "Connection: Keep-Alive" & vbcrlf & _
"Content-Type: text/xml"

lsURL = "http://www.localhost.com/XMLPortal/XML.asp"

Set objWinSock = createobject("Dart.Http")

objWinSock.Url = lsURL

sResponse = ""

objWinSock.Post sRequest, ReqHeaders, sResponse, RespHeaders

msgbox(RespHeaders.all & vbcrlf & sResponse)


set HttpObj = createObject ("Microsoft.XMLHTTP")
HttpObj.open "POST", lsURL, false
HttpObj.setRequestHeader "Content-type", "text/xml"
HttpObj.send sRequest

msgbox(HttpObj.responseText)



Can you tell me why there's a difference in the byte count for Content-Length? I think it might be causing a problem with the Microsoft.FreeThreadedXMLDOM object I'm using. 

Thanks for your help

-Mike
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted March 1, 2001 10:33 AM


The byte count should be the length of sRequest.

Is that the case?

Thanks,

Tony Priest
Dart Tech Support

mikehill00

From: woburn, MA Albania
Posts: 4
Member Since: 03/28/01
posted March 28, 2001 1:02 PM

Sorry for the delay, I was waiting for an e-mail reply (my fault! ;-)
---
Anyhow, Here's an example where the length of sRequest is 14 and the web page gets a content header value of 15!


Set ReqHeaders = createobject("dart.dartstrings")
Set RespHeaders = createobject("dart.dartstrings")

sRequest = "THIS_IS_A_TEST"

ReqHeaders.Delimiter = vbCrLf

Set objWinSock = createobject("Dart.Http")
objWinSock.Url = "http://localhost/darttest.asp"
' darttest.asp = <%Response.write (Request.ServerVariables("ALL_RAW")%>
sResponse = ""

msgbox(len(sRequest))

objWinSock.Post sRequest, ReqHeaders, sResponse, RespHeaders

msgbox(RespHeaders.all & vbcrlf & sResponse)



I'm using NT Workstation running service pack 6a and PWS (but the same thing happens on our production IIS4.0 machine).

I'm currently using a workaround where my clients are posting data as www-url-form-encoded, but if there was a problem there as well, if they didn't add chr(0) to the end of the data stream that they sent, sometimes we'd get a random character on the server side... (I think in part becuase the content-length that IIS Recieves is wrong...) Thanks for your help (and I'll check the board later for a response! ;-)
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted March 28, 2001 1:18 PM


The server sends out the web page. The server adds the Content-Length line. I'm not sure what we are supposed to do about that.

Tony
mikehill00

From: woburn, MA Albania
Posts: 4
Member Since: 03/28/01
posted March 28, 2001 4:14 PM

Are you sure about that? I created a small application that simply listens on port 80, and this is the POST that came from that code I posted in my earlier message:

POST /darttest.asp HTTP/1.1
Accept: */*
Content-Type: application/x-www-form-urlencoded
Content-Length: 15
User-Agent: Dart Communications PowerTCP
Host: localhost
Connection: Keep-Alive

THIS_IS_A_TEST


To put it another way, if I use the MS XMLHTTP object, the content-length shows up as 14:

set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.Open "POST", "http://localhost/darttest.asp", false
xmlhttp.Send sRequest
msgBox xmlhttp.ResponseText

In this case response shows me a correct content-length of 14

Thanks,

Mike
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted March 28, 2001 4:44 PM


Using the shipping DLL and the following code:

Option Explicit

Private Sub Command1_Click()
  On Error GoTo OnError
  Command1.Enabled = False
  Http1.Url = "http://localhost:8080/darttest"
  Http1.Post "THIS_IS_A_TEST"
  
  GoTo Done
OnError:
  Debug.Print "ERROR #" + CStr(Err.Number) + ": " + Err.Description
Done:
  Command1.Enabled = True
End Sub

I received this:

POST /darttest HTTP/1.1
Accept: */*
Content-Type: application/x-www-form-urlencoded
Content-Length: 14
User-Agent: Dart Communications PowerTCP
Host: localhost:8080
Connection: Keep-Alive

THIS_IS_A_TEST

It seems OK to me.

Tony


mikehill00

From: woburn, MA Albania
Posts: 4
Member Since: 03/28/01
posted March 29, 2001 7:50 AM

Great! Can you tell me where I can get this "Shipping Dll" or confirm that I have the right version? It has been a while since I downloaded the software.

My DartSock.dll is version: 2.0.37.9
and DartWeb.dll is: 1.0.37.0

Thanks,

Mike
mikehill00

From: woburn, MA Albania
Posts: 4
Member Since: 03/28/01
posted March 29, 2001 8:17 AM

OK, it looks like the current version on your web site is 1.0.43. Will my current license work for that version?

Thanks,

Mike
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted March 29, 2001 9:19 AM


Yes, it will.

Tony
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted March 29, 2001 9:20 AM


Go to our main support page and follow the links from there.

Tony
Reply | PowerTCP Web for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX