-->

如何在Python显示outcoming和传入的SOAP消息ZSI.ServiceProxy?(Ho

2019-10-17 17:41发布

如何调用Web服务方法时,显示由ZSI.ServiceProxy并从Web服务响应生成的SOAP消息?

Answer 1:

下面是一些文档上用于ServiceProxy类。 构造函数接受一个tracefile可以是与任何对象参数write方法,所以这是不是您所追求的。 修改从文档的例子:

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()


文章来源: How to display outcoming and incoming SOAP message for ZSI.ServiceProxy in Python?