python - Spyne - 如何在 SOAP 端点中接受键值对?
问题描述
我正在尝试构建SOAP
服务,并且想将以下内容传递给端点。
<payload>
<initiation_date>2019-05-17T00:00:00.000</initiation_date>
<facility_num>123</facility_num>
<order_num>123</order_num>
</payload>
我想要实现的是dict
在我的端点中得到一个。
我的端点如下所示:
class SoapService(ServiceBase):
@rpc(Unicode, Unicode, Unicode, Array(Unicode), _returns=String)
def soap_service(self, email, password, action, payload):
我在soap_service
端点中需要的是:
payload = {
'initiation_date': '2019-05-17T00:00:00.000',
'facility_num': '123',
'order_num': '123'
}
我如何实现这一目标?
我真的很感激帮助!
解决方案
想通了,我只需要将type
装饰器中的有效负载更改为AnyDict
.
这有效:
@rpc(Unicode, Unicode, Unicode, AnyDict, _returns=String)
def soap_service(self, email, password, action, payload):
谢谢!
推荐阅读
- serialization - DDD ValueObject 和 Enumeration ,有没有什么好的方法来实现序列化?
- angular - Angular 9 和 docker 为什么 docker 只返回 doc 文件夹而不是构建应用程序?
- android - 在android中的眼睛图标上显示和隐藏密码
- ios - 如何根据结果更改文本标签颜色?
- jenkins - 詹金斯管道中的主动选择反应参考参数作为格式化的html,具有默认值
- deployment - Ansible error using `win_copy`: "Unexpected failure during module execution"
- java - jdbcTemplate 查询带有多个参数的准备好的语句
- python - 条形图上的 Matplotlib 颜色图
- android - 将位图保存在服装目录中
- android - 如何在 Android Studio 项目中同步期间禁用 *sources.jar 下载