The cache doesn't work on Windows, as far as I can tell. Works fine in
Linux...
-- Matt
On Fri, Jul 22, 2011 at 9:05 PM, Lin, Mike M <mmlin(a)directv.com> wrote:
Yes, I'm running this on Windows.
I created a public fork off the BitBucket mirror. The changeset is here:
https://bitbucket.org/mmlin/suds/changeset/1ddb86c3f10c. But I have to
warn you that I was not able to successfully invoke my web service using
that image. The problems were unrelated to my changes. I'm guessing the
BitBucket mirror is a different version that what's currently distributed,
although they have the same __version__ value, "0.4". Here's what the
call
stack looks like at the point of failure:
Traceback (most recent call last):
File "scrub.py", line 51, in <module>
None, None, serviceAddress)
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\client.py", line 542,
in __call__
return client.invoke(args, kwargs)
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\client.py", line 595,
in invoke
msg = binding.get_message(self.method, args, kwargs)
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\bindings\binding.py",
line 117, in get_message
content = self.headercontent(method)
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\bindings\binding.py",
line 375, in headercontent
h = self.mkheader(method, pts[n], header)
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\bindings\binding.py",
line 306, in mkheader
return marshaller.process(content)
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\mx\core.py", line 62,
in process
self.append(document, content)
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\mx\core.py", line 75,
in append
self.appender.append(parent, content)
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\mx\appender.py", line
102, in append
appender.append(parent, content)
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\mx\appender.py", line
243, in append
Appender.append(self, child, cont)
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\mx\appender.py", line
182, in append
self.marshaller.append(parent, content)
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\mx\core.py", line 75,
in append
self.appender.append(parent, content)
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\mx\appender.py", line
102, in append
appender.append(parent, content)
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\mx\appender.py", line
243, in append
Appender.append(self, child, cont)
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\mx\appender.py", line
182, in append
self.marshaller.append(parent, content)
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\mx\core.py", line 74,
in append
if self.start(content):
File "c:\Documents and Settings\mlin\My Documents\Aptana Studio 3
Workspace\suds\suds\suds\mx\literal.py", line
87, in start
raise TypeNotFound(content.tag)
suds.TypeNotFound: Type not found: 'value'
-----Original Message-----
From: Michael Sommerville [mailto:msommerville@gmail.com]
Sent: Friday, July 22, 2011 2:37 PM
To: Lin, Mike M
Cc: fedora-suds-list(a)redhat.com
Subject: Re: [Fedora-suds-list] Suds is not reusing cached WSDLs and XSDs,
although I expect it to
On Fri, Jul 22, 2011 at 7:15 PM, Lin, Mike M <mmlin(a)directv.com> wrote:
> Hi Michael,
>
> That does help FileCache.validate() recognize that the cache is not
expired yet. However, it did not improve the times. It takes 16 seconds to
create a client either way.
>
> After that change, the problem is that although ObjectCache.get is always
getting a valid file pointer, it's hitting an exception (EOFError) doing
pickle.load(fp). When that happens, the file is just downloaded again.
>
> Here's the sequence of events:
>
> DocumentReader.open:
> Trying
http://172.28.50.249/wsdl/billingServices/v3.0/RequestScrubAddress.wsdl
> Loading ObjectCache 51012453-document
> Loading pickled object...
> Exception raised: <type 'exceptions.EOFError'>
> Got None from cache
> Downloading... Done
> Saving FileCache 51012453-document... Done
>
> So it doesn't really matter that the new cache file was saved, because
the same thing happens the next time I run. This happens for ALL of WSDL
and XSD files.
>
> I fixed that problem by opening the file in binary mode when reading and
writing. Specifically, the changes I made were in cache.py:
>
> 1. In FileCache.put(), change this line:
> f = self.open(fn, 'w')
> to
> f = self.open(fn, 'wb')
>
> 2. In FileCache.getf(), change this line:
> return self.open(fn)
> to
> return self.open(fn, 'rb')
>
> I don't know the codebase well enough to know if these changes are safe,
but it is pulling the objects from the file cache, the service is still
running successfully, and loading the client went from 16 seconds down to
2.5 seconds.
>
> Hopefully this fix, or something similar can be introduced back into the
suds main line.
Nice spot! I guess you are running this on Windows? That change makes
sense and should to be safe enough. Jeff I think is primarily a Linux
guy, so probably didn't hit this issue.
I'm not sure what is going to happen to suds in the longer term.
Perhaps it is time to create a public fork?
_______________________________________________
suds mailing list
suds(a)lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/suds