client error - please advise

Issue #2 resolved
Iris Cheung
created an issue

After doing "import osa" and implementing the following line, I received the following error. Would you please advise how I could fix it? Thank you very much!

test = osa.Client("http://wildturkey-stg.hescloud.net/st_api/wsdl") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "osa/client.py", line 109, in init types = parser.get_types(primmap) File "osa/wsdl.py", line 272, in get_types self.create_class(t, name, res, types) File "osa/wsdl.py", line 197, in create_class self.collect_children(subel, children, types, allelements) File "osa/wsdl.py", line 150, in collect_children type = get_local_name(subel.get('type', None)) File "osa/soap.py", line 26, in get_local_name full_name = full_name[full_name.find('}')+1:] AttributeError: 'NoneType' object has no attribute 'find'

Comments (2)

  1. sboz repo owner

    Presently the schema import is not implemented. If you look into the wsdl you can notice these imports <xsd:include schemaLocation="http://wildturkey-stg.hescloud.net/st_api/xsd/submit_inputs"/><!-- tns:address is defined in submit_address.xsd --><xsd:include schemaLocation="http://wildturkey-stg.hescloud.net/st_api/xsd/submit_address"/>

    To fix this one has to download the schemas and to append/prepend them to the present one. I'm willing to do this, but right now I'm tight on time.

  2. sboz repo owner

    Schema import/include is now available. In addition basic creation of restricted classes is supported. The latter is, however, not strict: the client does not check the restrictions and awaits the server to know what to do. Here is an example:

    from osa import Client
    srv = client.Client("http://wildturkey-stg.hescloud.net/st_api/wsdl")
    l = srv.types.building_label()
    l.user_key="x"
    l.force_regenerate = 1
    l.building_id = 1
    srv.service.generate_label(l)
    

    Note, that parsing your wsdl takes some time. The function call shown gives an error message: SOAP Fault http://wildturkey-stg.hescloud.net/st_api/serve/?:gene│rate_label <Receiver> 3scale->authorize() failed: user_key_invalid user key "x" is invalid

    You schemas are a bit confusing, even for simple string like user_key you have a restriction, which leads to the fact that in srv.service.function.doc you will see alias names and can not gues that you could simply supply string. In any case please reopen this if you are not happy.

  3. Log in to comment