在 Suds 上调用使用特定类型的函数,Python

Call functions that use specific types on Suds, Python

我有以下代码:

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()?

解决方案是这样写:

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

它在肥皂水文档中。