在 suds 中添加属性
我必须使用 suds 和 Python 执行肥皂请求
<soap:Body>
<registerOrder>
<order merchantOrderNumber="" description="" amount="" currency="" language="" xmlns="">
<returnUrl>http://mysafety.com</returnUrl>
</order>
</registerOrder>
</soap:Body>
如何在 registerOrder 中添加属性?
I have to do soap request with suds and Python
<soap:Body>
<registerOrder>
<order merchantOrderNumber="" description="" amount="" currency="" language="" xmlns="">
<returnUrl>http://mysafety.com</returnUrl>
</order>
</registerOrder>
</soap:Body>
How to add an attribute in registerOrder?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
MessagePlugin 的更动态版本是:
用法:
A more dynamic version of the MessagePlugin would be:
Usage:
在suds 文档中搜索 MessagePlugin。编组选项就是您要搜索的选项。您需要将其作为插件添加到客户端中:
在编组方法中搜索 context.envelope childs。 python的vars()函数在这个地方非常有用。我认为,它应该适合你:
我上周就坐在这个位置,所以它可能会为你节省一些时间:)
In suds documentation search for a MessagePlugin. The marshalled option is what you're searching for. You need to add it into your client as a plugin:
In marshalled method search for context.envelope childs. The python's vars() function is very useful in this place. As I think, It should like something like this for you:
I was sitting at this for last week, so might it'll save some time for you :)
您可以使用 __inject Client 选项来注入特定的 xml
另外,我更喜欢使用 suds-jurko https ://pypi.python.org/pypi/suds-jurko/0.6 这是一个积极维护的 suds 分支。
You can use the __inject Client option to inject a particular xml
Also, I prefer using suds-jurko https://pypi.python.org/pypi/suds-jurko/0.6 which is a fork of suds that is actively maintained.
我已重用 https://fedorahosted.org/suds/ticket/21 并调整了代码使用这个想法。按如下方式更改 SUDS,并
根据需要使用“attrName1”属性调用“方法”。
I have reused https://fedorahosted.org/suds/ticket/21 and have adapted the code to use the idea. Change SUDS as below and use
to call 'method' with the 'attrName1' attribute as wanted.