【问题标题】:Spyne - How do I accept key value pairs in a SOAP endpoint?Spyne - 如何在 SOAP 端点中接受键值对?
【发布时间】:2019-01-28 07:34:29
【问题描述】:

我正在尝试构建一个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'
          }

我如何做到这一点?

非常感谢您的帮助!

【问题讨论】:

  • 你尝试过 AnyDict 类型吗?
  • 是的,我昨天就知道了。还是谢谢!

标签: python web-services soap python-3.6 spyne


【解决方案1】:

想通了,我只需要将装饰器中的有效载荷 type 更改为 AnyDict

这行得通:

@rpc(Unicode, Unicode, Unicode, AnyDict, _returns=String)
        def soap_service(self, email, password, action, payload):

谢谢!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-27
    • 2012-09-08
    • 1970-01-01
    • 2016-06-20
    相关资源
    最近更新 更多