python equivalent of VB code sample

M

mirandacascade

Situation is this:
1) must write application that does the following:
a) creates an xml document, the contents of which, is a request
transaction
b) send xml document to destination; I am assuming that a process
at destination side processes the request and sends back a response
c) the application I'm writing must receive response and then
examine contents of response
2) hope to write client application in python
3) was provided VB code sample that does steps 1a, 1b and 1c; the
sample code is:

' <section of code that builds the string sXML; the contents of which
is a request transaction>
set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
'Bank table image address field, location of Comm Admin.
sServer = Session("ImageAddress")
'NT AUTH
' note: I believe the next 2 lines in this post are really one line in
VB code that wrapped
' because they didn't fit on one line in the post
objXML.open
"POST",sServer,false,Session("WebServerUserAuth"),Session("WebServerPassword")
objXML.send sXML
sXMLRs = objXML.responseText

It appears as though much of the work is handled within methods and
properties of the objXML object:
a) the open method appears to establish the connection with the
destination side
b) the send method appears to handle both sending the request and not
returning control back to program until a response has been provided
c) the .responseText property appears to be the contents of the
response

My questions are:
1) is it possible to develop a python script that does the equivalent
of the code sample above?
2) is the code sample above an example of what's referred to as an
'HTTP POST'?
3) I looked in the python documentation that describes urllib, urllib2
and httplib; am I looking in the right place?
4) are there other places I should be looking, particularly if I am
seeking samples of python code that are functionally similar to the
sample code above?
 
B

bruno at modulix

Situation is this:
1) must write application that does the following:
a) creates an xml document, the contents of which, is a request
transaction
b) send xml document to destination; I am assuming that a process
at destination side processes the request and sends back a response
c) the application I'm writing must receive response and then
examine contents of response
2) hope to write client application in python
3) was provided VB code sample that does steps 1a, 1b and 1c; the
sample code is:

' <section of code that builds the string sXML; the contents of which
is a request transaction>
set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
'Bank table image address field, location of Comm Admin.
sServer = Session("ImageAddress")
'NT AUTH
' note: I believe the next 2 lines in this post are really one line in
VB code that wrapped
' because they didn't fit on one line in the post
objXML.open
"POST",sServer,false,Session("WebServerUserAuth"),Session("WebServerPassword")
objXML.send sXML
sXMLRs = objXML.responseText

This code is dealing with XMLHTTP request.
 
M

mirandacascade

Thank you for pointing me in the direction of XMLHTTP. I'm still
thinking about this in terms of creating a python script that is
functionally equivalent to the VB code in the original post. The
information I reviewed about XMLHTTP makes me think that it may be
possible to use the win32com.client to provide the python script with
the same methods and properties that the VB program is using.

Is win32com.client what I should be using? The Dispatch method of
win32com.client?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,833
Latest member
BettyeMacf

Latest Threads

Top