tponthieux tponthieux - 1 year ago 120
Python Question

Has anyone been able to get the the suds soap library to work with the NetSuite WSDL?

Has anyone been able to get the the suds soap library to work with the NetSuite WSDL? I get this error when I try to create a client.

from suds.client import Client

#url = ''
url = ''
client = Client(url)
print client

Traceback (most recent call last):
client = Client(url)
File "build\bdist.win32\egg\suds\", line 112, in __init__
File "build\bdist.win32\egg\suds\", line 152, in open
File "build\bdist.win32\egg\suds\", line 158, in __init__
File "build\bdist.win32\egg\suds\", line 207, in resolve
File "build\bdist.win32\egg\suds\", line 662, in resolve
File "build\bdist.win32\egg\suds\", line 757, in resolvefaults
Exception: fault 'ExceededRecordCountFault' not defined in portType 'NetSuitePortType'

Answer Source

I found that it was failing on a validation between this part:

<operation name="checkAsyncStatus">
    <input name="checkAsyncStatusRequest" message="tns:checkAsyncStatusRequest"/>
    <output name="checkAsyncStatusResponse" message="tns:checkAsyncStatusResponse"/>
    <fault name="InvalidSessionFault" message="tns:InvalidSessionFault"/>
    <fault name="InvalidCredentialsFault" message="tns:InvalidCredentialsFault"/>
    <fault name="ExceededRequestLimitFault" message="tns:ExceededRequestLimitFault"/> -- mismatch
    <fault name="UnexpectedErrorFault" message="tns:UnexpectedErrorFault"/>
    <fault name="AsyncFault" message="tns:AsyncFault"/>

and this part:

<operation name="checkAsyncStatus">
    <soap:operation soapAction="checkAsyncStatus"/>
    <input name="checkAsyncStatusRequest">
        <soap:header message="tns:headers" part="passport" use="literal"/>
        <soap:header message="tns:headers" part="applicationInfo" use="literal"/>
        <soap:header message="tns:headers" part="partnerInfo" use="literal"/>
        <soap:header message="tns:headers" part="preferences" use="literal"/>
        <soap:body use="literal"/>
    <output name="checkAsyncStatusResponse">
        <soap:header message="tns:headers" part="documentInfo" use="literal"/>
        <soap:body use="literal"/>
    <fault name="InvalidSessionFault">
        <soap:fault name="InvalidSessionFault" use="literal"/>
    <fault name="InvalidCredentialsFault">
        <soap:fault name="InvalidCredentialsFault" use="literal"/>
    <fault name="ExceededRequestLimitFault">
        <soap:fault name="ExceededRecordCountFault" use="literal"/> -- mismatch
    <fault name="UnexpectedErrorFault">
        <soap:fault name="UnexpectedErrorFault" use="literal"/>
    <fault name="AsyncFault">
        <soap:fault name="AsyncFault" use="literal"/>

I changed this:

<fault name="ExceededRequestLimitFault">
    <soap:fault name="ExceededRecordCountFault" use="literal"/>

to this:

<fault name="ExceededRequestLimitFault">
    <soap:fault name="ExceededRequestLimitFault" use="literal"/>

The modification allows Suds to create the client. Like John mentioned, it does take forever to parse(more than two minutes). I haven't tried using checkAsyncStatus to see if it works.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download