I need help to know if I am generating the calls to a Soap API correctly.
I'm using the python zeep library which is supposed to be used for this but I'm not quite sure how it works either.
The thing is that this API needs a SOAP header that I get like this:
cabecera = client.get_type('ns0:AuthHeader')
cabeza_valores = cabecera(login='login',pwd='contraseña',
Id_CodFacturacion='Codigo',
Nombre_Cargue='Prueba')
According to what I have read in the documentation, it should be generated like this.
On the other hand, I must generate an order, which I do in the same way. When calling the service I call it like this:
resultado=client.service.CargueMasivoExterno(_soapheaders[cabeza_valores],envios=datos)
And this returns an array with a field False
, referring to the fact that the call has not been done correctly, and returns all the data.
I need to be able to somehow print the XML that it generates for me to know how it is being laid out and sent.
The correct answer to your question is in the following Link , there it is explained how to generate the xml and return it to view.