2
Hello, I have a wsdl (https://ws1.bmgconsig.com.br/webservices/SaqueComplementar?wsdl) and need to make requisitions, but do not know how to do the treatment of headers and body based on wsdl.
the header:
{'Date': 'Thu, 04 Apr 2019 12:17:42 GMT', 'Content-Type': 'text/xml;charset=utf-8', 'Vary': 'Accept-Encoding', 'Content-Encoding': 'gzip', 'Connection': 'close', 'Transfer-Encoding': 'chunked'}
my code:
url = 'https://ws1.bmgconsig.com.br/webservices/SaqueComplementar?wsdl'
headers = {'input name': 'buscarLimiteSaqueRequest'}
params = {informações de login, senha e parâmetros necessários}
r = requests.post(url, headers=headers, data=params )
returns:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.2.15 (Red Hat) Server at slap443.bancobmg.com.br Port 80</address>
</body></html>
I don’t know if headers are set right. I’ve read all the requests documentation, but it gives many examples in json(), but this wsdl does not provide support.
If I don’t put headers, return:
<soapenv:Body>
<soapenv:Fault>
<faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
<faultstring>no SOAPAction header!</faultstring>
<detail>
<ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">slap443.bancobmg.com.br</ns2:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
I already used the Zeep framework and it worked, however it is VERY slow, I believe that using 'requests' I get a better performance.