【问题标题】:Suds Message is missing Element. Soapui creates the correct message from the WSDLSuds 消息缺少元素。 Soapui 从 WSDL 创建正确的消息
【发布时间】:2016-06-08 03:26:31
【问题描述】:
我在 6 或 7 年前的帖子中看到过与此相关的问题,但没有找到好的答案。 DELV_NUM 元素在 WSDL 中,但我相信它被标记为可选,并且 mybe suds 忽略它的原因。
我没有制作 WSDL 文件,也无法对其进行更改。如果我可以将 suds 消息修改为像 Soapui 消息一样,则响应应该可以正常工作。我仅限于修补和修改 suds,因为它是 Inductive Automation 的 Ignition 平台的一部分。
这是suds发送的消息请求
这是来自 Soapui 使用相同 WSDL 的消息请求
如果有帮助,我可以分享 WSDL。谢谢
【问题讨论】:
标签:
python
web-services
wsdl
suds
ignition
【解决方案1】:
为了将元素添加到请求中,您可以使用 client.factory.create() 方法。
解决方案可以这样工作:
# Create a Processing_Req object
processing_req = client.factory.create('{http://wackerneuson.com/wn/in/Conveyor_Belt/ConveyorBeltProcessing}Processing_Req')
# Create a Record object which is a child of Processing_Req
record = client.factory.create('{http://wackerneuson.com/wn/if/Conveyor_Belt/ConveyorBeltProcessing}Processing_Req.record')
# set the DELV_NUM element which is a child of the record element.
record.DELV_NUM = '82934258'
# append the new record object to the processing_req object
processing_req.record.append(record)
# make the request with the new record object created and populated
request = client.service.Processing_OS(record)