Hi,
On my side, your HelloWorldService sample works well, client takes 30s to get the result so it is slow.

If you change:
client = suds.client.Client(url,cache=None)
-> 
 client = suds.client.Client(url)
The caching mechanism avoids to rebuild the cache, and calls are much faster.

By adding:
import logging
logging.basicConfig(level=logging.INFO)
#logging.getLogger('suds.client').setLevel(logging.DEBUG)
logging.getLogger('suds.transport').setLevel(logging.DEBUG)
One can have information on communications while building "cache":
time python suds_client.py 
DEBUG:suds.transport.http:opening (http://localhost:7789/?wsdl)
DEBUG:suds.transport.http:opening (http://www.w3.org/2001/XMLSchema.xsd)
DEBUG:suds.transport.http:opening (http://www.w3.org/2001/xml.xsd)
client 
...

Calls to http://www.w3.org/2001/xml.xsd looks like to be quite long.
time curl http://www.w3.org/2001/xml.xsd
real 0m30.494s
user 0m0.004s
sys 0m0.000s

This show the 30s are lost in this call

Hoping it can help

On Wed, Dec 7, 2011 at 8:38 AM, 贾晓磊 <jiaxiaolei19871112@gmail.com> wrote:
Hi, Dieter:

Thanks for your replay.

1:By the url "http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl" , we can get the words :

<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

Maybe it's the fault of soap1.2

2: I once did a webservice server-side using suds. Most of time, they work together well. While, sometimes, suds returns some message like the exception mentioned above.
If idle, wish you have a look and give me some points. Thanks in advance.

#NOTE: the code can also be found in "http://soaplib.github.com/soaplib/2_0/pages/helloworld.html"
# soaplib_server.py
import soaplib
from soaplib.core.service import soap
from soaplib.core.service import rpc, DefinitionBase
from soaplib.core.model.primitive import String, Integer
from soaplib.core.server import wsgi
from soaplib.core.model.clazz import Array
from soaplib.core import Application
class HelloWorldService(DefinitionBase):

    @soap(String,Integer,_returns=Array(String))
    def say_hello(self,name,times):
        results = []
        for i in range(0,times):
            results.append('Hello, %s'%name)
        return results

if __name__=='__main__':
    print 'server begin running...'
    try:
        from wsgiref.simple_server import make_server
        soap_application = Application([HelloWorldService], 'tns')

        wsgi_application = wsgi.Application(soap_application)
        server = make_server('localhost', 7789, wsgi_application)
        server.serve_forever()
    except ImportError:
        print "Error: example server code requires Python >= 2.5"

# suds.py
import suds
def test_soaplib():
    
    client = suds.client.Client(url,cache=None)
    print 'client', client
    output = client.service.say_hello('jia',3)
    print 'output', output

when you invoke sus.py , it takes much time and a long time later returns the right result
”output (stringArray){
   string[] =
      "Hello, jia",
      "Hello, jia",
      "Hello, jia",
 }
Sometimes, it returns  exceptions as follows. most of time it return the result successfully after 2 or 3 minutes

Traceback (most recent call last):
  File "suds_client.py", line 774, in <module>
    test_soaplib()
  File "suds_client.py", line 627, in test_soaplib
    client = suds.client.Client(url,cache=None)
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/client.py", line 109, in __init__
    self.wsdl = Definitions(url, options)
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/wsdl.py", line 194, in __init__
    self.build_schema()
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/wsdl.py", line 255, in build_schema
    self.schema = container.load()
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/schema.py", line 90, in load
    child.open_imports()
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/schema.py", line 277, in open_imports
    imported = imp.open()
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/sxbasic.py", line 608, in open
    result = self.download()
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/sxbasic.py", line 628, in download
    return self.schema.instance(root, url)
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/schema.py", line 367, in instance
    return Schema(root, baseurl, self.options)
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/schema.py", line 200, in __init__
    self.open_imports()
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/schema.py", line 277, in open_imports
    imported = imp.open()
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/sxbasic.py", line 608, in open
    result = self.download()
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/sxbasic.py", line 626, in download
    root = Parser(transport).parse(url=url).root()
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/sax/parser.py", line 133, in parse
    fp = self.transport.open(Request(url))
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/transport/https.py", line 69, in open
    return  HttpTransport.open(self, request)
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/transport/http.py", line 69, in open
    fp = self.__open(u2request)
  File "/usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/transport/http.py", line 107, in __open
    return self.urlopener.open(u2request)
  File "/usr/lib/python2.6/urllib2.py", line 391, in open
    response = self._open(req, data)
  File "/usr/lib/python2.6/urllib2.py", line 409, in _open
    '_open', req)
  File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.6/urllib2.py", line 1161, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.6/urllib2.py", line 1134, in do_open
    r = h.getresponse()
  File "/usr/lib/python2.6/httplib.py", line 986, in getresponse
    response.begin()
  File "/usr/lib/python2.6/httplib.py", line 391, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.6/httplib.py", line 355, in _read_status
    raise BadStatusLine(line)

# okay, the problem is why sometimes the client return the exception and most of time return the correct results some minutes later?


Thanks for your spirit and time.

-- Jia Xiaolei


On Wed, Dec 7, 2011 at 3:17 PM, Dieter Maurer <dieter@handshake.de> wrote:
??? wrote at 2011-12-7 13:59 +0800:
> ...
>When I try to invoke a remote method getWeather() in the url "
>http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl", it
>failed. My code and the exception returned are as follows:
>
> ...
>Traceback (most recent call last):
> ...
>  File "/usr/lib/python2.6/urllib2.py", line 1134, in do_open
>    r = h.getresponse()
>  File "/usr/lib/python2.6/httplib.py", line 986, in getresponse
>    response.begin()
>  File "/usr/lib/python2.6/httplib.py", line 391, in begin
>    version, status, reason = self._read_status()
>  File "/usr/lib/python2.6/httplib.py", line 355, in _read_status
>    raise BadStatusLine(line)

The traceback indicates a bad reply from the remote web server:
the response in not a valid HTTP response.

This does not look like a client problem
(at least not completely a client problem).

Should the problem be reproducible, then the most likely cause would be
some error in the WSDL (bad port information) which causes the client
to speak to a non HTTP server.

WSDL is complexe. Especially, it allows to specify different sets of
ports. If the concrete WSDL uses multiple ports, clients may
choose different ports unless the port is specified explicitely in
the call. Maybe, "suds" is using a broken port definition while other
clients use another correct port definition.


Note also that "suds" does not (yet) support "SOAP 1.2" (unlike
the Java/.Net soap clients). Check whether your WSDL defines
a "SOAP 1.1" port and in this case, use this one.



--
Dieter



--
NAME: 贾晓磊/Jia Xiaolei
MOBILE: 13011292217
QQ: 281304051


------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of
discussion for anyone considering optimizing the pricing and packaging model
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
Pywebsvcs-talk mailing list
Pywebsvcs-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pywebsvcs-talk
Also archived at http://groups.google.com/group/pywebsvcs