Cómo mostrar y outcoming mensaje SOAP entrante para ZSI.ServiceProxy en Python?
-
19-09-2019 - |
Pregunta
¿Cómo mostrar un mensaje SOAP generada por ZSI.ServiceProxy y una respuesta personal a un servicio Web cuando se invoca un método de servicio Web?
Solución
Aquí hay alguna documentación en la clase ServiceProxy. El constructor acepta un argumento tracefile
que puede ser cualquier objeto con un método write
, por lo que este se parece a lo que está después. Modificar el ejemplo de la documentación:
from ZSI import ServiceProxy
import BabelTypes
import sys
dbgfile = open('dbgfile', 'w') # to log trace to a file, or
dbgfile = sys.stdout # to log trace to stdout
service = ServiceProxy('http://www.xmethods.net/sd/BabelFishService.wsdl',
tracefile=dbgfile,
typesmodule=BabelTypes)
value = service.BabelFish('en_de', 'This is a test!')
dbgfile.close()
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow