I am creating an AccountAssignment structure
client = suds.client.Client(url) accountAssignment = client.factory.create('AccountAssignment') print accountAssignment
I get the following result:
(AccountAssignment){ Key = None AccountNo = None TaxCode = None Debit = None Credit = None Turnover = None Text = None FCDebit = None FCCredit = None FCTurnover = None SummaryAccount = None Balance = None BankNo = None BanksortingCode = None BankAccountNo = None DepositFormNo = None DepositFormDate = None ChequeNumber = None ExpiryDate = None GroupMovementType = None AssociatedCompany = None Comment1 = None Comment2 = None Comment3 = None AdditionalDate1 = None AdditionalDate2 = None }
Then I can set the desired values ββand send this structure to the appropriate method. The problem is that two elements are missing in the structure. AccountAssignment should look like this:
(AccountAssignment){ Key = None AccountNo = None TaxCode = None Debit = None Credit = None Turnover = None Text = None FCDebit = None FCCredit = None FCTurnover = None SummaryAccount = None Balance = None BankNo = None BanksortingCode = None BankAccountNo = None DepositFormNo = None DepositFormDate = None ChequeNumber = None ExpiryDate = None GroupMovementType = None AssociatedCompany = None Comment1 = None Comment2 = None Comment3 = None AdditionalDate1 = None AdditionalDate2 = None DebitSpecified = None ** how to add this? CreditSpecified = None ** how to add this? }
I tried adding missing elements with MessagePlugin and its marshalled () method. As a result, items are added immediately before sending, which is too late. I need to set values ββfor two missing elements, so the elements must be present before calling the transfer method. I also experimented with InitPlugin and DocumentPlugin, no luck. Any ideas?
Decision:
I solved the problem using DocumentPlugin and implementing my parsed () method. Since no one seems to be interested, I just provide the code, but do not comment on it further. I have lost enough time on this.
class AccountAssignmentPlugin(suds.plugin.DocumentPlugin): """Plugin to add element to AccountAssignment that is not defined in WSDL.""" def __init__(self, *args): self.args = args def parsed(self, context):
python soap xml suds
Mat
source share