python/suds, broken schema?

christianco's Avatar

christianco

23 Aug, 2012 04:43 PM

Hi,
I'm using python's suds module to access WS, and am running into an error at the starting gate: suds is giving an error that seems related to a broken schema, ie:
http://stackoverflow.com/questions/1329190/python-suds-type-not-fou...
however it could be another issue...

here's my script:

#!/usr/bin/python
import suds
from suds.client import Client

print suds.__version__

def test_api():
    url = "http://liquigas.ucdavis.edu/ws/services/AssetOperationService?wsdl"
    client = Client(url)
#    print client


    auth = client.factory.create('authentication')

    auth.username='cmsdevadmin'
    auth.password='***********'
    asset = client.factory.create('identifier')
#    print asset
    asset.type.value='site'
    asset.id='d637e4b8807821840014df535bd0a77f'
    asset.recycled=False
    client.factory.create('authentication')

    data={
        'authentication':auth,
        'identifier':asset,
    }

    result = client.service.read(**data)
    print result

if __name__ == '__main__':
    test_api()

and here's my error:

File "sudsTest.py", line 28, in test_api
site = client.service.read(**ident)
File "/usr/lib/python2.7/dist-packages/suds/client.py", line 542, in __call__
return client.invoke(args, kwargs)
File "/usr/lib/python2.7/dist-packages/suds/client.py", line 602, in invoke
result = self.send(soapenv)
File "/usr/lib/python2.7/dist-packages/suds/client.py", line 647, in send
result = self.succeeded(binding, reply.message)
File "/usr/lib/python2.7/dist-packages/suds/client.py", line 684, in succeeded
reply, result = binding.get_reply(self.method, reply)
File "/usr/lib/python2.7/dist-packages/suds/bindings/binding.py", line 165, in get_reply
result = unmarshaller.process(nodes[0], resolved)
File "/usr/lib/python2.7/dist-packages/suds/umx/typed.py", line 66, in process
return Core.process(self, content)
File "/usr/lib/python2.7/dist-packages/suds/umx/core.py", line 48, in process
return self.append(content)
File "/usr/lib/python2.7/dist-packages/suds/umx/core.py", line 63, in append
self.append_children(content)
File "/usr/lib/python2.7/dist-packages/suds/umx/core.py", line 140, in append_children
cval = self.append(cont)
File "/usr/lib/python2.7/dist-packages/suds/umx/core.py", line 63, in append
self.append_children(content)
File "/usr/lib/python2.7/dist-packages/suds/umx/core.py", line 140, in append_children
cval = self.append(cont)
File "/usr/lib/python2.7/dist-packages/suds/umx/core.py", line 63, in append
self.append_children(content)
File "/usr/lib/python2.7/dist-packages/suds/umx/core.py", line 140, in append_children
cval = self.append(cont)
File "/usr/lib/python2.7/dist-packages/suds/umx/core.py", line 63, in append
self.append_children(content)
File "/usr/lib/python2.7/dist-packages/suds/umx/core.py", line 140, in append_children
cval = self.append(cont)
File "/usr/lib/python2.7/dist-packages/suds/umx/core.py", line 61, in append
self.start(content)
File "/usr/lib/python2.7/dist-packages/suds/umx/typed.py", line 80, in start
raise TypeNotFound(content.node.qname())
suds.TypeNotFound: Type not found: 'roleAssignments'

Any ideas?

  1. 1 Posted by cpayan on 31 Aug, 2012 05:36 PM

    cpayan's Avatar

    I was curious about these lines.

    data={

        'authentication':auth,
        'identifier':asset,
    }
    
    result = client.service.read(**data)
    

    Why are you passing the parameter this way? I've been passing them as read(auth,asset).

  2. 2 Posted by christianco on 31 Aug, 2012 05:50 PM

    christianco's Avatar

    That's an operator that you can use with a dictionary that converts it to two named arguments - it's identical to your read(auth,asset) call.

    Do you have suds working with WS? If so, please clue me in - will be much appreciated!

  3. 3 Posted by cpayan on 31 Aug, 2012 08:12 PM

    cpayan's Avatar

    Yea I've used it a bit but I run it with a parameter list instead of a dict. Seems to be the only difference, though. I'm at a loss. I'll try and reproduce your error on my Cascade instance.

  4. 4 Posted by christianco on 31 Aug, 2012 08:28 PM

    christianco's Avatar

    hmm, ran your code verbatim and came out with the same error. What version of Cascade are you running. Suppose it could also be my suds version:

    Suds 0.4.1
    Python 2.7.3

    thanks

  5. 5 Posted by cpayan on 04 Sep, 2012 03:52 PM

    cpayan's Avatar

    I'm running Suds 0.4 on Python 2.5.1 which wow, that's pretty old. I should really update that.

  6. 6 Posted by christianco on 04 Sep, 2012 04:56 PM

    christianco's Avatar

    well if it's working I wouldn't bother - whatever bug i'm running into makes working with wsdl impossible in python for me

  7. 7 Posted by Ryan Griffith on 26 Dec, 2012 09:11 PM

    Ryan Griffith's Avatar

    Hi,

    I was going over some older discussions and noticed this one is still open. Were you able to find a workaround for the error you were encountering?

    Looking over the error message, I'm wondering if you are experiencing this known defect in which certain elements do not return the proper structure as defined by the WSDL (notice role-assignments is listed here). This issue does seem to only occur with the read() operation and for certain asset types (such as a Site).

    Feel free to use the link I have provided to see if it has been resolved in a future release of Cascade.

    Please us know if you have any questions.

    Thanks.

  8. 8 Posted by christianco on 26 Dec, 2012 10:32 PM

    christianco's Avatar

    Ryan,
    This wasn't resolved, although I think the mismatched element structure
    might be the culprit. I still get the same error from version 7.0.5 of
    Cascade:

    Type not found: 'roleAssignments'

    I suppose it is defined but not found. Maybe there's a way to map these
    properly with Suds, but I haven't had time to work it out. Sure would be
    nice if this could get fixed in Cascade WS, but I suppose it would break
    existing scripts. Maybe HH could release updated/fixed WS at a new url ie:

    /ws/services/AssetOperationService?wsdl*2*

    thanks,
    Cc

  9. 9 Posted by Ryan Griffith on 27 Dec, 2012 12:49 PM

    Ryan Griffith's Avatar

    Hi Christian,

    I think the mismatched element structure might be the culprit

    I am pretty sure it is the cause. Is there a way to get the the raw response using something similar to the PHP __getLastResponse() method? I indicated on the issue that this does return the entire operation response; however, I believe the downside here is that you would have to parse the String into XML.

    Sure would be nice if this could get fixed in Cascade WS, but I suppose it would break existing scripts.

    I believe this issue is relatively high on the development timeline. I can't give a date per say, but I think a fix will be rolling out in one of the next few releases.

    As you suggested, this change could potentially affect existing scripts; however, I am sure we would be documenting the change.

    Please let us know if you have any questions.

    Thanks

  10. 10 Posted by christianco on 27 Dec, 2012 08:37 PM

    christianco's Avatar

    Ryan,
    Suds has a last_received() method, and I've tried to get it working but the
    failure takes place in the client.service.read() before I can ask for
    last_received. I can try and pass the TypeNotFound exception but there's
    nothing in last_received() - suds doesn't want to eat the response the way
    it is.
    I could use python logger then grab the soap xml from stdout and treat it
    like XML but it's way too much trouble.

    I'm stumped, and I guess I will have to wait until WS is fixed by HH. May
    as well close this one up.

    thanks,
    Christian

    On Thu, Dec 27, 2012 at 4:49 AM, Ryan Griffith <
    [email blocked]> wrote:

    > __getLastResponse()

  11. 11 Posted by Ryan Griffith on 27 Dec, 2012 09:17 PM

    Ryan Griffith's Avatar

    Sounds good, Christian, thanks for looking into the raw response idea a bit more. Definitely keep an eye on the known defect and release notes for upcoming versions.

    Have a great day!

  12. Ryan Griffith closed this discussion on 27 Dec, 2012 09:17 PM.

  13. christianco re-opened this discussion on 27 Dec, 2012 10:17 PM

  14. 12 Posted by christianco on 27 Dec, 2012 10:17 PM

    christianco's Avatar

    OK I will thanks Ryan.

    Cc

  15. Mike closed this discussion on 28 Dec, 2012 03:48 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac