Dechenjm / pysimplesoap

Automatically exported from code.google.com/p/pysimplesoap
0 stars 0 forks source link

Netsuite WSDL crashes when parsing #149

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. From Python 
import pysimplesoap.client
pysimplesoap.client.SoapClient(wsdl='https://webservices.netsuite.com/wsdl/v2012
_2_0/netsuite.wsdl', timeout=None)

What is the expected output? What do you see instead?

>>> import pysimplesoap
>>> 
pysimplesoap.client.SoapClient(wsdl='https://webservices.netsuite.com/wsdl/v2012
_2_0/netsuite.wsdl', timeout=None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/pysimplesoap/client.py", line 133, in __init__
    self.services = wsdl and self.wsdl_parse(wsdl, cache=cache)
  File "/Library/Python/2.7/site-packages/pysimplesoap/client.py", line 557, in wsdl_parse
    postprocess_element(elements)
  File "/Library/Python/2.7/site-packages/pysimplesoap/helpers.py", line 194, in postprocess_element
    elements[k].insert(kk, v[None][kk], i)
KeyError: u'record'
>>>

What version of the product are you using? On what operating system?

Latest pysimplesoap from pypy / pip on Mac OSX 10.9 with python 2.7

Please attach the related WSDL (if any), a small code fragment to reproduce
and provide any additional information below.

Original issue reported on code.google.com by aronrose...@gmail.com on 25 Jun 2014 at 8:07

GoogleCodeExporter commented 9 years ago
I am not sure if this is the correct fix, but the following patch gets me past 
the parse error and finishes loading the wsdl:

--- helpers.py.orig 2014-06-25 13:27:58.000000000 -0700
+++ helpers.py  2014-06-25 14:16:00.000000000 -0700
@@ -190,7 +190,7 @@
                 if isinstance(v[None], dict):
                     for i, kk in enumerate(v[None]):
                         # extend base -keep orginal order-
-                        if v[None] is not None:
+                        if (v[None] is not None) and (kk in v[None]):
                             elements[k].insert(kk, v[None][kk], i)
                     del v[None]
                 else:  # "alias", just replace

Original comment by aronrose...@gmail.com on 25 Jun 2014 at 9:17