【问题标题】:Call functions that use specific types on Suds, Python在 Suds、Python 上调用使用特定类型的函数
【发布时间】:2016-11-23 21:01:54
【问题描述】:

我有以下代码:

import logging
logging.basicConfig(level=logging.INFO)

logging.getLogger('suds.client').setLevel(logging.DEBUG)

from suds.client import Client
url = 'https://webpay3gint.transbank.cl/WSWebpayTransaction/cxf/WSWebpayService?wsdl'

client = Client(url)

print client

产生以下输出:

Service ( WSWebpayServiceImplService ) tns="http://service.wswebpay.webpay.transbank.com/"
   Prefixes (1)
      ns0 = "http://service.wswebpay.webpay.transbank.com/"
   Ports (1):
      (WSWebpayServiceImplPort)
         Methods (3):
            acknowledgeTransaction(xs:string tokenInput, )
            getTransactionResult(xs:string tokenInput, )
            initTransaction(wsInitTransactionInput wsInitTransactionInput, )
         Types (14):
            acknowledgeTransaction
            acknowledgeTransactionResponse
            cardDetail
            getTransactionResult
            getTransactionResultResponse
            initTransaction
            initTransactionResponse
            transactionResultOutput
            wpmDetailInput
            wsInitTransactionInput
            wsInitTransactionOutput
            wsTransactionDetail
            wsTransactionDetailOutput
            wsTransactionType

如您所见,某些方法 (initTransaction) 使用自定义类型 (wsInitTransactionInput),如何创建该自定义类型的元素以便能够调用 initTransaction()?

【问题讨论】:

    标签: python soap types suds


    【解决方案1】:

    解决办法是这样写:

    object = client.factory.create('wsInitTransactionInput')
    client.service.initTransaction(object)
    

    它在 suds 文档中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-17
      • 2023-04-02
      • 1970-01-01
      • 2013-06-15
      • 2015-06-11
      • 1970-01-01
      • 2018-09-05
      • 1970-01-01
      相关资源
      最近更新 更多