python - 如何在 Python 中显示 ZSI.ServiceProxy 的传出和传入 SOAP 消息?

标签 python web-services zsi

如何在调用 Web 服务方法时显示 ZSI.ServiceProxy 生成的 SOAP 消息以及来自 Web 服务的响应?

最佳答案

这里有一些 documentation在 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()

关于python - 如何在 Python 中显示 ZSI.ServiceProxy 的传出和传入 SOAP 消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1497038/

相关文章:

python - Pandas 的合并返回名称后附加了 _x 的列

java - Java 客户端代码中的 Webwervice 安全 header

python - Python 中使用 ZSI 的 Web 服务客户端 - "Classless struct didn' t 获取字典”

python - 如何使用 Python 客户端在 Kubernetes 中附加交互式 shell

python - 使用 ndimage.maximum_filter 和 skimage.peak_local_max 查找图像峰值

java - API 中的部分更新

python - 使用 Python 和 SOAPpy 生成 WSDL

python - 如何知道 matplotlib 安装启用的功能?

web-services - 如何使用 JAX-WS 生成 WSDL 2.0