将论点传递给SUDS客户声明

2024-09-30 22:22:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用sud(比如SOAP)来测试WSDL文件。这些方法包含链接到其他函数的类型。我不确定类型是如何存储在访问中的。下面是一些示例代码:

from suds.client import Client
client=Client('http://eample.wsdl')
print client

回应是:

^{pr2}$

我可以使用这些功能。我找不到任何关于如何在sud中测试函数的文档。我想测试函数是否工作并检查它们的返回值。有人知道怎么做吗?在

我使用下面的命令显示所有子函数。在

client.factory.create('AbsoluteMove.PTZSpeed.Speed.PanTilt')

我的主要问题是将值传递到函数中并获取返回值。在

我试图传递参数,但参数中存储了属性。下面显示了我尝试访问的参数结构的布局。在

(AbsoluteMove){
    ProfileToken = None
    Destination = 
      (PTZVector){
         PanTilt = 
            (Vector2D){
               _x = ""
               _y = ""
               _space = ""
            }
         Zoom = 
            (Vector1D){
               _x = ""
               _space = ""
            }
      }
   Speed = 
      (PTZSpeed){
         PanTilt = 
            (Vector2D){
               _x = ""
               _y = ""
               _space = ""
            }
         Zoom = 
            (Vector1D){
               _x = ""
               _space = ""

参数比输入简单的值要复杂得多。在


Tags: 函数client类型参数space测试函数speedsud
2条回答

尝试调用服务上的方法:

from suds.client import Client
client=Client('http://eample.wsdl')
res = client.service.AbsoluteMove(profile_token, destination, speed)
print res

您需要确定为AbsoluteMove方法的这些参数输入什么值。在

Client.factory.create用于实例化所使用服务内部的对象类型。如果你只是在做一个方法调用(看起来是这样),直接调用它。在

相关问题 更多 >