Search code examples
pythonweb-serviceswsdlsudsnetsuite

Split up a massive WSDL file


I am working on interacting with the Netsuite Web Services layer with Python. Using suds to parse the WSDL takes close to two minutes. I was able to write a caching layer using redis that solves a bit of the loading headaches once the client has been parsed, but it still takes a ton of time the first time around.

>>> # Takes several minutes to load
>>> client = suds.Client(huge_four_mb_wsdl_file)

Since I only use a small subset of the services, is there a way to pull only those services from the WSDL and put them into my own smaller WSDL?


Solution

  • If you look at the v2013_2 version of the wsdl source you'll see that it's actually importing 38 other xsd files.

    You can speed up your proccess by:

    • Creating a local wsdl that only imports some of the xsd files. (saves download/parse time)
    • Serialising a ready client using pickle and loading it on boot (saves parse time)

    Also make sure you only have to create the client once in your application lifetime.