通过简单的逻辑表达式使用suds从SOAP服务器请求对象

2024-05-08 20:18:00 发布

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

我刚接触过SOAP和suds库,我会解决我无法解决的问题。在

我有带SOAP接口的服务器。我需要下载它的所有对象,参数A是空的和参数B的其中B不为空。在

  • 有可能吗?在
  • SOAP(as protocol)允许这样的请求吗?在
  • suds提供这种请求吗?在

我有工作代码,比如:

import suds.transport.http
from suds.client import Client

trans = suds.transport.http.HttpAuthenticated(username=username,
                                              password=password)
__client = Client(url, transport=trans)
modelthing = __client.factory.create(soap_data_type)
modelthing.instance.A = '5'
modelthing.instance.B = '7'
func = __client.service.__getattr__('ExistingFunctionRetrievesListofObjects')
func(modelthings)

它返回A=5和B=7的所有对象的列表。工作完美。 但它只需要精确的参数,我不知道如何将B设置为“not empty”,也不知道如何将A设置为“empty”。在

我试过至少设置一个这样的方法:

^{pr2}$

然后它返回所有具有不同类型A的对象,好像我没有设置这个参数一样。在

我的任务有解决方案吗?有没有可能在SOAP中使用这种简单的逻辑?如果“是”的话,suds是否支持它?在


Tags: 对象instanceimportclienthttptrans参数username