Forum Discussion

yuce_sungur_100's avatar
yuce_sungur_100
Icon for Nimbostratus rankNimbostratus
Feb 11, 2010

pycontrolv2 is not working

I have been trying to migrate my code from pycontrolv1 to pycontrolv2.It is used to work properly for some time but now it fails.Log lines are as below:

 

"

 

2010-02-11 14:17:57,290 - DEBUG - sax (file:/tmp/t/LocalLB.Pool.wsdl) duration: 1.969 (seconds)

 

2010-02-11 14:17:57,623 - DEBUG - inserting:

 

2010-02-11 14:17:58,133 - DEBUG - Import:0xc809d0, importing ns="http://schemas.xmlsoap.org/soap/encoding/", location="http://schemas.xmlsoap.org/soap/encoding/"

 

2010-02-11 14:17:58,134 - DEBUG - opening (http://schemas.xmlsoap.org/soap/encoding/)

 

 

 

"

 

 

so it is trying to

 

 

"

 

IMP = Import('http://schemas.xmlsoap.org/soap/encoding/')

 

DOCTOR = ImportDoctor(IMP)

 

ICONTROL_URI = '/iControl/iControlPortal.cgi'

 

"

 

 

is there anyway to disable this? I have no internet access where I execute my script.

 

 

If this wsdl is necessary ,why not put into egg instead of downloading it?
  • There's no way to disable the import - it's 100% required because there's a missing import in the BigIP WSDLs and Suds needs to access that URL and import that schema in order to parse the WSDL and deal with the types correctly. If you disabled it, your WSDL wouldn't parse.

     

     

    A work-around I've used before is to trump my hosts file and serve the encoding schema from local host. Not ideal but it'll work for you. I'll ask around for other ideas. You could also change the destination in the WSDL programatically as well (that is, change the import destination with a string replace just before you parse it).

     

     

    The newest version of suds (0.3.9) has vastly improved its caching capabilities and now pickles the parsed WSDL objects. I've done an early pass at adding the new functionality into pyControl by now enabling the cache (I had to disable it due to some caching issues in prior Suds versions). If you're interested in trying this out it may help - once you parse your wsdls it'll all be cached, including the missing import I believe. I've not finished off the code just yet but early testing looks good, with better performance too.

     

     

    -Matt
  • I forgot to address your last question: The reason why we don't include the WSDLs is that it's brittle and could break forward or backward compatibility. We ran into this the first time around and the choice of a 'pure' proxy implementation with some decent caching is one of several reasons why we went with Suds. There's room to debate this - for example, our .Net and Java implementations use generated classes and don't parse the WSDLs on load. The downside is here is that you've generated classes against a specific version of WSDL, and you need to remember to upgrade if we change our WSDLs on the BigIP (e.g. the many additions to 10.1 WSDLs).

     

     

    With a pure proxy this is never an issue. Just use fromurl=True and pull down the WSDLs from the source. For me, this made a bunch of sense.

     

     

    PS: There's been much talk of pickling suds clients on the Suds list. This is currently on the roadmap but Python's pickle mechanism doesn't make this particularly easy and the Suds author has to make substantial changes to get it working properly. When this finally happens it's absolutely ideal: Create yoru clients and pickle them onto disk.

     

     

    -Matt
  • Update on this: It looks like this schema import is now included with the new Suds that just went into GA (0.3.9), so this call out for the schema import won't be a hard requirement once you upgrade Suds and I upgrade pyControl. I'll hopefully finish off some testing with this release and we'll be able to take advantage of some of the improvements with this release. Be on the lookout for a new version of pyControl 2. I'll post when I finish it off - likely the early part of next week.

     

     

    **NOTE: there are some important changes to the cache mechanism, which will help us. That said, once I check in my final changes to pyControl for Suds 0.3.9 I strongly recommend everyone upgrade suds. Otherwise, you'll end up with some issues that I had to work around on Suds <=0.3.8.

     

     

    -Matt
  • Do you really need to upgrade pycontrol v2, isnt it enought to upgrade just suds?

     

    I 'll be looking forward to using new pycontrolv2.1,,

     

     

  • I have just seen your reply about creating pickle of sud clients.

     

     

     

    I need to add, when I use fromurl=False, encoding schema can not be parsed from the local directory somehow.

     

     

     

  • Yes, you'll probably want to upgrade to the newest version of pyControl v2. That said, I don't think that you *need* to - backward compatibility should work fine.

     

     

    Anyhow, here's why you may want to upgrade to the new pycontrol when I finish it: The main change is to allow users to pass in cache control arguments now that the new Suds cache is done. This should really help your particular use case, among others. Right now I bypass the Suds cache completely (for various reasons, discussed in the known issues section of the readme).

     

     

    Regarding the fromurl argument, fortunately the new Suds should fix that too, although I've not tested it yet. It's supposed to include this import by default now (this is a very common import in the SOAP world), so I'd expect that to work if you upgrade Suds. I don't do anything special with that import other than tell Suds to fix the schema by adding it.

     

     

    -Matt