J
JuiceMan
Hi, i've been trying to access the my company's SOAP webservice with
no luck.
I'm using the httplib library.
This is my code:
from httplib import HTTP
from urllib import quote
# Establish SOAP data
SOAPdata = '<?xml version="1.0" encoding="utf-8"?>'
SOAPdata = '<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'
SOAPdata = SOAPdata + '\n <soap:Body>'
SOAPdata = SOAPdata + '\n <checkPassword
xmlns="COM.COAIR.WWW.Technology.CoWebServices.COWSEmployeeServiceCenter">'
SOAPdata = SOAPdata + '\n <employeeID>XXXXXX</employeeID>'
SOAPdata = SOAPdata + '\n <password>XXXXXX</password>'
SOAPdata = SOAPdata + '\n <accessCode>XXXXX</accessCode>'
SOAPdata = SOAPdata + '\n </checkPassword>'
SOAPdata = SOAPdata + '\n </soap:Body>'
SOAPdata = SOAPdata + '\n</soap:Envelope>'
postdata = quote(SOAPdata)
print "\n************************* OUTGOING SOAP
************************************"
print postdata
# Begin HTTP request
req = HTTP("insidecoair5")
req.putrequest("POST",
"/cowsemployeeservicecenter/cowsemployeeservicecenter.asmx")
req.putheader("Accept", "text/xml; charset=utf-8")
req.putheader("Content-Type", "text/xml; charset=utf-8")
req.putheader("Content-Legth", str(len(postdata)))
req.putheader("SOAPAction",
"COM.COAIR.WWW.Technology.CoWebServices.COWSEmployeeServiceCenter/checkPassword")
req.endheaders()
# Send SOAP body
req.send(postdata)
ec, em, h = req.getreply()
print "\n*************************** HTTP RESPONSE
**********************************"
print ec, em
print "\n*************************** HTTP HEADER RESPONSE
***************************"
print h
# get file-like object from HTTP response
# and print received HTML to screen
fd = req.getfile()
textlines = fd.read()
fd.close()
print "\n************************** INCOMING SOAP
***********************************"
print textlines
I get back a faultstring with a "THe root element is missing" error
I cant seem to see what im doing wrong. Any help would be greatly
appreciated.
no luck.
I'm using the httplib library.
This is my code:
from httplib import HTTP
from urllib import quote
# Establish SOAP data
SOAPdata = '<?xml version="1.0" encoding="utf-8"?>'
SOAPdata = '<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'
SOAPdata = SOAPdata + '\n <soap:Body>'
SOAPdata = SOAPdata + '\n <checkPassword
xmlns="COM.COAIR.WWW.Technology.CoWebServices.COWSEmployeeServiceCenter">'
SOAPdata = SOAPdata + '\n <employeeID>XXXXXX</employeeID>'
SOAPdata = SOAPdata + '\n <password>XXXXXX</password>'
SOAPdata = SOAPdata + '\n <accessCode>XXXXX</accessCode>'
SOAPdata = SOAPdata + '\n </checkPassword>'
SOAPdata = SOAPdata + '\n </soap:Body>'
SOAPdata = SOAPdata + '\n</soap:Envelope>'
postdata = quote(SOAPdata)
print "\n************************* OUTGOING SOAP
************************************"
print postdata
# Begin HTTP request
req = HTTP("insidecoair5")
req.putrequest("POST",
"/cowsemployeeservicecenter/cowsemployeeservicecenter.asmx")
req.putheader("Accept", "text/xml; charset=utf-8")
req.putheader("Content-Type", "text/xml; charset=utf-8")
req.putheader("Content-Legth", str(len(postdata)))
req.putheader("SOAPAction",
"COM.COAIR.WWW.Technology.CoWebServices.COWSEmployeeServiceCenter/checkPassword")
req.endheaders()
# Send SOAP body
req.send(postdata)
ec, em, h = req.getreply()
print "\n*************************** HTTP RESPONSE
**********************************"
print ec, em
print "\n*************************** HTTP HEADER RESPONSE
***************************"
print h
# get file-like object from HTTP response
# and print received HTML to screen
fd = req.getfile()
textlines = fd.read()
fd.close()
print "\n************************** INCOMING SOAP
***********************************"
print textlines
I get back a faultstring with a "THe root element is missing" error
I cant seem to see what im doing wrong. Any help would be greatly
appreciated.