Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML from VB6

Status
Not open for further replies.

croydon

Programmer
Apr 30, 2002
253
0
0
EU
I will shortly be starting a project that involves sending XML over HTTPS by the POST method. This is from a VB6 Windows application running on a normal PC.

I'm not really sure where to start, but looking at some threads it seems I need to use ServerXMLHTTP.

I don't understand how this will work in practice. For example, do I need to open IE to connect or is this done by ServerXMLHTTP?

Also, I believe POST generates a response. How do I receive this? Is it immediate or must I wait for it?

Sorry I'm vague, but any help would be appreciated.
 
For anyone that is interested, the following code overcomes the problem I had with the compressed XML.

It Sends the XML contained in the file named in strSend, then places the Response in the file named in strReceive as well as in the string XML_Send. The compressed XML is unzipped in the process so comes back as text:

Set xmlhttp = New MSXML2.XMLHTTP40
Set adostream = New ADODB.Stream

xmlhttp.Open "GET", strServer, False
xmlhttp.send

'Open a connection to the https url
xmlhttp.Open "POST", strServer, False

adostream.Open
adostream.Type = adTypeBinary
adostream.LoadFromFile strSend
filebytes = adostream.Read
adostream.Close

'Send the document request file
xmlhttp.send filebytes

'Get response
adostream.Open
adostream.Type = adTypeBinary
adostream.Position = 0
adostream.SetEOS
adostream.Write xmlhttp.responseBody
adostream.SaveToFile strReceive, adSaveCreateOverWrite
adostream.Close

XML_Send = xmlhttp.responseText
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top