1

At the beginning of my current suds query it takes ~120 seconds to construct the client. What I would like to do is cache the client construction whenever my script is run. Is this possible with suds-jurko 0.7.0? My Imports and the main variable:

from suds.client import Client
from suds.cache import ObjectCache
from suds import WebFault
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
logging.getLogger('suds.transport').setLevel(logging.DEBUG)
logging.getLogger('suds.xsd.schema').setLevel(logging.DEBUG)
logging.getLogger('suds.wsdl').setLevel(logging.DEBUG)

AccountNumber = raw_input('What is the customer account number?')

Omitting the specific variables for security reasons. they are 3 however:

  1. raw_xml being injected into the query due to required syntax.
  2. variable for wsdl.
  3. variable for headers.

Rest of the code:

cache = ObjectCache()

cache.setduration(days=10)

cache.setlocation('C:\Users\name\Documents\cache')

client = Client(url=wsdl, headers=headers, cache=cache)

try:
    results = client.service.LoadAccountInformation(__inject={'msg': raw_xml})
    print results
except WebFault, e:
    print e

This is my current script and it pulls the information I want correctly from the SOAP server, it does not however pull from the cache at client creation which due to the size of the wsdl takes quite a long time.

This issue seems a bit similar to this only I am using python 2.7: python 3 suds cache not working

I have tried the

cachingpolicy=0/1

with no luck.

I would prefer to stay away from classes unless that is really the best way to go. My OOP knowledge in python could use some work.

Thanks in advance, Cris

0 Answers0