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

Python Suds消息缺少元素。Soapui从WSDL创建正确的消息,python,web-services,wsdl,suds,ignition,Python,Web Services,Wsdl,Suds,Ignition,我在6到7岁的帖子中看到过与此相关的问题,但没有找到好的答案。DELV_NUM元素在WSDL中,但我相信它被标记为可选的,这可能是suds忽略它的原因。 我没有创建WSDL文件,无法对其进行更改。如果我可以修改suds消息,使其看起来像Soapui消息,那么响应应该可以正常工作。我仅限于修补和修改肥皂水,因为它是感应自动化点火平台的一部分 这是从SUD发送的消息请求 这是来自Soapui的消息请求,使用相同的WSDL 如果有帮助的话,我可以共享WSDL。谢谢为了将元素添加到请求中,您可以使用

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

这是从SUD发送的消息请求

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


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

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

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