Login  
Search All Forums
Dart Home | PowerTCP Web Enterprise for ActiveX | Custom Development Reply | PowerTCP Web Enterprise for ActiveX Topics | Forums   
AuthorForum: PowerTCP Web Enterprise for ActiveX
Topic: HTTPS POST of XML data
User92

Posts: 2
Member Since: 08/07/01
posted April 22, 2002 1:25 PM

I just downloaded an evaluation version of the web enterprise tool, and I am attempting to send xml data to a secure server and retrieve the response. When I try this I repeatedly receive the message below:


The connection has been dropped because of a network failure or because the peer system failed to respond.


For testing purposes, I have a text box into which I am pasting the contents of an XML document, the from that text box I am building the Content of the WebASP 'control'.



Dim DataToSend As String
    DataToSend = TextBox1.Text

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

    Dim WebASP As New DartWebASP.WebASP()
    WebASP.Request.Url = "https://xml.techdata.com/xmlservlet"
    WebASP.Request.UrlPort = 443
    WebASP.Request.Header.Add(DartWebASP.HttpLabelConstants.httpContentType, "text/xml")
    WebASP.Request.Header.Add(DartWebASP.HttpLabelConstants.httpContentLength, DataToSend.Length)
    WebASP.Request.Content = DataToSend
    WebASP.Timeout = 30
    WebASP.Post()

    If WebASP.Response.Status = 200 Then

      ' good response from the server

      ' output response

      TextBox2.Text = WebASP.Response.Header.All

      TextBox2.Text = TextBox2.Text & WebASP.Response.Body.ReadString

    End If


Any ideas? What am I missing?
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted April 22, 2002 2:41 PM


Hi,
Yes, try:
WebASP1.Request.Body.Write DataToSend
Also, Timeout should be 30000 if you want 30 seconds, and the Content-Length header will be added automatically for you.
Hope this helps,
-ken

K M Drake
Dart Tech Support
User89

Posts: 1
Member Since: 04/22/02
posted April 22, 2002 9:12 PM

Thanks for the info. I did modify the code as shown below:


Dim DataToSend As String
    DataToSend = TextBox1.Text

    Dim WebASP1 As New DartWebASP.WebASP()
    WebASP1.Request.Url = "https://xml.techdata.com/xmlservlet"
    WebASP1.Request.UrlPort = 443
    WebASP1.Request.Header.Add(DartWebASP.HttpLabelConstants.httpContentType, "text/xml")
    WebASP1.Request.Content = DataToSend

    WebASP1.Timeout = 30000

    WebASP1.Request.Body.Write(DataToSend)
    Dim s As String
    TextBox2.Text = WebASP1.Response.Body.ReadString



Now it appears to be working, but the only response that I am getting is shown below:

Accept: */*
User-Agent: PowerTCP Web Enterprise Tool
Content-Length: 0


I have verified with the administrator of the remote server that the XML text is correct, so I am really stumped. Am I missing something obvious?


Regards,

John Nelson
K M Drake



From: Utica, NY USA
Posts: 3406
Member Since: 07/14/00
posted April 23, 2002 9:33 AM


Hi John,
Try removing the line:
WebASP1.Request.Content = DataToSend
When you do that, the entire contents of the Request are replaced, which means your Content-Type header is being removed.
In case you were not aware, the control includes a Trace method, which you can use to see exactly what is being sent and received by the control, and help in your debugging effort.
-ken

K M Drake
Dart Tech Support
Reply | PowerTCP Web Enterprise for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX