我正在编写一个快速工具来通过 SOAP API 提交作业。
我过去曾使用 Zeep 完成此操作,但在 WSDL 中使用 xsd 的这一端点似乎存在问题。
这是我到目前为止所拥有的(不包括基本的 zeep 导入):
client = Client("wsdl/create_works_orders_definition.wsdl")
with client.settings(strict=False, xml_huge_tree=True, xsd_ignore_sequence_order=True):
request = zeep.xsd.Element('SX3_XML_DOCUMENT',
zeep.xsd.ComplexType([
zeep.xsd.Sequence([
zeep.xsd.Element('SX3_HEADER',
zeep.xsd.ComplexType([
zeep.xsd.Element('API',zeep.xsd.String()),
zeep.xsd.Element('REQUESTOR',zeep.xsd.String()),
zeep.xsd.Element('REQUEST_USER',zeep.xsd.String()),
zeep.xsd.Element('REQUEST_PASSWORD',zeep.xsd.String()),
])
),
zeep.xsd.Element(
'SX3_BODY',
zeep.xsd.ComplexType([
zeep.xsd.Element('CreateWorksOrders',
zeep.xsd.ComplexType([
zeep.xsd.Element('ExternalReference',zeep.xsd.String()),
zeep.xsd.Element('PropertyReference',zeep.xsd.String()),
zeep.xsd.Element('WorkProgramme',zeep.xsd.String()),
zeep.xsd.Element('ContractorSite',zeep.xsd.String()),
zeep.xsd.Element('RaisedDateTime',zeep.xsd.String()),
zeep.xsd.Element('PriorityCode',zeep.xsd.String()),
zeep.xsd.Element('TargetDatetime',zeep.xsd.String()),
zeep.xsd.Element('LocationNotes',zeep.xsd.String()),
zeep.xsd.Element('AccessNotes',zeep.xsd.String()),
zeep.xsd.Element('AccessAm',zeep.xsd.String()),
zeep.xsd.Element('AccessPm',zeep.xsd.String()),
zeep.xsd.Element('WoDescription',zeep.xsd.String()),
])
),
])
),
])
])
)
request_body = request(SX3_HEADER={'API':'','REQUESTOR':'','REQUEST_USER':'','REQUEST_PASSWORD':''},
SX3_BODY={'ExternalReference': '',
'PropertyReference':'',
'WorkProgramme':'',
'ContractorSite':'',
'RaisedDateTime': '',
'PriorityCode':'',
'TargetDatetime': '',
'LocationNotes':'',
'AccessNotes':'',
'AccessAm':'',
'AccessPm':'',
'WoDescription':''})
create = client.service.CreateWorksOrders(
request_body,
)
当我尝试测试时,出现以下错误:
ComplexType() got an unexpected keyword argument 'ContractorSite'. Signature: `CreateWorksOrders: {ExternalReference: xsd:string, PropertyReference: xsd:string, WorkProgramme: xsd:string, ContractorSite: xsd:string, RaisedDateTime: xsd:string, PriorityCode: xsd:string, TargetDatetime: xsd:string, LocationNotes: xsd:string, AccessNotes: xsd:string, AccessAm: xsd:string, AccessPm: xsd:string, WoDescription: xsd:string}`
wsdl 在这里:https://drive.google.com/file/d/1NIfMqiWCsOGP9rXHTmbecKABAYMw3D4J/view?usp=sharing
太长了,所以我不想复制并粘贴整个内容。
有人可以指出我正确的方向吗?
提前致谢
抱歉,我发消息很晚了,这不是您问题的答案,但我只想问一下,您到底在哪里找到了该文件的 WSDL 文件?我相信您正在开发 Sx3 Housing 集成,我正在拼命寻找相关文档。任何帮助将不胜感激!