kartagis / pysimplesoap

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

Bugs in client #35

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This works with SUDS

    from suds.client import Client
    url = 'http://wennekers.epcc.ed.ac.uk:8080/axis/services/MetadataCatalogue?WSDL'
    client = Client(url)
    result = client.service.doEnsembleURIQuery("Xpath", "/markovChain", 0, -1)
    print '\nreply(\n%s\n)\n' % str(result)

but not with pysimplesoap

    from pysimplesoap.client import SoapClient                                         
    url = 'http://wennekers.epcc.ed.ac.uk:8080/axis/services/MetadataCatalogue?WSDL'
    client = SoapClient(wsdl=url,trace=False)                                  
    response = client.doEnsembleURIQuery("Xpath", "/markovChain", 0, -1)               
    print response                                                                     

One error is client.py and line
    return lambda self=self, *args, **kwargs: self.wsdl_call(attr,*args,**kwargs)
should be
    return lambda *args, **kwargs: self.wsdl_call(attr,*args,**kwargs)

but also the envelop in the request appears to be is malformed, no data is 
passed to it.

Original issue reported on code.google.com by massimo....@gmail.com on 15 Jul 2011 at 12:32

GoogleCodeExporter commented 8 years ago
About self=self, as long as I now, it binds the instance value into the lambda, 
it is working in most scenarios except this, I think because it expects keyword 
args (as with most webservices I've used):

response = client.doEnsembleURIQuery(queryFormat="Xpath", 
queryString="/markovChain", startIndex=0, maxResults=-1)

But this doesn't work either because this webservice doesn't seem to follow the 
"standard" conventions understood by this library (WSDL parsing is failing, it 
cannot detect the input types). This is weird because this library works 
against other AXIS servers...

As a temporary workaround, a raw call can be used (no wsdl parsing):

from pysimplesoap.client import SoapClient

url = 'http://wennekers.epcc.ed.ac.uk:8080/axis/services/MetadataCatalogue'
client = SoapClient(location=url,trace=True, action="")
response = client.call("doEnsembleURIQuery", ("queryFormat", "Xpath"), 
("queryString", "/markovChain"), ("startIndex", 0), ("maxResults", -1))
print response
print str(response.statusCode)
print str(response.queryTime)
print str(response.totalResults)
print str(response.startIndex)
print str(response.numberOfResults)
for result in response.results:
    print str(result)

Original comment by reingart@gmail.com on 15 Jul 2011 at 3:36

GoogleCodeExporter commented 8 years ago
It seems that pys can't automatically bind non-keywords-arguments to wsdl 
description, bud suds can. for example, the same simple test:

------------suds----------------

from suds.client import Client
client = Client('http://localhost:8000/SOAP?wsdl')
result = client.service.hello('limodou')

request xml snippet shoud be :

   <SOAP-ENV:Header/>
   <ns0:Body>
      <ns1:hello>
         <ns1:a>limodou</ns1:a>
      </ns1:hello>
   </ns0:Body>

but if I use the pysimplesoap , just like:

client.hello('limodou')

there will be en error, so I hack the pysimplesoap:

lambda self=self, *args, **kwargs: self.wsdl_call(attr,*args,**kwargs)
to
lambda *args, **kwargs: self.wsdl_call(attr,*args,**kwargs)

the request xml snippet maybe:

<soap:Body>
    <hello xmlns="http://localhost:8000/SOAP">
    </hello>
</soap:Body>

and the argument will not existed in <hello> at all. And I must use keywords 
argument, just like:

client.hello(a='limodou')

the request xml will be:

<soap:Body>
    <hello xmlns="http://localhost:8000/SOAP">
    <a>limodou</a></hello>
</soap:Body>

so I want to know if do you want to implement this just like suds?

Original comment by limo...@gmail.com on 25 Sep 2011 at 1:17

GoogleCodeExporter commented 8 years ago
No, I don't think I'll implement positional argument support.

This is an frequent misunderstanding about how this library work, but I don't 
have a clean and simple clue of how to fix it, and I think python named 
parameters are more explicit, robust to function signature changes, and helps 
to document the call.

If you have a patch, I'll be glad to see it, but honestly I don't have enough 
time to make it now.

Original comment by reingart@gmail.com on 3 Oct 2011 at 6:08

GoogleCodeExporter commented 8 years ago
Positional parameters were added for wsdl calls in 09a7504efa57

Original comment by reingart@gmail.com on 23 Nov 2011 at 7:20