如何在Python中显示ZSI.ServiceProxy的出站和入站SOAP消息? [英] How to display outcoming and incoming SOAP message for ZSI.ServiceProxy in Python?

查看:134
本文介绍了如何在Python中显示ZSI.ServiceProxy的出站和入站SOAP消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在调用Web Service方法时,如何显示由ZSI.ServiceProxy生成的SOAP消息和Web Service的响应?

How to display a SOAP message generated by ZSI.ServiceProxy and a respond from a Web Service when a Web Service method is invoked?

推荐答案

以下是一些文档在ServiceProxy类上.构造函数接受tracefile参数,该参数可以是具有write方法的任何对象,因此看起来就像您想要的那样.从文档中修改示例:

Here is some documentation on the ServiceProxy class. The constructor accepts a tracefile argument which can be any object with a write method, so this looks like what you are after. Modifying the example from the documentation:

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中显示ZSI.ServiceProxy的出站和入站SOAP消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆