同样的数据连接到多个使用 Zeep 的 wsdl 客户端时

huangapple go评论65阅读模式
英文:

Same data when connection to multiple wsdl clients using zeep

问题

我正在尝试使用zeep连接两个不同的wsdl,并打印操作。
当我连接到第一个客户端并打印时,我获得了正确的响应,但当我然后连接到第二个客户端时,我得到了相同的操作。

from zeep.client import Client

localDPClient = Client("http://localhost/StorageManager/?wsdl")
print([method for method, value in localDPClient.service.__dict__["_operations"].items()])

localDPClient2 = Client("http://localhost/CableBoxManager/?wsdl")
print([method for method, value in localDPClient2.service.__dict__["_operations"].items()])

输出

['ImportArtifacts', 'ImportBundles', 'ExportArtifacts', 'ExportBundles', 'ReadArtifactsFromTypes']
['ImportArtifacts', 'ImportBundles', 'ExportArtifacts', 'ExportBundles', 'ReadArtifactsFromTypes']

期望的输出

['ImportArtifacts', 'ImportBundles', 'ExportArtifacts', 'ExportBundles', 'ReadArtifactsFromTypes']
['IdentifyBox', 'IdentifyCable', 'ReadCable', 'ReadCableDefinition', 'ReadAllCableFeatures', 'ReadBox']
英文:

I'm trying to connect to two different wsdl's using zeep and printing the operations.
When I connect to the first client and print I get the correct respons, but when I then connect to the second I get the same operations.

I can get the data if I connect with one client, then restart the database and skip the first client and connect with the second.

from zeep.client import Client

localDPClient = Client("http://localhost/StorageManager/?wsdl")
print([method for method, value in localDPClient.service.__dict__["_operations"].items()])

localDPClient2 = Client("http://localhost/CableBoxManager/?wsdl")
print([method for method, value in localDPClient2.service.__dict__["_operations"].items()])

Output

['ImportArtifacts', 'ImportBundles', 'ExportArtifacts', 'ExportBundles', 'ReadArtifactsFromTypes']
['ImportArtifacts', 'ImportBundles', 'ExportArtifacts', 'ExportBundles', 'ReadArtifactsFromTypes']

Expected output

['ImportArtifacts', 'ImportBundles', 'ExportArtifacts', 'ExportBundles', 'ReadArtifactsFromTypes'
['IdentifyBox', 'IdentifyCable', 'ReadCable', 'ReadCableDefinition', 'ReadAllCableFeatures', 'ReadBox']

答案1

得分: 1

已解决:通过添加更多参数

localDPClient = Client("http://localhost/StorageManager/?wsdl", service_name="StorageManager", port_name=f"WSHttpBinding_IStorageManager")

localDPClient2 = Client("http://localhost/CableBoxManager/?wsdl", service_name="CableBoxManager", port_name=f"WSHttpBinding_ICableBoxManager")

英文:

Solved it by adding more parameters

localDPClient = Client("http://localhost/StorageManager/?wsdl", service_name="StorageManager", port_name=f"WSHttpBinding_IStorageManager")

localDPClient2 = Client("http://localhost/CableBoxManager/?wsdl", service_name="CableBoxManager", port_name=f"WSHttpBinding_ICableBoxManager")

huangapple
  • 本文由 发表于 2020年1月6日 17:45:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/59609807.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定