On 09/10/2009 03:37 PM, Jeff Ortel wrote:
On 09/10/2009 11:00 AM, Chris Frantz wrote:
> I would like to use suds to talk to several SOAP services, each using
> the same WSDL. The wsdl file is rather large (about 500K) and
> translates to about 50M of memory once parsed.
> If I do this:
> c1 = Client('file:myservice.wsdl)
> c2 = Client('file:myservice.wsdl)
> Then each Client instance adds about 50M to my program's memory
> footprint. Is there any way to parse the WSDL once and create
> several client objects based on the already-parsed file?
> A cursory inspection of the Client code suggests I might be able to
> create the first Client() and then make new instances of client that
> reference the wsdl, factory and sd members of the original, but
> contains different Options and possibly it's own ServiceSelector.
This approach is your best bet. Let me tweak a few things to facilitate
I added a Client.clone() method to help provide for cases like yours where users want to
read the wsdl once and then create many (thin) clones to support usage in multiple threads
with a minimal memory footprint. I added clone() in a previous revision but it needed
some Options refactoring and __deepcopy__() tweaking in the HttpTransport hierarchy to
really behave correctly. The clone() provides for sharing the wsdl but allowing for
independent Options and Transports.
Anyway, I know you cooked up a solution which is great. But, I don't really have a
test environment for this and I'd appreciate your giving it a try.
> Suggestions or comments?
> fedora-suds-list mailing list