如何设置suds模式位置,而wsdl不包含一个

时间:2015-05-07 22:25:09

标签: python soap xsd wsdl suds

我在python中使用suds库(版本4.0)作为soap客户端 wsdl中没有定义架构位置,但供应商给了我们一些xsd文件。 现在我试图为url和本地模式设置suds客户端。我能这样做吗? 我已经看到使用Import和ImportDoctor解释了很多东西,但我真的不明白它是否与我的情况有关。我想要这样的东西..

from suds.client import Client
url = "https://someurl?WSDL"
schemaLocation = "/some/local/Location/file.xsd"
client = Client(url,schemaLocation)

我知道这是错的,但我怎样才能实现这样的目标

1 个答案:

答案 0 :(得分:1)

您可以使用:

url = "/some/local/Location/file.xsd" #xsd local location
new_url = "https://someurl?WSDL" #service url
c = Client(url)
c.sd[0].service.setlocation(new_url)