Suds消息缺少元素。Soapui从WSDL创建正确的消息

2024-03-28 13:23:00 发布

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

我在6、7年前的帖子中看到过与此相关的问题,但没有找到一个好的答案。DELV_NUM元素在WSDL中,但我相信它被标记为可选的,这是suds忽略它的原因。 我没有生成WSDL文件,无法对其进行更改。如果我可以修改suds消息使其看起来像Soapui消息,那么响应应该可以正常工作。我只限于修补和修改肥皂水,因为它是感应自动化点火平台的一部分。在

这是从suds发送的消息请求

enter image description here

这是来自Soapui的消息请求,使用相同的WSDL

enter image description here

如果有帮助的话,我可以共享WSDL。谢谢


Tags: 文件答案标记消息元素原因平台num
1条回答
网友
1楼 · 发布于 2024-03-28 13:23:00

为了将元素添加到请求中,可以使用客户端.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)

相关问题 更多 >