我以前从未使用过SOAP,现在我正试图跟随this tutorial来了解荷兰政府土地登记处的SOAP服务(卡达斯特.nl)公司名称:
>>> from SOAPpy import WSDL
>>> server = WSDL.Proxy('http://www1.kadaster.nl/1/schemas/kik-inzage/20141101/verzoekTotInformatie-2.1.wsdl')
/Library/Python/2.7/site-packages/wstools/XMLSchema.py:1280: UserWarning: annotation is ignored
warnings.warn('annotation is ignored')
/Library/Python/2.7/site-packages/wstools/XMLSchema.py:1217: UserWarning: Not keeping schema component.
warnings.warn("Not keeping schema component.")
>>> server.methods.keys()
[u'VerzoekTotInformatie']
>>> callInfo = server.methods['VerzoekTotInformatie']
>>> callInfo.inparams[0].name
u'body'
>>> callInfo.inparams[0].type
(u'http://www.kadaster.nl/schemas/kik-inzage/20141101', u'VerzoekTotInformatieRequest')
所以我现在明白了,我需要用VerzoekTotInformatieRequest
类型的消息调用方法VerzoekTotInformatie
(转换为RequestForInformation)。在
但从这里我有点迷路了。如何构造这样一个VerzoekTotInformatieRequest
?我如何进一步反省这一点?在
如有任何关于如何从这里着手的建议,我们将不胜感激。在
如果我应该使用另一个库(但我更喜欢Python),那也没问题。我读到了关于suds的好消息,但是因为它没有提交for over 3 years,所以我认为它是放弃软件。我还尝试了pysimplesoap,它看起来不错,但我不知道如何使用它来反省SOAP服务。在
你对这一点的看法是正确的。但是,我首先要使用SOAP客户机工具来研究WSDL,以了解它的结构和引用。当您查看WSDL时,请注意在名为
verzoekTotInformatie-2.1.xsd
的引用的.xsd
模式中如何定义类型。然后,此架构引用并包含20个其他架构文件:High-res image - click here.
显然,在您的情况下,仅仅通过自己阅读来跟踪所有事情会变成一场噩梦(无论如何,WSDL对于人类的阅读并不是有意的,但是您的WSDL是非常非常非常嵌套的)。在
因此,我建议您在SOAP UI(它是免费的,这是我在上面的屏幕截图中使用的)中导入这个WSDL,并使用WSDL url创建一个新项目:
http://www1.kadaster.nl/1/schemas/kik-inzage/20141101/verzoekTotInformatie-2.1.wsdl
它将导入所有内容并为您创建一个示例请求。对我来说,它甚至试图根据字段类型添加一些lorem ipsum示例数据:
导入所有内容后,您可以展开项目,然后右键单击绑定
VezorekToInformatieBinding
,然后选择Show Interface Viewer
来探索任何需要进一步反省的类型(包括请求),这些类型是在引用的架构中定义的。在有了完整的定义,你就可以更容易地进行反省。在您的例子中,必须有一个选项来导入WSDL并首先“扩展”所有的include/reference,只有当您有完整的图片可用时,才可以开始自省。如果没有这样的选项,您可能必须遵循引用并逐个包含。在
希望这是一个起点。祝你好运!在
相关问题 更多 >
编程相关推荐