Feb-05-2019, 05:35 PM
I'm calling a webmethod that has been around for a while. When hitting localhost, all is fine and I get a 200 response. Here is soap envelope:
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetAccountInfo"
<?xml version="1.0" encoding="utf-8"?>
<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/">
<soap:Body>
<GetAccountInfo xmlns="http://tempuri.org/">
<signinID>string</signinID>
<password>string</password>
</GetAccountInfo>
</soap:Body>
</soap:Envelope>
Now when the python code attempts to hit the hosted url, I am getting a 404 response. Here is the python side code I am using:
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetAccountInfo"
<?xml version="1.0" encoding="utf-8"?>
<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/">
<soap:Body>
<GetAccountInfo xmlns="http://tempuri.org/">
<signinID>string</signinID>
<password>string</password>
</GetAccountInfo>
</soap:Body>
</soap:Envelope>
Now when the python code attempts to hit the hosted url, I am getting a 404 response. Here is the python side code I am using:
def api_login(self, username, password): parameters = {'signinID': username, 'password': password} args = urllib.urlencode(parameters) request = urllib2.Request(self.ApiLoginCheck+"/GetAccountInfo", args) request.add_header("Content-Type", "application/x-www-form-urlencoded;charset=utf-8") request.add_header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.81 Safari/537.36") response = urllib2.urlopen(request) self.last_response_code = response.code self.last_response_content = response.read().decode('utf-8') if response.code == 200: print(response) print(self.last_response_content) root = ET.fromstring(self.last_response_content) xmlns = {'t': 'http://tempuri.org/'} emails = root.findall('.//t:accountEmail', namespaces=xmlns) for email in emails: print(email) if email.text == '' or email.text == None: return 0 else: return 1 else: return 0