From jiaxiaolei19871112 at gmail.com Thu Dec 1 06:18:21 2011 From: jiaxiaolei19871112 at gmail.com (=?UTF-8?B?6LS+5pmT56OK?=) Date: Thu, 1 Dec 2011 13:18:21 +0800 Subject: [Soap-Python] python webservice from SOAPpy import SOAPProxy Message-ID: Hi, all: Is someone familiar to SOAPpy? First of all, I will admire I'm a newbie to soap, and SOAPpy can run successfully in some occasions. Now, my problem is: # server_sum.py import logging import tornado.httpserver import tornado.ioloop import tornado.web from tornadows import soaphandler from tornadows import webservices from tornadows import xmltypes from tornadows.soaphandler import webservice from tornado.options import define, options define('mode', default='deploy') define('port', type=int, default=8000) options['logging'].set('warning') class SumService(soaphandler.SoapHandler): @webservice(_params=[xmltypes.Integer,xmltypes.Integer],_returns=xmltypes.Integer) def sum(self, a=1, b=1): result = a + b return result if __name__ == '__main__': service = [('SumService',SumService)] app = webservices.WebService(service) ws = tornado.httpserver.HTTPServer(app) ws.listen(options.port) logging.warn("SumService running on: localhost:%d", options.port) tornado.ioloop.IOLoop.instance().start() # sum_client.py from SOAPpy import SOAPProxy def test_tornadows_sum(): """test for tornadows """ #TODO:in this way, invoking tornadows is also failed, what a pity. url = "http://localhost:8000/SumService" server = SOAPProxy(url) print dir(server) a = 22 b = 44 print server.sum(a,b) ------ The server is okay.when I invoke the method in this way, it return the sum of 10 and 2.: import suds def test_tornadows_sum(): # it's okay, while the server provide a method. url = "http://localhost:8000/SumService?wsdl" client = suds.client.Client(url) print 'client', client a = 10 b = 2 output = client.service.sum(a,b) While, when i use SOAPProxy (sum_client.py), it failed. the errror message is : ['_SOAPProxy__Method', '_SOAPProxy__call', '__doc__', '__getattr__', '__init__', '__module__', '_callWithBody', 'config', 'encoding', 'header', 'http_proxy', 'invoke', 'methodattrs', 'namespace', 'noroot', 'proxy', 'simplify_objects', 'soapaction', 'throw_faults', 'transport', 'unwrap_results'] : {'faultcode': '', 'faultstring': 'Error in web service : unbound prefix: line 1, column 0'} What should I do next ? #NOTE: the wsdl for the server is: http://172.16.2.46:8000/SumService?wsdl # url is in my personal computer, you can read the wsdl below. Any help will be highly appreciated. Thanks for your time and concentration again! -- Jia Xiaolei -------------- next part -------------- An HTML attachment was scrubbed... URL: From jiaxiaolei19871112 at gmail.com Fri Dec 2 02:55:49 2011 From: jiaxiaolei19871112 at gmail.com (=?UTF-8?B?6LS+5pmT56OK?=) Date: Fri, 2 Dec 2011 09:55:49 +0800 Subject: [Soap-Python] [tornado] python webservice from SOAPpy import SOAPProxy In-Reply-To: References: Message-ID: Thanks for the insight. the problem is solved. the code below can work well. def test_tornadows_sum2(): """test for tornadows """ url = "http://localhost:8000/SumService" server = SOAPProxy(url, noroot=1) server.config.debug=1 server.config.typed=0 print server.sum(a=200,b=10) #NOTE: do you find a funny phenomenon? if local programming, we can define a function "def test(a=1,b=2): return a+b" can invoke it using "test(200,10)" successfully. while, in "SOAPProxy", we must write code as "print server.sum(a=200,b=10)". when use "print server.sum(200,10)", it returns an exception. #detail information: # server end: def sum(self, a, b): print 'a', a print 'b', b result = a + b print 'result', client end: part 1: print server.sum(200,10) failed: *** Outgoing HTTP headers ********************************************** POST /SumService HTTP/1.0 Host: localhost:8000 User-agent: SOAPpy 0.12.0 (http://pywebsvcs.sf.net) Content-type: text/xml; charset="UTF-8" Content-length: 282 SOAPAction: "sum" ************************************************************************ *** Outgoing SOAP ****************************************************** 200 10 ************************************************************************ code= 200 msg= OK headers= Content-Length: 516 Content-Type: text/xml Server: TornadoServer/2.1.1 content-type= text/xml data= Error in web service : sum() takes exactly 3 arguments (1 given) *** Incoming HTTP headers ********************************************** HTTP/1.? 200 OK Content-Length: 516 Content-Type: text/xml Server: TornadoServer/2.1.1 ************************************************************************ *** Incoming SOAP ****************************************************** Error in web service : sum() takes exactly 3 arguments (1 given) ************************************************************************ : {'faultcode': '', 'faultstring': 'Error in web service : sum() takes exactly 3 arguments (1 given)'} part 2: print server.sum(a=200,b=10) okay: *** Outgoing HTTP headers ********************************************** POST /SumService HTTP/1.0 Host: localhost:8000 User-agent: SOAPpy 0.12.0 (http://pywebsvcs.sf.net) Content-type: text/xml; charset="UTF-8" Content-length: 278 SOAPAction: "sum" ************************************************************************ *** Outgoing SOAP ****************************************************** 200 10 ************************************************************************ code= 200 msg= OK headers= Content-Length: 344 Content-Type: text/xml Server: TornadoServer/2.1.1 Set-Cookie: _xsrf=bd30bb2d55624f8e99409b061fe4bb74; Path=/ content-type= text/xml data= 210 *** Incoming HTTP headers ********************************************** HTTP/1.? 200 OK Content-Length: 344 Content-Type: text/xml Server: TornadoServer/2.1.1 Set-Cookie: _xsrf=bd30bb2d55624f8e99409b061fe4bb74; Path=/ ************************************************************************ *** Incoming SOAP ****************************************************** 210 ************************************************************************ 210 if idle, hope to get a response. Thanks again for the help. -- Jia Xiaolei On Fri, Dec 2, 2011 at 4:45 AM, Rodrigo Ancavil wrote: > Hi Jia. > > SOAPpy generates default XML SOAP messaging a bit confusing for web > services. > > If you set server.config.debug = 1, you can see the messages generated by > default. > > Below I send you a code that worked for me. > > > Here the code: > =========== > > from SOAPpy import SOAPProxy > > def test_tornadows_sum(): > """test for tornadows > """ > #TODO:in this way, invoking tornadows is also failed, what a pity. > url = "http://localhost:8000/SumService" > > # noroot = 0 generate > # noroot = 1 ommit SOAP-ENC:root="1", > > server = SOAPProxy(url,noroot=1) > # With debug = 1 show the communication and messages soap xml. > server.config.debug = 1 > > # typed = 0 generates the types into the elements > # 2 > # 1 > # with typed = 1 omits the types into the elements > # 2 > # 1 > server.config.typed = 0 > > print > # sending the parameters a=val1, b=val2, make that respect the > elements > # defined in the schema of the wsdl. > print "Result is : "+server.sum(a=200,b=10) > > test_tornadows_sum() > > I hope help you. > > Rodrigo. > > > > > > 2011/12/1 ??? > >> Hi, all: >> >> Is someone familiar to SOAPpy? >> >> First of all, I will admire I'm a newbie to soap, and SOAPpy can run >> successfully in some occasions. >> >> Now, my problem is: >> >> # server_sum.py >> import logging >> >> import tornado.httpserver >> import tornado.ioloop >> import tornado.web >> from tornadows import soaphandler >> from tornadows import webservices >> from tornadows import xmltypes >> from tornadows.soaphandler import webservice >> from tornado.options import define, options >> >> define('mode', default='deploy') >> define('port', type=int, default=8000) >> options['logging'].set('warning') >> >> >> class SumService(soaphandler.SoapHandler): >> >> @webservice(_params=[xmltypes.Integer,xmltypes.Integer],_returns=xmltypes.Integer) >> def sum(self, a=1, b=1): >> result = a + b >> return result >> >> if __name__ == '__main__': >> service = [('SumService',SumService)] >> app = webservices.WebService(service) >> ws = tornado.httpserver.HTTPServer(app) >> ws.listen(options.port) >> logging.warn("SumService running on: localhost:%d", options.port) >> tornado.ioloop.IOLoop.instance().start() >> >> # sum_client.py >> >> from SOAPpy import SOAPProxy >> >> def test_tornadows_sum(): >> """test for tornadows >> """ >> #TODO:in this way, invoking tornadows is also failed, what a pity. >> url = "http://localhost:8000/SumService" >> server = SOAPProxy(url) >> print dir(server) >> a = 22 >> b = 44 >> print server.sum(a,b) >> >> >> ------ >> The server is okay.when I invoke the method in this way, it return the >> sum of 10 and 2.: >> import suds >> def test_tornadows_sum(): >> # it's okay, while the server provide a method. >> url = "http://localhost:8000/SumService?wsdl" >> client = suds.client.Client(url) >> print 'client', client >> a = 10 >> b = 2 >> output = client.service.sum(a,b) >> >> While, when i use SOAPProxy (sum_client.py), it failed. the errror >> message is : >> >> ['_SOAPProxy__Method', '_SOAPProxy__call', '__doc__', '__getattr__', >> '__init__', '__module__', '_callWithBody', 'config', 'encoding', 'header', >> 'http_proxy', 'invoke', 'methodattrs', 'namespace', 'noroot', 'proxy', >> 'simplify_objects', 'soapaction', 'throw_faults', 'transport', >> 'unwrap_results'] >> : {'faultcode': '', >> 'faultstring': 'Error in web service : unbound prefix: line 1, column 0'} >> >> What should I do next ? >> >> #NOTE: the wsdl for the server is: >> http://172.16.2.46:8000/SumService?wsdl # url is in my personal >> computer, you can read the wsdl below. >> > xmlns:tns="http://127.0.1.1:8000/SumService/sum" xmlns:wsdl=" >> http://schemas.xmlsoap.org/wsdl/"xmlns:xsd=" >> http://www.w3.org/2001/XMLSchema" xmlns:xsi=" >> http://www.w3.org/2001/XMLSchema-instance" name="SumService" >> targetNamespace="http://127.0.1.1:8000/SumService/sum"> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Any help will be highly appreciated. Thanks for your time and >> concentration again! >> >> -- Jia Xiaolei >> >> > -- NAME: ???/Jia Xiaolei MOBILE: 13011292217 QQ: 281304051 MICRO-BLOG: http://weibo.com/2183890715 GMAIL: jiaxiaolei19871112 at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jiaxiaolei19871112 at gmail.com Fri Dec 2 07:22:01 2011 From: jiaxiaolei19871112 at gmail.com (=?UTF-8?B?6LS+5pmT56OK?=) Date: Fri, 2 Dec 2011 14:22:01 +0800 Subject: [Soap-Python] python webservice SUDS soapheader Message-ID: HI, all: Recently I am doing something about python webservice. With the help of some groups, most of problems has been solved. Now, how to pass SOAP heasers makes me confused. I try to get help from web, such as http://stackoverflow.com/questions/2469988/how-to-pass-soap-headers-into-python-suds-that-are-not-defined-in-wsdl-file , http://stackoverflow.com/questions/2964867/add-header-section-to-soap-request-using-soappy, they indeed provide some valuable advises, but the problem still exists. I will describe it in detail as follows: part 1: I need to construct this soapheaders using SUDS. PABB4BEIJING QWERTPABB part 2: my code import suds def test_sms9(): #step 1: import a encode from suds.xsd.doctor import ImportDoctor, Import imp = Import('http://schemas.xmlsoap.org/soap/encoding/') d = ImportDoctor(imp) #step 2: set the logging import logging logging.basicConfig(level=logging.ERROR) # step 3: construt client url = " http://211.137.45.104:9006/LnXxtCpInterface/services/LNXxtSyncService?wsdl" client = suds.client.Client(url,doctor=d,cache=None,xstq=False,faults=False) # step 4: create the header from suds.sax.element import Element from suds.sax.attribute import Attribute code = Element('serviceCode').setText('PABB4BEIJING') pwd = Element('servicePwd').setText('QWERTPABB') header_list = [code, pwd] client.set_options(soapheaders=header_list) # setp 5: provide the parameters for soap body item1 = "{'msgid':'1234567890','bizcode':'15140237310','serviceId':'1234567','recomobile':'15110791945','sendtime':'1322573860','content':'hi, this is just a test. you can ignore it. --jiaxiaolei'}" item2 = "{'msgid':'1234567891','bizcode':'15140237310','serviceId':'1234567','recomobile':'15110791946','sendtime':'1322573870','content':'hi, this is just a test. you can ignore it. --jiaxiaolei'}" req = [item1, item2] aoss = client.factory.create('ArrayOf_soapenc_string') aoss.item = req print 'client', client output = client.service.sendMt(aoss) print 'SOAP Request:\n', client.last_sent(), '\n' print 'SOAP Response:\n', client.last_received(), '\n' print 'the return: \n', output, '\n' #output: SOAP Request: PABB4BEIJING QWERTPABB {'msgid':'1234567890','bizcode':'151402 37310','serviceId':'1234567','recomobile':'15110791945','sendtim e':'1322573860','content':'hi, this is just a test. you can ignore it. --jiaxiaolei& apos;} {'msgid':'1234567891','bizcode':'151402 37310','serviceId':'1234567','recomobile':'15110791946','sendtim e':'1322573870','content':'hi, this is just a test. you can ignore it. --jiaxiaolei'} SOAP Response: soapenv:Server.generalException xxt.protocol.obj.v1_0.common.ServiceException ln_xxt_mh01 SEV_0003 SoapHeader is null the return: (500, (detail){ fault = (fault){ _href = "#id0" } exceptionName = "xxt.protocol.obj.v1_0.common.ServiceException" hostname = "ln_xxt_mh01" }) Then, I modify the code: # step 4: create the header from suds.sax.element import Element from suds.sax.attribute import Attribute code = Element('serviceCode').setText('PABB4BEIJING') pwd = Element('servicePwd').setText('QWERTPABB') header_list = [code, pwd] client.set_options(soapheaders=header_list) ==> # step 4: create the header from suds.sax.element import Element from suds.sax.attribute import Attribute code = Element('serviceCode').setText('PABB4BEIJING') pwd = Element('servicePwd').setText('QWERTPABB') reqsoapheader = Element('ReqSOAPHeader').insert(code) reqsoap_attribute = Attribute('xmlns', "http://schemas.acme.eu/") reqsoapheader.append(reqsoap_attribute) client.set_options(soapheaders=reqsoapheader) # output: SOAP Request: PABB4BEIJING .... # NOTE: the body is omitted. SOAP Response: # it's same with mentioned above. I try to change the code to "reqsoapheader = Element('ReqSOAPHeader').insert([code,pwd]) ". it failed. Last, how to generate a soapheader as : xxxx yyy Any advice will be highly appreciated. Thanks and regards ahead for the the time and concentration. Thanks again! -- Jia Xiaolei -------------- next part -------------- An HTML attachment was scrubbed... URL: From jiaxiaolei19871112 at gmail.com Sat Dec 3 01:42:27 2011 From: jiaxiaolei19871112 at gmail.com (=?UTF-8?B?6LS+5pmT56OK?=) Date: Sat, 3 Dec 2011 08:42:27 +0800 Subject: [Soap-Python] [Fedora-suds-list] python webservice SUDS soapheader In-Reply-To: References: Message-ID: Hi, Dave: Thanks very much for your reply. With your help, the code is okay now. Thanks def test_sms10(): #NOTE: method 2: #1: import a encode from suds.xsd.doctor import ImportDoctor, Import imp = Import('http://schemas.xmlsoap.org/soap/encoding/') d = ImportDoctor(imp) #1: set the logging import logging logging.basicConfig(level=logging.ERROR) # 3: construt client url = " http://211.137.45.104:9006/LnXxtCpInterface/services/LNXxtSyncService?wsdl" client = suds.client.Client(url,doctor=d,cache=None,xstq=False,faults=False) # step 4: create the header from suds.sax.element import Element from suds.sax.attribute import Attribute code = Element('serviceCode').setText('PABB4BEIJING') pwd = Element('servicePwd').setText('QWERTPABB') header_list = [code, pwd] # 1 # use insert: it's okay #reqsoapheader = Element('ReqSOAPHeader').insert(code) #reqsoapheader.insert(code) # use child: okay reqsoapheader = Element('ReqSOAPHeader') reqsoapheader.children=[code,pwd] reqsoap_attribute = Attribute('xmlns', " http://common.v1_0.obj.protocol.xxt") reqsoap_attribute2 = Attribute('actor', " http://schemas.xmlsoap.org/soap/actor/next") reqsoap_attribute3 = Attribute('mustUnderstand', "0") reqsoapheader.append(reqsoap_attribute) reqsoapheader.append(reqsoap_attribute2) reqsoapheader.append(reqsoap_attribute3) client.set_options(soapheaders=reqsoapheader) # setp 5: provide the parameters item1 = "{'msgid':'1234567890','bizcode':'15140237310','serviceId':'1234567','recomobile':'15110791945','sendtime':'1322573860','content':'hi, this is just a test. you can ignore it. --jiaxiaolei'}" item2 = "{'msgid':'1234567891','bizcode':'15140237310','serviceId':'1234567','recomobile':'15110791946','sendtime':'1322573870','content':'hi, this is just a test. you can ignore it. --jiaxiaolei'}" req = [item1, item2] aoss = client.factory.create('ArrayOf_soapenc_string') aoss.item = req print 'client', client output = client.service.sendMt(aoss) print 'SOAP Request:\n', client.last_sent(), '\n' print 'SOAP Response:\n', client.last_received(), '\n' print 'the return: \n', output, '\n' # output: SOAP Request: PABB4BEIJING QWERTPABB {'msgid':'1234567890','bizcode':'15140237310','serviceId':'1234567','recomobile':'15110791945','sendtime':'1322573860','content':'hi, this is just a test. you can ignore it. --jiaxiaolei'} {'msgid':'1234567891','bizcode':'15140237310','serviceId':'1234567','recomobile':'15110791946','sendtime':'1322573870','content':'hi, this is just a test. you can ignore it. --jiaxiaolei'} SOAP Response: 1 the return: (200, 1) In actual fact, "you just forgot to add the servicePwd element to the ReqSOAPHeader element." , i had try to add pwd in the code as follows, but failed. code = Element('ReqSOAPHeader').insert(code) pwd = Element('ReqSOAPHeader').insert(pwd) reqsoapheaders = [code, pwd] for seqsoapheader in reqsoapheaders: reqsoap_attribute = Attribute('xmlns', "http://schemas.acme.eu/") reqsoapheader.append(reqsoap_attribute) client.set_options(soapheaders=reqsoapheaders) Now, I certainly know why it's failed. I did not know the thing the method does in bottom layer. In fact, all the methods such as "insert, append" are modify the xml . Thanks again! -- Jia Xiaolei On Fri, Dec 2, 2011 at 10:09 PM, Dave Bonner wrote: > Unless I'm misreading, you've almost got it. In the chunk below, you just > forgot to add the servicePwd element to the ReqSOAPHeader element. > > > On Fri, Dec 2, 2011 at 1:22 AM, ??? wrote: > > from suds.sax.element import Element > > from suds.sax.attribute import Attribute > > code = Element('serviceCode').setText('PABB4BEIJING') > > pwd = Element('servicePwd').setText('QWERTPABB') > > reqsoapheader = Element('ReqSOAPHeader').insert(code) > reqsoapheader.insert(pwd) > > reqsoap_attribute = Attribute('xmlns', "http://schemas.acme.eu/") > > reqsoapheader.append(reqsoap_attribute) > > client.set_options(soapheaders=reqsoapheader) > > It's probably a little cleaner to do it like this, though: > > code = Element('serviceCode').setText('PABB4BEIJING') > pwd = Element('servicePwd').setText('QWERTPABB') > reqsoapheader = Element('ReqSOAPHeader') > reqsoapheader.children = [code, pwd] > > -- > david bonner // dbonner at cogolabs.com > > -- NAME: ???/Jia Xiaolei MOBILE: 13011292217 QQ: 281304051 MICRO-BLOG: http://weibo.com/2183890715 GMAIL: jiaxiaolei19871112 at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dbonner at cogolabs.com Fri Dec 2 15:09:58 2011 From: dbonner at cogolabs.com (Dave Bonner) Date: Fri, 2 Dec 2011 09:09:58 -0500 Subject: [Soap-Python] [Fedora-suds-list] python webservice SUDS soapheader In-Reply-To: References: Message-ID: Unless I'm misreading, you've almost got it. In the chunk below, you just forgot to add the servicePwd element to the ReqSOAPHeader element. On Fri, Dec 2, 2011 at 1:22 AM, ??? wrote: > from suds.sax.element import Element > from suds.sax.attribute import Attribute > code = Element('serviceCode').setText('PABB4BEIJING') > pwd = Element('servicePwd').setText('QWERTPABB') > reqsoapheader = Element('ReqSOAPHeader').insert(code) reqsoapheader.insert(pwd) > reqsoap_attribute = Attribute('xmlns', "http://schemas.acme.eu/") > reqsoapheader.append(reqsoap_attribute) > client.set_options(soapheaders=reqsoapheader) It's probably a little cleaner to do it like this, though: code = Element('serviceCode').setText('PABB4BEIJING') pwd = Element('servicePwd').setText('QWERTPABB') reqsoapheader = Element('ReqSOAPHeader') reqsoapheader.children = [code, pwd] -- david bonner // dbonner at cogolabs.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jiaxiaolei19871112 at gmail.com Sat Dec 3 01:12:34 2011 From: jiaxiaolei19871112 at gmail.com (=?GB2312?B?vNbP/sDa?=) Date: Sat, 3 Dec 2011 08:12:34 +0800 Subject: [Soap-Python] [tornado] python webservice from SOAPpy import SOAPProxy In-Reply-To: References: Message-ID: Thanks for your reply. If any more information about "the code of soaphandler.py of api tornadows", you can Cc to me a copy. :) -- Jia Xiaolei 2011/12/2 Rodrigo Ancavil > Hi, Jia... > > I seen the code of tornadows to find what is the situation...well, the API > is strict with the compliance of xml schema defined into the wsdl. > > The web service waits the compliance of the xml schema of the wsdl. In > this case when you make: > > print server.sum(200,10) > > The xml message generated is: > > > > 200 > 10 > > > And the v1 and v2 elements are not understand by the api, because this api > waits for the a and b elements, then is triggered the exception (at level > of the API). > > I will checked the code of soaphandler.py of api tornadows. > > Thanks.... > > Rodrigo. > > > > > > > 2011/12/1 ??? > >> Thanks for the insight. the problem is solved. the code below can work >> well. >> >> >> def test_tornadows_sum2(): >> """test for tornadows >> """ >> url = "http://localhost:8000/SumService" >> server = SOAPProxy(url, noroot=1) >> server.config.debug=1 >> server.config.typed=0 >> print server.sum(a=200,b=10) >> >> >> #NOTE: do you find a funny phenomenon? >> >> if local programming, we can define a function "def test(a=1,b=2): >> return a+b" can invoke it using "test(200,10)" successfully. >> >> while, in "SOAPProxy", we must write code as "print >> server.sum(a=200,b=10)". >> when use "print server.sum(200,10)", it returns an exception. >> >> #detail information: >> >> # server end: >> >> def sum(self, a, b): >> print 'a', a >> print 'b', b >> result = a + b >> print 'result', >> >> client end: >> >> part 1: >> print server.sum(200,10) >> >> failed: >> >> *** Outgoing HTTP headers ********************************************** >> POST /SumService HTTP/1.0 >> Host: localhost:8000 >> User-agent: SOAPpy 0.12.0 (http://pywebsvcs.sf.net) >> Content-type: text/xml; charset="UTF-8" >> Content-length: 282 >> SOAPAction: "sum" >> ************************************************************************ >> *** Outgoing SOAP ****************************************************** >> >> > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" >> > >> >> >> 200 >> 10 >> >> >> >> ************************************************************************ >> code= 200 >> msg= OK >> headers= Content-Length: 516 >> Content-Type: text/xml >> Server: TornadoServer/2.1.1 >> >> content-type= text/xml >> data= > >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> >> xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ >> >> http://schemas.xmlsoap.org/soap/envelope/ >> ">> >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope"> >> >> Error in web service : sum() takes exactly 3 arguments (1 >> given) >> >> *** Incoming HTTP headers ********************************************** >> HTTP/1.? 200 OK >> Content-Length: 516 >> Content-Type: text/xml >> Server: TornadoServer/2.1.1 >> ************************************************************************ >> *** Incoming SOAP ****************************************************** >> > >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> >> xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ >> >> http://schemas.xmlsoap.org/soap/envelope/ >> ">> >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope"> >> >> Error in web service : sum() takes exactly 3 arguments (1 >> given) >> >> ************************************************************************ >> : {'faultcode': '', >> 'faultstring': 'Error in web >> >> service : sum() takes exactly 3 arguments (1 given)'} >> >> >> part 2: >> >> print server.sum(a=200,b=10) >> >> okay: >> >> *** Outgoing HTTP headers ********************************************** >> POST /SumService HTTP/1.0 >> Host: localhost:8000 >> User-agent: SOAPpy 0.12.0 (http://pywebsvcs.sf.net) >> Content-type: text/xml; charset="UTF-8" >> Content-length: 278 >> SOAPAction: "sum" >> ************************************************************************ >> *** Outgoing SOAP ****************************************************** >> >> > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" >> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" >> > >> >> >> 200 >> 10 >> >> >> >> ************************************************************************ >> code= 200 >> msg= OK >> headers= Content-Length: 344 >> Content-Type: text/xml >> Server: TornadoServer/2.1.1 >> Set-Cookie: _xsrf=bd30bb2d55624f8e99409b061fe4bb74; Path=/ >> >> content-type= text/xml >> data= > >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> >> xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ >> >> http://schemas.xmlsoap.org/soap/envelope/ >> ">210 >> >> >> *** Incoming HTTP headers ********************************************** >> HTTP/1.? 200 OK >> Content-Length: 344 >> Content-Type: text/xml >> Server: TornadoServer/2.1.1 >> Set-Cookie: _xsrf=bd30bb2d55624f8e99409b061fe4bb74; Path=/ >> ************************************************************************ >> *** Incoming SOAP ****************************************************** >> > >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> >> xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ >> >> http://schemas.xmlsoap.org/soap/envelope/ >> ">210 >> >> >> ************************************************************************ >> 210 >> >> if idle, hope to get a response. Thanks again for the help. >> >> -- Jia Xiaolei >> >> >> >> On Fri, Dec 2, 2011 at 4:45 AM, Rodrigo Ancavil wrote: >> >>> Hi Jia. >>> >>> SOAPpy generates default XML SOAP messaging a bit confusing for web >>> services. >>> >>> If you set server.config.debug = 1, you can see the messages generated >>> by default. >>> >>> Below I send you a code that worked for me. >>> >>> >>> Here the code: >>> =========== >>> >>> from SOAPpy import SOAPProxy >>> >>> def test_tornadows_sum(): >>> """test for tornadows >>> """ >>> #TODO:in this way, invoking tornadows is also failed, what a pity. >>> url = "http://localhost:8000/SumService" >>> >>> # noroot = 0 generate >>> # noroot = 1 ommit SOAP-ENC:root="1", >>> >>> server = SOAPProxy(url,noroot=1) >>> # With debug = 1 show the communication and messages soap xml. >>> server.config.debug = 1 >>> >>> # typed = 0 generates the types into the elements >>> # 2 >>> # 1 >>> # with typed = 1 omits the types into the elements >>> # 2 >>> # 1 >>> server.config.typed = 0 >>> >>> print >>> # sending the parameters a=val1, b=val2, make that respect the >>> elements >>> # defined in the schema of the wsdl. >>> print "Result is : "+server.sum(a=200,b=10) >>> >>> test_tornadows_sum() >>> >>> I hope help you. >>> >>> Rodrigo. >>> >>> >>> >>> >>> >>> 2011/12/1 ??? >>> >>>> Hi, all: >>>> >>>> Is someone familiar to SOAPpy? >>>> >>>> First of all, I will admire I'm a newbie to soap, and SOAPpy can run >>>> successfully in some occasions. >>>> >>>> Now, my problem is: >>>> >>>> # server_sum.py >>>> import logging >>>> >>>> import tornado.httpserver >>>> import tornado.ioloop >>>> import tornado.web >>>> from tornadows import soaphandler >>>> from tornadows import webservices >>>> from tornadows import xmltypes >>>> from tornadows.soaphandler import webservice >>>> from tornado.options import define, options >>>> >>>> define('mode', default='deploy') >>>> define('port', type=int, default=8000) >>>> options['logging'].set('warning') >>>> >>>> >>>> class SumService(soaphandler.SoapHandler): >>>> >>>> @webservice(_params=[xmltypes.Integer,xmltypes.Integer],_returns=xmltypes.Integer) >>>> def sum(self, a=1, b=1): >>>> result = a + b >>>> return result >>>> >>>> if __name__ == '__main__': >>>> service = [('SumService',SumService)] >>>> app = webservices.WebService(service) >>>> ws = tornado.httpserver.HTTPServer(app) >>>> ws.listen(options.port) >>>> logging.warn("SumService running on: localhost:%d", options.port) >>>> tornado.ioloop.IOLoop.instance().start() >>>> >>>> # sum_client.py >>>> >>>> from SOAPpy import SOAPProxy >>>> >>>> def test_tornadows_sum(): >>>> """test for tornadows >>>> """ >>>> #TODO:in this way, invoking tornadows is also failed, what a pity. >>>> url = "http://localhost:8000/SumService" >>>> server = SOAPProxy(url) >>>> print dir(server) >>>> a = 22 >>>> b = 44 >>>> print server.sum(a,b) >>>> >>>> >>>> ------ >>>> The server is okay.when I invoke the method in this way, it return the >>>> sum of 10 and 2.: >>>> import suds >>>> def test_tornadows_sum(): >>>> # it's okay, while the server provide a method. >>>> url = "http://localhost:8000/SumService?wsdl" >>>> client = suds.client.Client(url) >>>> print 'client', client >>>> a = 10 >>>> b = 2 >>>> output = client.service.sum(a,b) >>>> >>>> While, when i use SOAPProxy (sum_client.py), it failed. the errror >>>> message is : >>>> >>>> ['_SOAPProxy__Method', '_SOAPProxy__call', '__doc__', '__getattr__', >>>> '__init__', '__module__', '_callWithBody', 'config', 'encoding', 'header', >>>> 'http_proxy', 'invoke', 'methodattrs', 'namespace', 'noroot', 'proxy', >>>> 'simplify_objects', 'soapaction', 'throw_faults', 'transport', >>>> 'unwrap_results'] >>>> : {'faultcode': '', >>>> 'faultstring': 'Error in web service : unbound prefix: line 1, column 0'} >>>> >>>> What should I do next ? >>>> >>>> #NOTE: the wsdl for the server is: >>>> http://172.16.2.46:8000/SumService?wsdl # url is in my personal >>>> computer, you can read the wsdl below. >>>> >>> xmlns:tns="http://127.0.1.1:8000/SumService/sum" xmlns:wsdl=" >>>> http://schemas.xmlsoap.org/wsdl/"xmlns:xsd=" >>>> http://www.w3.org/2001/XMLSchema" xmlns:xsi=" >>>> http://www.w3.org/2001/XMLSchema-instance" name="SumService" >>>> targetNamespace="http://127.0.1.1:8000/SumService/sum"> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> Any help will be highly appreciated. Thanks for your time and >>>> concentration again! >>>> >>>> -- Jia Xiaolei >>>> >>>> >>> >> >> >> -- >> NAME: ???/Jia Xiaolei >> MOBILE: 13011292217 >> QQ: 281304051 >> MICRO-BLOG: http://weibo.com/2183890715 >> GMAIL: jiaxiaolei19871112 at gmail.com >> >> > -- NAME: ???/Jia Xiaolei MOBILE: 13011292217 QQ: 281304051 MICRO-BLOG: http://weibo.com/2183890715 GMAIL: jiaxiaolei19871112 at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From rancavil at gmail.com Thu Dec 1 21:45:21 2011 From: rancavil at gmail.com (Rodrigo Ancavil) Date: Thu, 1 Dec 2011 16:45:21 -0400 Subject: [Soap-Python] [tornado] python webservice from SOAPpy import SOAPProxy In-Reply-To: References: Message-ID: Hi Jia. SOAPpy generates default XML SOAP messaging a bit confusing for web services. If you set server.config.debug = 1, you can see the messages generated by default. Below I send you a code that worked for me. Here the code: =========== from SOAPpy import SOAPProxy def test_tornadows_sum(): """test for tornadows """ #TODO:in this way, invoking tornadows is also failed, what a pity. url = "http://localhost:8000/SumService" # noroot = 0 generate # noroot = 1 ommit SOAP-ENC:root="1", server = SOAPProxy(url,noroot=1) # With debug = 1 show the communication and messages soap xml. server.config.debug = 1 # typed = 0 generates the types into the elements # 2 # 1 # with typed = 1 omits the types into the elements # 2 # 1 server.config.typed = 0 print # sending the parameters a=val1, b=val2, make that respect the elements # defined in the schema of the wsdl. print "Result is : "+server.sum(a=200,b=10) test_tornadows_sum() I hope help you. Rodrigo. 2011/12/1 ??? > Hi, all: > > Is someone familiar to SOAPpy? > > First of all, I will admire I'm a newbie to soap, and SOAPpy can run > successfully in some occasions. > > Now, my problem is: > > # server_sum.py > import logging > > import tornado.httpserver > import tornado.ioloop > import tornado.web > from tornadows import soaphandler > from tornadows import webservices > from tornadows import xmltypes > from tornadows.soaphandler import webservice > from tornado.options import define, options > > define('mode', default='deploy') > define('port', type=int, default=8000) > options['logging'].set('warning') > > > class SumService(soaphandler.SoapHandler): > > @webservice(_params=[xmltypes.Integer,xmltypes.Integer],_returns=xmltypes.Integer) > def sum(self, a=1, b=1): > result = a + b > return result > > if __name__ == '__main__': > service = [('SumService',SumService)] > app = webservices.WebService(service) > ws = tornado.httpserver.HTTPServer(app) > ws.listen(options.port) > logging.warn("SumService running on: localhost:%d", options.port) > tornado.ioloop.IOLoop.instance().start() > > # sum_client.py > > from SOAPpy import SOAPProxy > > def test_tornadows_sum(): > """test for tornadows > """ > #TODO:in this way, invoking tornadows is also failed, what a pity. > url = "http://localhost:8000/SumService" > server = SOAPProxy(url) > print dir(server) > a = 22 > b = 44 > print server.sum(a,b) > > > ------ > The server is okay.when I invoke the method in this way, it return the sum > of 10 and 2.: > import suds > def test_tornadows_sum(): > # it's okay, while the server provide a method. > url = "http://localhost:8000/SumService?wsdl" > client = suds.client.Client(url) > print 'client', client > a = 10 > b = 2 > output = client.service.sum(a,b) > > While, when i use SOAPProxy (sum_client.py), it failed. the errror message > is : > > ['_SOAPProxy__Method', '_SOAPProxy__call', '__doc__', '__getattr__', > '__init__', '__module__', '_callWithBody', 'config', 'encoding', 'header', > 'http_proxy', 'invoke', 'methodattrs', 'namespace', 'noroot', 'proxy', > 'simplify_objects', 'soapaction', 'throw_faults', 'transport', > 'unwrap_results'] > : {'faultcode': '', > 'faultstring': 'Error in web service : unbound prefix: line 1, column 0'} > > What should I do next ? > > #NOTE: the wsdl for the server is: > http://172.16.2.46:8000/SumService?wsdl # url is in my personal > computer, you can read the wsdl below. > xmlns:tns="http://127.0.1.1:8000/SumService/sum" xmlns:wsdl=" > http://schemas.xmlsoap.org/wsdl/"xmlns:xsd=" > http://www.w3.org/2001/XMLSchema" xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance" name="SumService" > targetNamespace="http://127.0.1.1:8000/SumService/sum"> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Any help will be highly appreciated. Thanks for your time and > concentration again! > > -- Jia Xiaolei > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rancavil at gmail.com Fri Dec 2 16:51:57 2011 From: rancavil at gmail.com (Rodrigo Ancavil) Date: Fri, 2 Dec 2011 11:51:57 -0400 Subject: [Soap-Python] [tornado] python webservice from SOAPpy import SOAPProxy In-Reply-To: References: Message-ID: Hi, Jia... I seen the code of tornadows to find what is the situation...well, the API is strict with the compliance of xml schema defined into the wsdl. The web service waits the compliance of the xml schema of the wsdl. In this case when you make: print server.sum(200,10) The xml message generated is: 200 10 And the v1 and v2 elements are not understand by the api, because this api waits for the a and b elements, then is triggered the exception (at level of the API). I will checked the code of soaphandler.py of api tornadows. Thanks.... Rodrigo. 2011/12/1 ??? > Thanks for the insight. the problem is solved. the code below can work > well. > > > def test_tornadows_sum2(): > """test for tornadows > """ > url = "http://localhost:8000/SumService" > server = SOAPProxy(url, noroot=1) > server.config.debug=1 > server.config.typed=0 > print server.sum(a=200,b=10) > > > #NOTE: do you find a funny phenomenon? > > if local programming, we can define a function "def test(a=1,b=2): return > a+b" can invoke it using "test(200,10)" successfully. > > while, in "SOAPProxy", we must write code as "print > server.sum(a=200,b=10)". > when use "print server.sum(200,10)", it returns an exception. > > #detail information: > > # server end: > > def sum(self, a, b): > print 'a', a > print 'b', b > result = a + b > print 'result', > > client end: > > part 1: > print server.sum(200,10) > > failed: > > *** Outgoing HTTP headers ********************************************** > POST /SumService HTTP/1.0 > Host: localhost:8000 > User-agent: SOAPpy 0.12.0 (http://pywebsvcs.sf.net) > Content-type: text/xml; charset="UTF-8" > Content-length: 282 > SOAPAction: "sum" > ************************************************************************ > *** Outgoing SOAP ****************************************************** > > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" > > > > > 200 > 10 > > > > ************************************************************************ > code= 200 > msg= OK > headers= Content-Length: 516 > Content-Type: text/xml > Server: TornadoServer/2.1.1 > > content-type= text/xml > data= > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ > > http://schemas.xmlsoap.org/soap/envelope/ > "> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope"> > > Error in web service : sum() takes exactly 3 arguments (1 > given) > > *** Incoming HTTP headers ********************************************** > HTTP/1.? 200 OK > Content-Length: 516 > Content-Type: text/xml > Server: TornadoServer/2.1.1 > ************************************************************************ > *** Incoming SOAP ****************************************************** > > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ > > http://schemas.xmlsoap.org/soap/envelope/ > "> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope"> > > Error in web service : sum() takes exactly 3 arguments (1 > given) > > ************************************************************************ > : {'faultcode': '', > 'faultstring': 'Error in web > > service : sum() takes exactly 3 arguments (1 given)'} > > > part 2: > > print server.sum(a=200,b=10) > > okay: > > *** Outgoing HTTP headers ********************************************** > POST /SumService HTTP/1.0 > Host: localhost:8000 > User-agent: SOAPpy 0.12.0 (http://pywebsvcs.sf.net) > Content-type: text/xml; charset="UTF-8" > Content-length: 278 > SOAPAction: "sum" > ************************************************************************ > *** Outgoing SOAP ****************************************************** > > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" > > > > > 200 > 10 > > > > ************************************************************************ > code= 200 > msg= OK > headers= Content-Length: 344 > Content-Type: text/xml > Server: TornadoServer/2.1.1 > Set-Cookie: _xsrf=bd30bb2d55624f8e99409b061fe4bb74; Path=/ > > content-type= text/xml > data= > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ > > http://schemas.xmlsoap.org/soap/envelope/ > ">210 > > > *** Incoming HTTP headers ********************************************** > HTTP/1.? 200 OK > Content-Length: 344 > Content-Type: text/xml > Server: TornadoServer/2.1.1 > Set-Cookie: _xsrf=bd30bb2d55624f8e99409b061fe4bb74; Path=/ > ************************************************************************ > *** Incoming SOAP ****************************************************** > > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ > > http://schemas.xmlsoap.org/soap/envelope/ > ">210 > > > ************************************************************************ > 210 > > if idle, hope to get a response. Thanks again for the help. > > -- Jia Xiaolei > > > > On Fri, Dec 2, 2011 at 4:45 AM, Rodrigo Ancavil wrote: > >> Hi Jia. >> >> SOAPpy generates default XML SOAP messaging a bit confusing for web >> services. >> >> If you set server.config.debug = 1, you can see the messages generated by >> default. >> >> Below I send you a code that worked for me. >> >> >> Here the code: >> =========== >> >> from SOAPpy import SOAPProxy >> >> def test_tornadows_sum(): >> """test for tornadows >> """ >> #TODO:in this way, invoking tornadows is also failed, what a pity. >> url = "http://localhost:8000/SumService" >> >> # noroot = 0 generate >> # noroot = 1 ommit SOAP-ENC:root="1", >> >> server = SOAPProxy(url,noroot=1) >> # With debug = 1 show the communication and messages soap xml. >> server.config.debug = 1 >> >> # typed = 0 generates the types into the elements >> # 2 >> # 1 >> # with typed = 1 omits the types into the elements >> # 2 >> # 1 >> server.config.typed = 0 >> >> print >> # sending the parameters a=val1, b=val2, make that respect the >> elements >> # defined in the schema of the wsdl. >> print "Result is : "+server.sum(a=200,b=10) >> >> test_tornadows_sum() >> >> I hope help you. >> >> Rodrigo. >> >> >> >> >> >> 2011/12/1 ??? >> >>> Hi, all: >>> >>> Is someone familiar to SOAPpy? >>> >>> First of all, I will admire I'm a newbie to soap, and SOAPpy can run >>> successfully in some occasions. >>> >>> Now, my problem is: >>> >>> # server_sum.py >>> import logging >>> >>> import tornado.httpserver >>> import tornado.ioloop >>> import tornado.web >>> from tornadows import soaphandler >>> from tornadows import webservices >>> from tornadows import xmltypes >>> from tornadows.soaphandler import webservice >>> from tornado.options import define, options >>> >>> define('mode', default='deploy') >>> define('port', type=int, default=8000) >>> options['logging'].set('warning') >>> >>> >>> class SumService(soaphandler.SoapHandler): >>> >>> @webservice(_params=[xmltypes.Integer,xmltypes.Integer],_returns=xmltypes.Integer) >>> def sum(self, a=1, b=1): >>> result = a + b >>> return result >>> >>> if __name__ == '__main__': >>> service = [('SumService',SumService)] >>> app = webservices.WebService(service) >>> ws = tornado.httpserver.HTTPServer(app) >>> ws.listen(options.port) >>> logging.warn("SumService running on: localhost:%d", options.port) >>> tornado.ioloop.IOLoop.instance().start() >>> >>> # sum_client.py >>> >>> from SOAPpy import SOAPProxy >>> >>> def test_tornadows_sum(): >>> """test for tornadows >>> """ >>> #TODO:in this way, invoking tornadows is also failed, what a pity. >>> url = "http://localhost:8000/SumService" >>> server = SOAPProxy(url) >>> print dir(server) >>> a = 22 >>> b = 44 >>> print server.sum(a,b) >>> >>> >>> ------ >>> The server is okay.when I invoke the method in this way, it return the >>> sum of 10 and 2.: >>> import suds >>> def test_tornadows_sum(): >>> # it's okay, while the server provide a method. >>> url = "http://localhost:8000/SumService?wsdl" >>> client = suds.client.Client(url) >>> print 'client', client >>> a = 10 >>> b = 2 >>> output = client.service.sum(a,b) >>> >>> While, when i use SOAPProxy (sum_client.py), it failed. the errror >>> message is : >>> >>> ['_SOAPProxy__Method', '_SOAPProxy__call', '__doc__', '__getattr__', >>> '__init__', '__module__', '_callWithBody', 'config', 'encoding', 'header', >>> 'http_proxy', 'invoke', 'methodattrs', 'namespace', 'noroot', 'proxy', >>> 'simplify_objects', 'soapaction', 'throw_faults', 'transport', >>> 'unwrap_results'] >>> : {'faultcode': '', >>> 'faultstring': 'Error in web service : unbound prefix: line 1, column 0'} >>> >>> What should I do next ? >>> >>> #NOTE: the wsdl for the server is: >>> http://172.16.2.46:8000/SumService?wsdl # url is in my personal >>> computer, you can read the wsdl below. >>> >> xmlns:tns="http://127.0.1.1:8000/SumService/sum" xmlns:wsdl=" >>> http://schemas.xmlsoap.org/wsdl/"xmlns:xsd=" >>> http://www.w3.org/2001/XMLSchema" xmlns:xsi=" >>> http://www.w3.org/2001/XMLSchema-instance" name="SumService" >>> targetNamespace="http://127.0.1.1:8000/SumService/sum"> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> Any help will be highly appreciated. Thanks for your time and >>> concentration again! >>> >>> -- Jia Xiaolei >>> >>> >> > > > -- > NAME: ???/Jia Xiaolei > MOBILE: 13011292217 > QQ: 281304051 > MICRO-BLOG: http://weibo.com/2183890715 > GMAIL: jiaxiaolei19871112 at gmail.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Sun Dec 4 16:31:59 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Sun, 04 Dec 2011 17:31:59 +0200 Subject: [Soap-Python] rpclib, Infopath and the options http verb In-Reply-To: <74205AE1915EFE49AA22550E5E5BE525ECFAD9@hermes.ac-net.net> References: <74205AE1915EFE49AA22550E5E5BE525ECFAD9@hermes.ac-net.net> Message-ID: <4EDB926F.5040309@arskom.com.tr> On 11/30/11 16:34, LE MEUR Laurent wrote: > First, I want to thank Burak for his work on rpclib ; I successfullly > used it along with Suds for simple needs. you're welcome, and also thanks for taking time to test my beta software. > Then, I'd like to ask some help about an issue that is not related to > rpclib per se, but rather to the default http server used for tests. > > I tried to connect an MS Infopath form to an rpclib WS, but the client > sends an OPTIONS request, and the server responds with a 405. How can I > configure the http server to accept this verb ? So, here's the code responsible for that: https://github.com/arskom/rpclib/blob/master/src/rpclib/server/wsgi.py#L160 which gets allowed_http_verbs from its input protocol, as shown here: https://github.com/arskom/rpclib/blob/master/src/rpclib/server/wsgi.py#L144 which comes from here: https://github.com/arskom/rpclib/blob/master/src/rpclib/protocol/_base.py#L62 so, here's what you need to do to avoid HTTP 405: import rpclib.protocol rpclib.protocol.ProtocolBase.allowed_http_verbs.append('OPTIONS') application = Application(in_protocol=Soap11(...), ...) Beware that as of now it's a class attribute, so that change affects any Application instance in that process. I should probably make it an instance attribute so that it's more configurable. In the mean time, you can change the _allowed_http_verbs attribute in the ServerBase instance. That said, i don't know what InfoPath expects as response to the OPTIONS request, so you may need a hook for different HTTP verbs, which you can use to return responses to arbitrary requests. I just implemented this, you may find it in my personal fork. (http://github.com/plq/rpclib) let me know how it goes. best, burak ps: these should probably be in the documentation somewhere. *wink* *wink* From frank at chagford.com Mon Dec 5 09:10:26 2011 From: frank at chagford.com (Frank Millman) Date: Mon, 5 Dec 2011 10:10:26 +0200 Subject: [Soap-Python] Small error running rpclib under python3 - found and fixed Message-ID: <3Sxf6z0cHZzLsZ@mail.python.org> Hi all I am dabbling with rpclib - 2.4.7-beta. I am running python 3.2, so I ran 2to3 and it imports ok. I wanted to run the UserManager example, so I downloaded server_basic.py, ran 2to3 on it, and tried to run it. It failed with the following traceback - DEBUG:rpclib.interface.xml_schema._base:generating schema for targetNamespace='r pclib.examples.user_manager', prefix: 'tns' Traceback (most recent call last): File "F:\junk\rpclib\usermanager\server_basic.py", line 61, in interface=Wsdl11(), in_protocol=Soap11(), out_protocol=Soap11()) File "C:\Python32\lib\site-packages\rpclib-2.4.7_beta-py3.2.egg\rpclib\applica tion.py", line 76, in __init__ self.in_protocol.set_app(self) File "C:\Python32\lib\site-packages\rpclib-2.4.7_beta-py3.2.egg\rpclib\protoco l\xml\_base.py", line 237, in set_app wsdl.build_validation_schema() File "C:\Python32\lib\site-packages\rpclib-2.4.7_beta-py3.2.egg\rpclib\interfa ce\xml_schema\_base.py", line 134, in build_validation_schema etree.ElementTree(v).write(f, pretty_print=True) File "lxml.etree.pyx", line 1853, in lxml.etree._ElementTree.write (src/lxml\l xml.etree.c:44355) File "serializer.pxi", line 478, in lxml.etree._tofilelike (src/lxml\lxml.etre e.c:90649) File "lxml.etree.pyx", line 282, in lxml.etree._ExceptionContext._raise_if_sto red (src/lxml\lxml.etree.c:7972) File "serializer.pxi", line 378, in lxml.etree._FilelikeWriter.write (src/lxml \lxml.etree.c:89527) TypeError: must be str, not bytes After a bit of investigation I made the following change, in rpclib/interface/xml_schema/_base.py, line 133 - - f = open(file_name, 'w') + f = open(file_name, 'wb') The program then ran successfully, and I could view the wsdl in a browser. Hope this is useful. Frank Millman From burak.arslan at arskom.com.tr Mon Dec 5 14:17:08 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 05 Dec 2011 15:17:08 +0200 Subject: [Soap-Python] Small error running rpclib under python3 - found and fixed In-Reply-To: <3Sxf6z0cHZzLsZ@mail.python.org> References: <3Sxf6z0cHZzLsZ@mail.python.org> Message-ID: <4EDCC454.1030704@arskom.com.tr> On 12/05/11 10:10, Frank Millman wrote: > After a bit of investigation I made the following change, in > rpclib/interface/xml_schema/_base.py, line 133 - > > - f = open(file_name, 'w') > + f = open(file_name, 'wb') > > The program then ran successfully, and I could view the wsdl in a browser. > > Hope this is useful. > > Frank Millman > Hi Frank, Wow, so that's the only thing needed to change in order to get rpclib running under python 3? Do the examples work? I committed your patch to my personal fork. It'll be in the next rpclib release. Thanks for your time. Best Regards, Burak From frank at chagford.com Mon Dec 5 14:35:00 2011 From: frank at chagford.com (Frank Millman) Date: Mon, 5 Dec 2011 15:35:00 +0200 Subject: [Soap-Python] Small error running rpclib under python3 - found and fixed In-Reply-To: <4EDCC454.1030704@arskom.com.tr> Message-ID: <3SxnL96XSkzLx2@mail.python.org> On 05 December 2011 14:34 Burak Arslan wrote: > > On 12/05/11 10:10, Frank Millman wrote: > > After a bit of investigation I made the following change, in > > rpclib/interface/xml_schema/_base.py, line 133 - > > > > - f = open(file_name, 'w') > > + f = open(file_name, 'wb') > > > > The program then ran successfully, and I could view the > wsdl in a browser. > > > > Hope this is useful. > > > > Frank Millman > > > > Hi Frank, > > Wow, so that's the only thing needed to change in order to get rpclib > running under python 3? Do the examples work? > > I committed your patch to my personal fork. It'll be in the > next rpclib > release. Thanks for your time. > Well, I did say I was dabbling ;-) I have not done any extensive tests. I tried to run rpclib_client.py from the examples, and got the following - Traceback (most recent call last): File "F:\junk\rpclib\usermanager\rpclib_client.py", line 60, in retval = c.service.add_user(u) File "C:\Python32\lib\site-packages\rpclib-2.4.7_beta-py3.2.egg\rpclib\client\ http.py", line 33, in __call__ out_string = ''.join(self.ctx.out_string) # FIXME: just send the iterable to the http stream. TypeError: sequence item 0: expected str instance, bytes found I am no expert, so unfortunately I don't know what the correct fix would be. I ran the following from ./examples - binary_http.py binary_soap.py complex.py events.py helloworld_http.py helloworld_soap.py override.py They all successfully got to the point where they were 'listening', so they seem to be working. Would you like me to run any other tests while I have the setup available? Frank From burak.arslan at arskom.com.tr Mon Dec 5 14:50:09 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 05 Dec 2011 15:50:09 +0200 Subject: [Soap-Python] Small error running rpclib under python3 - found and fixed In-Reply-To: <3SxnL96XSkzLx2@mail.python.org> References: <3SxnL96XSkzLx2@mail.python.org> Message-ID: <4EDCCC11.6060002@arskom.com.tr> On 12/05/11 15:35, Frank Millman wrote: > Would you like me to run any other tests while I have the setup available? Hi Frank, First, I filed Issue #113 to track this. Would you please mind running the test from issue #112? It's available here: https://github.com/arskom/rpclib/issues/112#issuecomment-2988748 The main issue seems to be with bytes and str tyoes (this doesn't come completely unexpected), which can require refactoring pretty much anywhere in the code. Using the binary example as a test case would be a nice way to start, because that's where the bytes and str types are supposed to mix. Best Regards, Burak From frank at chagford.com Mon Dec 5 16:44:33 2011 From: frank at chagford.com (Frank Millman) Date: Mon, 5 Dec 2011 17:44:33 +0200 Subject: [Soap-Python] Small error running rpclib under python3 - found and fixed In-Reply-To: <4EDCCC11.6060002@arskom.com.tr> Message-ID: <3SxrCf4pRBzM0v@mail.python.org> On 05 December 2011 15:50 Burak Arslan wrote: > > On 12/05/11 15:35, Frank Millman wrote: > > Would you like me to run any other tests while I have the > setup available? > > Hi Frank, > > First, I filed Issue #113 to track this. > > Would you please mind running the test from issue #112? It's > available > here: https://github.com/arskom/rpclib/issues/112#issuecomment-2988748 > > The main issue seems to be with bytes and str tyoes (this > doesn't come > completely unexpected), which can require refactoring pretty much > anywhere in the code. Using the binary example as a test case > would be a > nice way to start, because that's where the bytes and str types are > supposed to mix. > Hi Burak I have started to look at this, but I am battling a bit. I did not have suds installed, and when I did install it I battled to convert it to python3. It now imports ok, but I don't know if it is 100%. When I run the test from issue #112, I get the following traceback (last line only) - urllib.error.URLError: It is obviously connected with the 'bytes' and 'str' issue, as you mentioned. I will have another look tomorrow and let you know what I find. Frank From azurit at pobox.sk Mon Dec 5 16:55:55 2011 From: azurit at pobox.sk (azurIt) Date: Mon, 05 Dec 2011 16:55:55 +0100 Subject: [Soap-Python] rpclib - very strange problem Message-ID: <20111205165555.6797A2FC@pobox.sk> Hi, i'm having a very strange problem which i will try to describe (it's little complicated). I'm able to 100% reproduce it but it's happening only when specific things will happen: 1.) I need to correctly log into my application (calling do_login function) and open random page (for example list of customers). 2.) In the console, i need to delete my record from DB which will log me out. 3.) Reloding page which will redirect me to login page + i need to do correct login again. After this my app will go crazy. When i try to display the last page (list of customers in this case, only the last page, everything other is working fine), only the every _second_ reload will return the correct information. In other 50% cases this is returned: {'state': u'9205db26bd8bf7e89f68d3321c0f932c30c0b018'} I'm using keyword 'state' in all responses with specific code (it's a return code of API function). The value of 'state' in example above is a session token of my current session (it's NOT http session, it' my own implementation of sessions in the whole application). My function (list of customers) IS NOT returning this. I'm was also tracing this via 'method_call' and 'method_return_object' events and both seems to work fine and ctx.out_object really has that strange thing inside. Even more, i was tracing it inside my function and it WASN'T called at all (it's called only when i get the right result). The problem will go away only after i restart WSGI application. Any hints ? :) azur From burak.arslan at arskom.com.tr Mon Dec 5 17:13:34 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 05 Dec 2011 18:13:34 +0200 Subject: [Soap-Python] Small error running rpclib under python3 - found and fixed Message-ID: <4EDCEDAE.3090001@arskom.com.tr> On 12/05/11 17:44, Frank Millman wrote: > I have started to look at this, but I am battling a bit. I did not have suds > installed, and when I did install it I battled to convert it to python3. It > now imports ok, but I don't know if it is 100%. Hi Frank, I've also made a comment on github because it'd be easier to read than an email. https://github.com/arskom/rpclib/issues/113#issuecomment-3018892 Here's it is: Put this in a file named request.xml: /tmp/test.dat and run this in your shell: python -c 'print "".join(map(chr, xrange(256)))' > /tmp/test.dat python binary_soap.py & sleep 2 curl -d @request.xml http://locahost:7789 using curl, you don't have to have suds installed. best, burak From burak.arslan at arskom.com.tr Mon Dec 5 18:33:33 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 05 Dec 2011 19:33:33 +0200 Subject: [Soap-Python] rpclib - very strange problem In-Reply-To: <20111205165555.6797A2FC@pobox.sk> References: <20111205165555.6797A2FC@pobox.sk> Message-ID: <4EDD006D.1070004@arskom.com.tr> On 12/05/11 17:55, azurIt wrote: > > Any hints ? :) patch rpclib code to instrument the out_object attribute. have the instrumentation spit tracebacks on assignments. that way you'll be able to track where that strange value comes from. off the top of my head, add these to the MethodContext class: def get_out_object(self): return self.__out_object def set_out_object(self, what): import traceback traceback.print_stack() self.__out_object = what out_object = property(get_out_object, set_out_object) every _second_ request? heh, that's fun :) good luck, burak > azur > _______________________________________________ > Soap mailing list > Soap at python.org > http://mail.python.org/mailman/listinfo/soap From frank at chagford.com Tue Dec 6 09:28:57 2011 From: frank at chagford.com (Frank Millman) Date: Tue, 6 Dec 2011 10:28:57 +0200 Subject: [Soap-Python] Small error running rpclib under python3 - found and fixed In-Reply-To: <4EDCEDAE.3090001@arskom.com.tr> Message-ID: <3SyGV36kZBzM02@mail.python.org> On 05 December 2011 18:14 Burak Arslan wrote: > > Hi Frank, > > I've also made a comment on github because it'd be easier to read than > an email. > > https://github.com/arskom/rpclib/issues/113#issuecomment-3018892 > [...] > > using curl, you don't have to have suds installed. > Ok, I have got a bit further. It runs, then fails with an error. I fix the error and it fails with another one. So far, the errors are all of the same type. There are many instances of code that look like this - something = ''.join(something_else) They all fail with TypeError: sequence item 0: expected str instance, bytes found I have been fixing them by replacing the line with 'something = list(something)[0]', or whatever seems appropriate in the context, but I am really just doing this blindly, so this seems like a good place to stop and report back my findings. These are the instances I have fixed so far - protocol/soap/soap11.py, line 75 - - xml_string = ''.join(xml_string) + xml_string = list(xml_string)[0] server/wsgi.py, line 217 (it was trying to report an error - I had the incorrect file name) - - ctx.out_string = [''.join(ctx.out_string)] + ctx.out_string = list(ctx.out_string) model/binary.py, line 65 - - return [base64.b64decode(''.join(value))] + return [base64.b64decode(list(value)[0])] Now it is failing on protocol/xml/model/binary.py, line 38 - element.text = ''.join(cls.to_base64(value)) This is where I have stopped for now. Hopefully this is useful information. I will be happy to take this further if you would like. Frank From jiaxiaolei19871112 at gmail.com Tue Dec 6 15:03:17 2011 From: jiaxiaolei19871112 at gmail.com (=?UTF-8?B?6LS+5pmT56OK?=) Date: Tue, 6 Dec 2011 22:03:17 +0800 Subject: [Soap-Python] some questions about soaplib Message-ID: Hi, all: Recently, I have been do something about python webservice. Above all the methods of python webservice, soaplib is welcome and popular. When using soaplib, some problems puzzled me as follows. porlbem 1: soaplib provide client-side or not? Usually, I use soaplib as follows: # file-name: soaplib_server.py: # -*- coding:utf-8 -*- from soaplib.wsgi_soap import SimpleWSGISoapApp from soaplib.service import soapmethod from soaplib.serializers.clazz import ClassSerializer from soaplib.serializers.primitive import String, Integer, Array, DateTime class SMS(ClassSerializer): class types: mobile = String content = String class SMSService(SimpleWSGISoapApp): @soapmethod(String, _returns=Array(SMS)) def get_sms(self,id): sms_lst = [] sms = SMS() sms.mobile = "13011292217" sms.content = "hi, it's a test!" sms_lst.append(sms) return sms_lst def make_client(): from soaplib.client import make_service_client client = make_service_client('http://localhost:7789/' ,SMSService()) return client if __name__=='__main__': try: from wsgiref.simple_server import make_server server = make_server('localhost', 7789,SMSService()) server.serve_forever() except ImportError: print "Error: example server code requires Python >= 2.5" #file-name: suds_client.py import suds def test_soaplib3(): import logging logging.basicConfig(level=logging.ERROR) url = "http://localhost:7789/?wsdl" client = suds.client.Client(url,cache=None) print 'client', client output = client.service.get_sms('jia') print 'output', output #NOTE: Certainly, it's okay. Below is the output: #output: client Suds ( https://fedorahosted.org/suds/ ) version: 0.3.7 GA build: R580-20091016 Service ( SMSService ) tns="SMSService.SMSService" Prefixes (1) ns0 = "SMSService.SMSService" Ports (1): (SMSService) Methods (1): get_sms(xs:string id, ) Types (4): SMS SMSArray get_sms get_smsResponse output (SMSArray){ _type = "tns:SMSArray" SMS[] = (SMS){ content = "hi, it's a test!" mobile = "13011292217" }, } #NOTE: do you find the "def make_client():" in the server-side ? It's no use when we use suds_client.py. Now, let me talk the problem: I think soaplib is only a server-side and without client, you also can find the words as follows in "http://soaplib.github.com/soaplib/2_0/": "Soaplib is an easy to use Python library for publishing SOAP web services using WSDL 1.1 standard, and answering SOAP 1.1 requests. With a very small amount of code, soaplib allows you to write a useful web service and deploy it as a WSGI application. (Non-WSGI scenarios are also supported.)" Most of scenes, soaplib make as server and suds did for client. They can work together well. In a web page, I found someone use client by soaplib, the client can be write as follows: # file-name: soaplib_client.py # -*- coding:utf-8 -*- from soaplib_server3 import SMSService from soaplib_server3 import make_client import lxml.etree as et a = make_client() ret = a.get_sms('jia') print 'ret:', ret print 'type of ret:', type(ret) for i,r in enumerate(ret): print 'i:',i, r.mobile, r.content #output: ret: [] type of ret: i: 0 13011292217 hi, it's a test! #NOTE: now, the questions are : 1: Whether soaplib can provide client? 2: If the answer for question 1 is okay, then the second question is : how to provide a webservice client using soaplib? Is the method "client = make_service_client('http://localhost:7789/' ,SMSService())" which is be used in my soaplib_serve.py? 3: if you agree that soaplib can make as websevice client-side, I would like to ask: The client relays so heavily on sever-side, in the client-side, it requests some classes or modules in server side are imported. If we use soaplib-client to invoke a remote server(it may be developed in Java, C#, php or other language, or python which is not in the some local), how we get the class in server? I do not whether i speak my question clearly. In actual fact, what I eager to know is how to provide a client-side using soaplib if soaplib can. part 2: Is there someone find it spend much time and not stable to invoke soaplib using suds as follows. #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(): url = "http://localhost:7789/?wsdl" 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", } ? or the exception below(it?s not present 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 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 time and concentration. Any relay is welcome. -- Jia Xiaolei -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Tue Dec 6 15:59:05 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Tue, 06 Dec 2011 16:59:05 +0200 Subject: [Soap-Python] some questions about soaplib In-Reply-To: References: Message-ID: <4EDE2DB9.4030908@arskom.com.tr> Hi Jia, If you need a soap client, just use suds and don't bother with rpclib/soaplib. It's just incomplete. Currently, the only advantage of using rpclib as a soap client is its speed and if you need speed that bad, you should not be using soap (or xml) anyway. Does this answer your question, or is there any more questions hidden in the heap below? best, burak On 12/06/11 16:03, ??? wrote: > Hi, all: > > Recently, I have been do something about python webservice. Above all > the methods of python webservice, soaplib is welcome and popular. When > using soaplib, some problems puzzled me as follows. > > porlbem 1: soaplib provide client-side or not? > Usually, I use soaplib as follows: > > # file-name: soaplib_server.py: > # -*- coding:utf-8 -*- > > from soaplib.wsgi_soap import SimpleWSGISoapApp > from soaplib.service import soapmethod > from soaplib.serializers.clazz import ClassSerializer > from soaplib.serializers.primitive import String, Integer, Array, DateTime > > > class SMS(ClassSerializer): > class types: > mobile = String > content = String > > class SMSService(SimpleWSGISoapApp): > @soapmethod(String, _returns=Array(SMS)) > def get_sms(self,id): > sms_lst = [] > sms = SMS() > sms.mobile = "13011292217" > sms.content = "hi, it's a test!" > sms_lst.append(sms) > return sms_lst > > def make_client(): > from soaplib.client import make_service_client > client = make_service_client('http://localhost:7789/' ,SMSService()) > return client > > if __name__=='__main__': > try: > from wsgiref.simple_server import make_server > server = make_server('localhost', 7789,SMSService()) > server.serve_forever() > except ImportError: > print "Error: example server code requires Python >= 2.5" > > #file-name: suds_client.py > import suds > > def test_soaplib3(): > import logging > logging.basicConfig(level=logging.ERROR) > > url = "http://localhost:7789/?wsdl" > client = suds.client.Client(url,cache=None) > print 'client', client > output = client.service.get_sms('jia') > print 'output', output > > #NOTE: Certainly, it's okay. Below is the output: > > #output: > client > Suds ( https://fedorahosted.org/suds/ ) version: 0.3.7 GA build: > R580-20091016 > > Service ( SMSService ) tns="SMSService.SMSService" > Prefixes (1) > ns0 = "SMSService.SMSService" > Ports (1): > (SMSService) > Methods (1): > get_sms(xs:string id, ) > Types (4): > SMS > SMSArray > get_sms > get_smsResponse > > > output (SMSArray){ > _type = "tns:SMSArray" > SMS[] = > (SMS){ > content = "hi, it's a test!" > mobile = "13011292217" > }, > } > > #NOTE: do you find the "def make_client():" in the server-side ? It's > no use when we use suds_client.py. Now, let me talk the problem: > I think soaplib is only a server-side and without client, you also can > find the words as follows in "http://soaplib.github.com/soaplib/2_0/": > "Soaplib is an easy to use Python library for publishing SOAP web > services using WSDL 1.1 standard, and answering SOAP 1.1 requests. > With a very small amount of code, soaplib allows you to write a useful > web service and deploy it as a WSGI application. (Non-WSGI scenarios > are also supported.)" > Most of scenes, soaplib make as server and suds did for client. They > can work together well. > In a web page, I found someone use client by soaplib, the client can > be write as follows: > > # file-name: soaplib_client.py > # -*- coding:utf-8 -*- > > from soaplib_server3 import SMSService > from soaplib_server3 import make_client > import lxml.etree as et > > a = make_client() > ret = a.get_sms('jia') > print 'ret:', ret > print 'type of ret:', type(ret) > for i,r in enumerate(ret): > print 'i:',i, r.mobile, r.content > > #output: > ret: [] > type of ret: > i: 0 13011292217 hi, it's a test! > > #NOTE: now, the questions are : > 1: Whether soaplib can provide client? > 2: If the answer for question 1 is okay, then the second question is : > how to provide a webservice client using soaplib? Is the method > "client = make_service_client('http://localhost:7789/' ,SMSService())" > which is be used in my soaplib_serve.py? > 3: if you agree that soaplib can make as websevice client-side, I > would like to ask:?The client relays so heavily on sever-side, in the > client-side, it requests some classes or modules in server side are > imported. If we use soaplib-client to invoke a remote server(it may be > developed in Java, C#, php or other language, or python which is not > in the some local), how we get the class in server? > > I do not whether i speak my question clearly. In actual fact, what I > eager to know is how to provide a client-side using soaplib if soaplib > can. > > part 2: Is there someone find it spend much time and not stable to > invoke soaplib using suds as follows. > #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(): > > url = "http://localhost:7789/?wsdl" > 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", > } > ? > or the exception below(it?s not present 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 > 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 time and concentration. Any relay is welcome. > > -- Jia Xiaolei > > > _______________________________________________ > Soap mailing list > Soap at python.org > http://mail.python.org/mailman/listinfo/soap -------------- next part -------------- An HTML attachment was scrubbed... URL: From azurit at pobox.sk Tue Dec 6 17:14:12 2011 From: azurit at pobox.sk (azurIt) Date: Tue, 06 Dec 2011 17:14:12 +0100 Subject: [Soap-Python] rpclib - very strange problem In-Reply-To: <4EDD006D.1070004@arskom.com.tr> References: <20111205165555.6797A2FC@pobox.sk> <4EDD006D.1070004@arskom.com.tr> Message-ID: <20111206171412.5226202B@pobox.sk> Burak, can you, please, help me with this a little more? Where exactly should i put that code? Into _base.py file? Thank you! azur ______________________________________________________________ > Od: "Burak Arslan" > Komu: azurIt > D?tum: 05.12.2011 18:33 > Predmet: Re: [Soap-Python] rpclib - very strange problem > > CC: soap at python.org >On 12/05/11 17:55, azurIt wrote: >> >> Any hints ? :) > >patch rpclib code to instrument the out_object attribute. have the >instrumentation spit tracebacks on assignments. that way you'll be able >to track where that strange value comes from. > >off the top of my head, add these to the MethodContext class: > >def get_out_object(self): > return self.__out_object > >def set_out_object(self, what): > import traceback > traceback.print_stack() > self.__out_object = what > >out_object = property(get_out_object, set_out_object) > >every _second_ request? heh, that's fun :) > >good luck, >burak > > >> azur >> _______________________________________________ >> Soap mailing list >> Soap at python.org >> http://mail.python.org/mailman/listinfo/soap > > From burak.arslan at arskom.com.tr Tue Dec 6 17:19:36 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Tue, 06 Dec 2011 18:19:36 +0200 Subject: [Soap-Python] rpclib - very strange problem In-Reply-To: <20111206171412.5226202B@pobox.sk> References: <20111205165555.6797A2FC@pobox.sk> <4EDD006D.1070004@arskom.com.tr> <20111206171412.5226202B@pobox.sk> Message-ID: <4EDE4098.8020706@arskom.com.tr> On 12/06/11 18:14, azurIt wrote: > Burak, > > can you, please, help me with this a little more? Where exactly should i put that code? Into _base.py file? Thank you! > > azur yes, in the MethodContext class, like so: class MethodContext(object): def get_out_object(self): return self.__out_object def set_out_object(self, what): import traceback traceback.print_stack() self.__out_object = what out_object = property(get_out_object, set_out_object) # (...) # rest of the class definition hth, burak > > ______________________________________________________________ >> Od: "Burak Arslan" >> Komu: azurIt >> D?tum: 05.12.2011 18:33 >> Predmet: Re: [Soap-Python] rpclib - very strange problem >> >> CC: soap at python.org >> On 12/05/11 17:55, azurIt wrote: >>> Any hints ? :) >> patch rpclib code to instrument the out_object attribute. have the >> instrumentation spit tracebacks on assignments. that way you'll be able >> to track where that strange value comes from. >> >> off the top of my head, add these to the MethodContext class: >> >> def get_out_object(self): >> return self.__out_object >> >> def set_out_object(self, what): >> import traceback >> traceback.print_stack() >> self.__out_object = what >> >> out_object = property(get_out_object, set_out_object) >> >> every _second_ request? heh, that's fun :) >> >> good luck, >> burak >> >> >>> azur >>> _______________________________________________ >>> Soap mailing list >>> Soap at python.org >>> http://mail.python.org/mailman/listinfo/soap >> > _______________________________________________ > Soap mailing list > Soap at python.org > http://mail.python.org/mailman/listinfo/soap From azurit at pobox.sk Tue Dec 6 17:46:10 2011 From: azurit at pobox.sk (azurIt) Date: Tue, 06 Dec 2011 17:46:10 +0100 Subject: [Soap-Python] rpclib - very strange problem In-Reply-To: <4EDE4098.8020706@arskom.com.tr> References: <20111205165555.6797A2FC@pobox.sk>, <4EDD006D.1070004@arskom.com.tr>, <20111206171412.5226202B@pobox.sk> <4EDE4098.8020706@arskom.com.tr> Message-ID: <20111206174610.138D675E@pobox.sk> Sorry for bordering, i would write/fix it by myself but i don't fully understand your code. This is what it is doing now: Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/application.py", line 102, in process_request ctx.out_object = self.call_wrapper(ctx) File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 191, in __setattr__ raise ValueError("use the udc member for storing arbitrary data " ValueError: use the udc member for storing arbitrary data in the method context ______________________________________________________________ > Od: "Burak Arslan" > Komu: azurIt > D?tum: 06.12.2011 17:19 > Predmet: Re: [Soap-Python] rpclib - very strange problem > > CC: soap at python.org >On 12/06/11 18:14, azurIt wrote: >> Burak, >> >> can you, please, help me with this a little more? Where exactly should i put that code? Into _base.py file? Thank you! >> >> azur > >yes, in the MethodContext class, like so: > >class MethodContext(object): > def get_out_object(self): > return self.__out_object > > def set_out_object(self, what): > import traceback > traceback.print_stack() > self.__out_object = what > > out_object = property(get_out_object, set_out_object) > > # (...) > # rest of the class definition > >hth, >burak > > > >> >> ______________________________________________________________ >>> Od: "Burak Arslan" >>> Komu: azurIt >>> D?tum: 05.12.2011 18:33 >>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>> >>> CC: soap at python.org >>> On 12/05/11 17:55, azurIt wrote: >>>> Any hints ? :) >>> patch rpclib code to instrument the out_object attribute. have the >>> instrumentation spit tracebacks on assignments. that way you'll be able >>> to track where that strange value comes from. >>> >>> off the top of my head, add these to the MethodContext class: >>> >>> def get_out_object(self): >>> return self.__out_object >>> >>> def set_out_object(self, what): >>> import traceback >>> traceback.print_stack() >>> self.__out_object = what >>> >>> out_object = property(get_out_object, set_out_object) >>> >>> every _second_ request? heh, that's fun :) >>> >>> good luck, >>> burak >>> >>> >>>> azur >>>> _______________________________________________ >>>> Soap mailing list >>>> Soap at python.org >>>> http://mail.python.org/mailman/listinfo/soap >>> >> _______________________________________________ >> Soap mailing list >> Soap at python.org >> http://mail.python.org/mailman/listinfo/soap > > From burak.arslan at arskom.com.tr Tue Dec 6 17:51:36 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Tue, 06 Dec 2011 18:51:36 +0200 Subject: [Soap-Python] rpclib - very strange problem In-Reply-To: <20111206174610.138D675E@pobox.sk> References: <20111205165555.6797A2FC@pobox.sk>, <4EDD006D.1070004@arskom.com.tr>, <20111206171412.5226202B@pobox.sk> <4EDE4098.8020706@arskom.com.tr> <20111206174610.138D675E@pobox.sk> Message-ID: <4EDE4818.2060309@arskom.com.tr> On 12/06/11 18:46, azurIt wrote: > Sorry for bordering, i would write/fix it by myself but i don't fully understand your code. This is what it is doing now: you should read about the property built-in. > > Traceback (most recent call last): > File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/application.py", line 102, in process_request > ctx.out_object = self.call_wrapper(ctx) > File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 191, in __setattr__ > raise ValueError("use the udc member for storing arbitrary data " > ValueError: use the udc member for storing arbitrary data in the method context set self.frozen to false in the constructor's last line. i'd forgotten about the __getattr__ in that class, you can modify that as well if you understand better what that does. burak > > > ______________________________________________________________ >> Od: "Burak Arslan" >> Komu: azurIt >> D?tum: 06.12.2011 17:19 >> Predmet: Re: [Soap-Python] rpclib - very strange problem >> >> CC: soap at python.org >> On 12/06/11 18:14, azurIt wrote: >>> Burak, >>> >>> can you, please, help me with this a little more? Where exactly should i put that code? Into _base.py file? Thank you! >>> >>> azur >> yes, in the MethodContext class, like so: >> >> class MethodContext(object): >> def get_out_object(self): >> return self.__out_object >> >> def set_out_object(self, what): >> import traceback >> traceback.print_stack() >> self.__out_object = what >> >> out_object = property(get_out_object, set_out_object) >> >> # (...) >> # rest of the class definition >> >> hth, >> burak >> >> >> >>> ______________________________________________________________ >>>> Od: "Burak Arslan" >>>> Komu: azurIt >>>> D?tum: 05.12.2011 18:33 >>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>> >>>> CC: soap at python.org >>>> On 12/05/11 17:55, azurIt wrote: >>>>> Any hints ? :) >>>> patch rpclib code to instrument the out_object attribute. have the >>>> instrumentation spit tracebacks on assignments. that way you'll be able >>>> to track where that strange value comes from. >>>> >>>> off the top of my head, add these to the MethodContext class: >>>> >>>> def get_out_object(self): >>>> return self.__out_object >>>> >>>> def set_out_object(self, what): >>>> import traceback >>>> traceback.print_stack() >>>> self.__out_object = what >>>> >>>> out_object = property(get_out_object, set_out_object) >>>> >>>> every _second_ request? heh, that's fun :) >>>> >>>> good luck, >>>> burak >>>> >>>> >>>>> azur >>>>> _______________________________________________ >>>>> Soap mailing list >>>>> Soap at python.org >>>>> http://mail.python.org/mailman/listinfo/soap >>> _______________________________________________ >>> Soap mailing list >>> Soap at python.org >>> http://mail.python.org/mailman/listinfo/soap >> > _______________________________________________ > Soap mailing list > Soap at python.org > http://mail.python.org/mailman/listinfo/soap From burak.arslan at arskom.com.tr Tue Dec 6 17:53:01 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Tue, 06 Dec 2011 18:53:01 +0200 Subject: [Soap-Python] rpclib - very strange problem In-Reply-To: <4EDE4818.2060309@arskom.com.tr> References: <20111205165555.6797A2FC@pobox.sk>, <4EDD006D.1070004@arskom.com.tr>, <20111206171412.5226202B@pobox.sk> <4EDE4098.8020706@arskom.com.tr> <20111206174610.138D675E@pobox.sk> <4EDE4818.2060309@arskom.com.tr> Message-ID: <4EDE486D.7000009@arskom.com.tr> On 12/06/11 18:51, Burak Arslan wrote: > On 12/06/11 18:46, azurIt wrote: >> Sorry for bordering, i would write/fix it by myself but i don't fully understand your code. This is what it is doing now: > you should read about the property built-in. > >> Traceback (most recent call last): >> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/application.py", line 102, in process_request >> ctx.out_object = self.call_wrapper(ctx) >> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 191, in __setattr__ >> raise ValueError("use the udc member for storing arbitrary data " >> ValueError: use the udc member for storing arbitrary data in the method context > set self.frozen to false in the constructor's last line. or rather add self.__out_object=None to the ctor. > i'd forgotten about the __getattr__ in that class, you can modify that > as well if you understand better what that does. > > burak >> >> ______________________________________________________________ >>> Od: "Burak Arslan" >>> Komu: azurIt >>> D?tum: 06.12.2011 17:19 >>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>> >>> CC: soap at python.org >>> On 12/06/11 18:14, azurIt wrote: >>>> Burak, >>>> >>>> can you, please, help me with this a little more? Where exactly should i put that code? Into _base.py file? Thank you! >>>> >>>> azur >>> yes, in the MethodContext class, like so: >>> >>> class MethodContext(object): >>> def get_out_object(self): >>> return self.__out_object >>> >>> def set_out_object(self, what): >>> import traceback >>> traceback.print_stack() >>> self.__out_object = what >>> >>> out_object = property(get_out_object, set_out_object) >>> >>> # (...) >>> # rest of the class definition >>> >>> hth, >>> burak >>> >>> >>> >>>> ______________________________________________________________ >>>>> Od: "Burak Arslan" >>>>> Komu: azurIt >>>>> D?tum: 05.12.2011 18:33 >>>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>>> >>>>> CC: soap at python.org >>>>> On 12/05/11 17:55, azurIt wrote: >>>>>> Any hints ? :) >>>>> patch rpclib code to instrument the out_object attribute. have the >>>>> instrumentation spit tracebacks on assignments. that way you'll be able >>>>> to track where that strange value comes from. >>>>> >>>>> off the top of my head, add these to the MethodContext class: >>>>> >>>>> def get_out_object(self): >>>>> return self.__out_object >>>>> >>>>> def set_out_object(self, what): >>>>> import traceback >>>>> traceback.print_stack() >>>>> self.__out_object = what >>>>> >>>>> out_object = property(get_out_object, set_out_object) >>>>> >>>>> every _second_ request? heh, that's fun :) >>>>> >>>>> good luck, >>>>> burak >>>>> >>>>> >>>>>> azur >>>>>> _______________________________________________ >>>>>> Soap mailing list >>>>>> Soap at python.org >>>>>> http://mail.python.org/mailman/listinfo/soap >>>> _______________________________________________ >>>> Soap mailing list >>>> Soap at python.org >>>> http://mail.python.org/mailman/listinfo/soap >> _______________________________________________ >> Soap mailing list >> Soap at python.org >> http://mail.python.org/mailman/listinfo/soap > _______________________________________________ > Soap mailing list > Soap at python.org > http://mail.python.org/mailman/listinfo/soap From azurit at pobox.sk Tue Dec 6 18:43:07 2011 From: azurit at pobox.sk (azurIt) Date: Tue, 06 Dec 2011 18:43:07 +0100 Subject: [Soap-Python] rpclib - very strange problem In-Reply-To: <4EDE486D.7000009@arskom.com.tr> References: <20111205165555.6797A2FC@pobox.sk>, <4EDD006D.1070004@arskom.com.tr>, <20111206171412.5226202B@pobox.sk>, <4EDE4098.8020706@arskom.com.tr>, <20111206174610.138D675E@pobox.sk>, <4EDE4818.2060309@arskom.com.tr> <4EDE486D.7000009@arskom.com.tr> Message-ID: <20111206184307.222350AF@pobox.sk> cool, it's working now. problem is that traceback for both cases (where result is ok and is not ok) looks the same: File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/wsgi.py", line 168, in __call__ return self.__handle_rpc(req_env, start_response) File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/wsgi.py", line 239, in __handle_rpc self.get_out_object(ctx) File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/_base.py", line 73, in get_out_object self.app.process_request(ctx) File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/application.py", line 102, in process_request ctx.out_object = self.call_wrapper(ctx) File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 190, in __setattr__ object.__setattr__(self, k, v) File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 51, in set_out_object traceback.print_stack() i can only see rpclib code, not mine. any hints how can i show something more ? thnx!!! azur ______________________________________________________________ > Od: "Burak Arslan" > Komu: azurIt > D?tum: 06.12.2011 17:53 > Predmet: Re: [Soap-Python] rpclib - very strange problem > > CC: soap at python.org >On 12/06/11 18:51, Burak Arslan wrote: >> On 12/06/11 18:46, azurIt wrote: >>> Sorry for bordering, i would write/fix it by myself but i don't fully understand your code. This is what it is doing now: >> you should read about the property built-in. >> >>> Traceback (most recent call last): >>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/application.py", line 102, in process_request >>> ctx.out_object = self.call_wrapper(ctx) >>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 191, in __setattr__ >>> raise ValueError("use the udc member for storing arbitrary data " >>> ValueError: use the udc member for storing arbitrary data in the method context >> set self.frozen to false in the constructor's last line. > >or rather add self.__out_object=None to the ctor. > >> i'd forgotten about the __getattr__ in that class, you can modify that >> as well if you understand better what that does. >> >> burak >>> >>> ______________________________________________________________ >>>> Od: "Burak Arslan" >>>> Komu: azurIt >>>> D?tum: 06.12.2011 17:19 >>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>> >>>> CC: soap at python.org >>>> On 12/06/11 18:14, azurIt wrote: >>>>> Burak, >>>>> >>>>> can you, please, help me with this a little more? Where exactly should i put that code? Into _base.py file? Thank you! >>>>> >>>>> azur >>>> yes, in the MethodContext class, like so: >>>> >>>> class MethodContext(object): >>>> def get_out_object(self): >>>> return self.__out_object >>>> >>>> def set_out_object(self, what): >>>> import traceback >>>> traceback.print_stack() >>>> self.__out_object = what >>>> >>>> out_object = property(get_out_object, set_out_object) >>>> >>>> # (...) >>>> # rest of the class definition >>>> >>>> hth, >>>> burak >>>> >>>> >>>> >>>>> ______________________________________________________________ >>>>>> Od: "Burak Arslan" >>>>>> Komu: azurIt >>>>>> D?tum: 05.12.2011 18:33 >>>>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>>>> >>>>>> CC: soap at python.org >>>>>> On 12/05/11 17:55, azurIt wrote: >>>>>>> Any hints ? :) >>>>>> patch rpclib code to instrument the out_object attribute. have the >>>>>> instrumentation spit tracebacks on assignments. that way you'll be able >>>>>> to track where that strange value comes from. >>>>>> >>>>>> off the top of my head, add these to the MethodContext class: >>>>>> >>>>>> def get_out_object(self): >>>>>> return self.__out_object >>>>>> >>>>>> def set_out_object(self, what): >>>>>> import traceback >>>>>> traceback.print_stack() >>>>>> self.__out_object = what >>>>>> >>>>>> out_object = property(get_out_object, set_out_object) >>>>>> >>>>>> every _second_ request? heh, that's fun :) >>>>>> >>>>>> good luck, >>>>>> burak >>>>>> >>>>>> >>>>>>> azur >>>>>>> _______________________________________________ >>>>>>> Soap mailing list >>>>>>> Soap at python.org >>>>>>> http://mail.python.org/mailman/listinfo/soap >>>>> _______________________________________________ >>>>> Soap mailing list >>>>> Soap at python.org >>>>> http://mail.python.org/mailman/listinfo/soap >>> _______________________________________________ >>> Soap mailing list >>> Soap at python.org >>> http://mail.python.org/mailman/listinfo/soap >> _______________________________________________ >> Soap mailing list >> Soap at python.org >> http://mail.python.org/mailman/listinfo/soap > > From azurit at pobox.sk Tue Dec 6 18:48:16 2011 From: azurit at pobox.sk (azurIt) Date: Tue, 06 Dec 2011 18:48:16 +0100 Subject: [Soap-Python] rpclib - very strange problem In-Reply-To: <20111206184307.222350AF@pobox.sk> References: <20111205165555.6797A2FC@pobox.sk>, <4EDD006D.1070004@arskom.com.tr>, <20111206171412.5226202B@pobox.sk>, <4EDE4098.8020706@arskom.com.tr>, <20111206174610.138D675E@pobox.sk>, <4EDE4818.2060309@arskom.com.tr>, <4EDE486D.7000009@arskom.com.tr> <20111206184307.222350AF@pobox.sk> Message-ID: <20111206184816.DE38E0CF@pobox.sk> Burak, i got something!! :) i'm running two wsgi processes for my wsgi application (via mod_wsgi). invalid result is always returned by first of them and valid result is always returned by the second (until i restart wsgi app). this is why every second request gets crazy (there's a 50% chance). now why is this happening ? some kind of desynchronization between processes ? ______________________________________________________________ > Od: "azurIt" > Komu: > D?tum: 06.12.2011 18:43 > Predmet: Re: [Soap-Python] rpclib - very strange problem > >cool, it's working now. problem is that traceback for both cases (where result is ok and is not ok) looks the same: > > >File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/wsgi.py", line 168, in __call__ > return self.__handle_rpc(req_env, start_response) >File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/wsgi.py", line 239, in __handle_rpc > self.get_out_object(ctx) >File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/_base.py", line 73, in get_out_object > self.app.process_request(ctx) >File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/application.py", line 102, in process_request > ctx.out_object = self.call_wrapper(ctx) >File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 190, in __setattr__ > object.__setattr__(self, k, v) >File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 51, in set_out_object > traceback.print_stack() > > >i can only see rpclib code, not mine. any hints how can i show something more ? thnx!!! > >azur > > >______________________________________________________________ >> Od: "Burak Arslan" >> Komu: azurIt >> D?tum: 06.12.2011 17:53 >> Predmet: Re: [Soap-Python] rpclib - very strange problem >> >> CC: soap at python.org >>On 12/06/11 18:51, Burak Arslan wrote: >>> On 12/06/11 18:46, azurIt wrote: >>>> Sorry for bordering, i would write/fix it by myself but i don't fully understand your code. This is what it is doing now: >>> you should read about the property built-in. >>> >>>> Traceback (most recent call last): >>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/application.py", line 102, in process_request >>>> ctx.out_object = self.call_wrapper(ctx) >>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 191, in __setattr__ >>>> raise ValueError("use the udc member for storing arbitrary data " >>>> ValueError: use the udc member for storing arbitrary data in the method context >>> set self.frozen to false in the constructor's last line. >> >>or rather add self.__out_object=None to the ctor. >> >>> i'd forgotten about the __getattr__ in that class, you can modify that >>> as well if you understand better what that does. >>> >>> burak >>>> >>>> ______________________________________________________________ >>>>> Od: "Burak Arslan" >>>>> Komu: azurIt >>>>> D?tum: 06.12.2011 17:19 >>>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>>> >>>>> CC: soap at python.org >>>>> On 12/06/11 18:14, azurIt wrote: >>>>>> Burak, >>>>>> >>>>>> can you, please, help me with this a little more? Where exactly should i put that code? Into _base.py file? Thank you! >>>>>> >>>>>> azur >>>>> yes, in the MethodContext class, like so: >>>>> >>>>> class MethodContext(object): >>>>> def get_out_object(self): >>>>> return self.__out_object >>>>> >>>>> def set_out_object(self, what): >>>>> import traceback >>>>> traceback.print_stack() >>>>> self.__out_object = what >>>>> >>>>> out_object = property(get_out_object, set_out_object) >>>>> >>>>> # (...) >>>>> # rest of the class definition >>>>> >>>>> hth, >>>>> burak >>>>> >>>>> >>>>> >>>>>> ______________________________________________________________ >>>>>>> Od: "Burak Arslan" >>>>>>> Komu: azurIt >>>>>>> D?tum: 05.12.2011 18:33 >>>>>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>>>>> >>>>>>> CC: soap at python.org >>>>>>> On 12/05/11 17:55, azurIt wrote: >>>>>>>> Any hints ? :) >>>>>>> patch rpclib code to instrument the out_object attribute. have the >>>>>>> instrumentation spit tracebacks on assignments. that way you'll be able >>>>>>> to track where that strange value comes from. >>>>>>> >>>>>>> off the top of my head, add these to the MethodContext class: >>>>>>> >>>>>>> def get_out_object(self): >>>>>>> return self.__out_object >>>>>>> >>>>>>> def set_out_object(self, what): >>>>>>> import traceback >>>>>>> traceback.print_stack() >>>>>>> self.__out_object = what >>>>>>> >>>>>>> out_object = property(get_out_object, set_out_object) >>>>>>> >>>>>>> every _second_ request? heh, that's fun :) >>>>>>> >>>>>>> good luck, >>>>>>> burak >>>>>>> >>>>>>> >>>>>>>> azur >>>>>>>> _______________________________________________ >>>>>>>> Soap mailing list >>>>>>>> Soap at python.org >>>>>>>> http://mail.python.org/mailman/listinfo/soap >>>>>> _______________________________________________ >>>>>> Soap mailing list >>>>>> Soap at python.org >>>>>> http://mail.python.org/mailman/listinfo/soap >>>> _______________________________________________ >>>> Soap mailing list >>>> Soap at python.org >>>> http://mail.python.org/mailman/listinfo/soap >>> _______________________________________________ >>> Soap mailing list >>> Soap at python.org >>> http://mail.python.org/mailman/listinfo/soap >> >> >_______________________________________________ >Soap mailing list >Soap at python.org >http://mail.python.org/mailman/listinfo/soap > From burak.arslan at arskom.com.tr Tue Dec 6 18:49:20 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Tue, 06 Dec 2011 19:49:20 +0200 Subject: [Soap-Python] rpclib - very strange problem In-Reply-To: <20111206184307.222350AF@pobox.sk> References: <20111205165555.6797A2FC@pobox.sk>, <4EDD006D.1070004@arskom.com.tr>, <20111206171412.5226202B@pobox.sk>, <4EDE4098.8020706@arskom.com.tr>, <20111206174610.138D675E@pobox.sk>, <4EDE4818.2060309@arskom.com.tr> <4EDE486D.7000009@arskom.com.tr> <20111206184307.222350AF@pobox.sk> Message-ID: <4EDE55A0.5040704@arskom.com.tr> On 12/06/11 19:43, azurIt wrote: > cool, it's working now. problem is that traceback for both cases (where result is ok and is not ok) looks the same: > > > File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/wsgi.py", line 168, in __call__ > return self.__handle_rpc(req_env, start_response) > File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/wsgi.py", line 239, in __handle_rpc > self.get_out_object(ctx) > File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/_base.py", line 73, in get_out_object > self.app.process_request(ctx) > File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/application.py", line 102, in process_request > ctx.out_object = self.call_wrapper(ctx) > File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 190, in __setattr__ > object.__setattr__(self, k, v) > File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 51, in set_out_object > traceback.print_stack() > > > i can only see rpclib code, not mine. any hints how can i show something more ? thnx!!! i was assuming you'd concluded that this was not a problem with your code but with rpclib. you are supposed to track when assignments occur for both cases and find a difference. e.g. when an assignment operation required assignment does not occur, hence you get incorrect results. there *has* to be a difference between the two cases. yes, that's a long shot but the problem you're seeing is also quite strange. hope that helps burak > azur > > > ______________________________________________________________ >> Od: "Burak Arslan" >> Komu: azurIt >> D?tum: 06.12.2011 17:53 >> Predmet: Re: [Soap-Python] rpclib - very strange problem >> >> CC: soap at python.org >> On 12/06/11 18:51, Burak Arslan wrote: >>> On 12/06/11 18:46, azurIt wrote: >>>> Sorry for bordering, i would write/fix it by myself but i don't fully understand your code. This is what it is doing now: >>> you should read about the property built-in. >>> >>>> Traceback (most recent call last): >>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/application.py", line 102, in process_request >>>> ctx.out_object = self.call_wrapper(ctx) >>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 191, in __setattr__ >>>> raise ValueError("use the udc member for storing arbitrary data " >>>> ValueError: use the udc member for storing arbitrary data in the method context >>> set self.frozen to false in the constructor's last line. >> or rather add self.__out_object=None to the ctor. >> >>> i'd forgotten about the __getattr__ in that class, you can modify that >>> as well if you understand better what that does. >>> >>> burak >>>> ______________________________________________________________ >>>>> Od: "Burak Arslan" >>>>> Komu: azurIt >>>>> D?tum: 06.12.2011 17:19 >>>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>>> >>>>> CC: soap at python.org >>>>> On 12/06/11 18:14, azurIt wrote: >>>>>> Burak, >>>>>> >>>>>> can you, please, help me with this a little more? Where exactly should i put that code? Into _base.py file? Thank you! >>>>>> >>>>>> azur >>>>> yes, in the MethodContext class, like so: >>>>> >>>>> class MethodContext(object): >>>>> def get_out_object(self): >>>>> return self.__out_object >>>>> >>>>> def set_out_object(self, what): >>>>> import traceback >>>>> traceback.print_stack() >>>>> self.__out_object = what >>>>> >>>>> out_object = property(get_out_object, set_out_object) >>>>> >>>>> # (...) >>>>> # rest of the class definition >>>>> >>>>> hth, >>>>> burak >>>>> >>>>> >>>>> >>>>>> ______________________________________________________________ >>>>>>> Od: "Burak Arslan" >>>>>>> Komu: azurIt >>>>>>> D?tum: 05.12.2011 18:33 >>>>>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>>>>> >>>>>>> CC: soap at python.org >>>>>>> On 12/05/11 17:55, azurIt wrote: >>>>>>>> Any hints ? :) >>>>>>> patch rpclib code to instrument the out_object attribute. have the >>>>>>> instrumentation spit tracebacks on assignments. that way you'll be able >>>>>>> to track where that strange value comes from. >>>>>>> >>>>>>> off the top of my head, add these to the MethodContext class: >>>>>>> >>>>>>> def get_out_object(self): >>>>>>> return self.__out_object >>>>>>> >>>>>>> def set_out_object(self, what): >>>>>>> import traceback >>>>>>> traceback.print_stack() >>>>>>> self.__out_object = what >>>>>>> >>>>>>> out_object = property(get_out_object, set_out_object) >>>>>>> >>>>>>> every _second_ request? heh, that's fun :) >>>>>>> >>>>>>> good luck, >>>>>>> burak >>>>>>> >>>>>>> >>>>>>>> azur >>>>>>>> _______________________________________________ >>>>>>>> Soap mailing list >>>>>>>> Soap at python.org >>>>>>>> http://mail.python.org/mailman/listinfo/soap >>>>>> _______________________________________________ >>>>>> Soap mailing list >>>>>> Soap at python.org >>>>>> http://mail.python.org/mailman/listinfo/soap >>>> _______________________________________________ >>>> Soap mailing list >>>> Soap at python.org >>>> http://mail.python.org/mailman/listinfo/soap >>> _______________________________________________ >>> Soap mailing list >>> Soap at python.org >>> http://mail.python.org/mailman/listinfo/soap >> > _______________________________________________ > Soap mailing list > Soap at python.org > http://mail.python.org/mailman/listinfo/soap From burak.arslan at arskom.com.tr Tue Dec 6 18:52:36 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Tue, 06 Dec 2011 19:52:36 +0200 Subject: [Soap-Python] rpclib - very strange problem In-Reply-To: <20111206184816.DE38E0CF@pobox.sk> References: <20111205165555.6797A2FC@pobox.sk>, <4EDD006D.1070004@arskom.com.tr>, <20111206171412.5226202B@pobox.sk>, <4EDE4098.8020706@arskom.com.tr>, <20111206174610.138D675E@pobox.sk>, <4EDE4818.2060309@arskom.com.tr>, <4EDE486D.7000009@arskom.com.tr> <20111206184307.222350AF@pobox.sk> <20111206184816.DE38E0CF@pobox.sk> Message-ID: <4EDE5664.4060602@arskom.com.tr> On 12/06/11 19:48, azurIt wrote: > Burak, i got something!! :) i'm running two wsgi processes for my wsgi application (via mod_wsgi). invalid result is always returned by first of them and valid result is always returned by the second (until i restart wsgi app). this is why every second request gets crazy (there's a 50% chance). now why is this happening ? some kind of desynchronization between processes ? > ah, now it makes more sense. i'm not familiar with mod_wsgi, but i don't think mod_wsgi processes share information one way or the other. are you sure both initialize correctly? why not use twisted, cherrypy or any other pure-python http solution and use apache as a reverse-proxy? burak > ______________________________________________________________ >> Od: "azurIt" >> Komu: >> D?tum: 06.12.2011 18:43 >> Predmet: Re: [Soap-Python] rpclib - very strange problem >> >> cool, it's working now. problem is that traceback for both cases (where result is ok and is not ok) looks the same: >> >> >> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/wsgi.py", line 168, in __call__ >> return self.__handle_rpc(req_env, start_response) >> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/wsgi.py", line 239, in __handle_rpc >> self.get_out_object(ctx) >> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/_base.py", line 73, in get_out_object >> self.app.process_request(ctx) >> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/application.py", line 102, in process_request >> ctx.out_object = self.call_wrapper(ctx) >> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 190, in __setattr__ >> object.__setattr__(self, k, v) >> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 51, in set_out_object >> traceback.print_stack() >> >> >> i can only see rpclib code, not mine. any hints how can i show something more ? thnx!!! >> >> azur >> >> >> ______________________________________________________________ >>> Od: "Burak Arslan" >>> Komu: azurIt >>> D?tum: 06.12.2011 17:53 >>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>> >>> CC: soap at python.org >>> On 12/06/11 18:51, Burak Arslan wrote: >>>> On 12/06/11 18:46, azurIt wrote: >>>>> Sorry for bordering, i would write/fix it by myself but i don't fully understand your code. This is what it is doing now: >>>> you should read about the property built-in. >>>> >>>>> Traceback (most recent call last): >>>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/application.py", line 102, in process_request >>>>> ctx.out_object = self.call_wrapper(ctx) >>>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 191, in __setattr__ >>>>> raise ValueError("use the udc member for storing arbitrary data " >>>>> ValueError: use the udc member for storing arbitrary data in the method context >>>> set self.frozen to false in the constructor's last line. >>> or rather add self.__out_object=None to the ctor. >>> >>>> i'd forgotten about the __getattr__ in that class, you can modify that >>>> as well if you understand better what that does. >>>> >>>> burak >>>>> ______________________________________________________________ >>>>>> Od: "Burak Arslan" >>>>>> Komu: azurIt >>>>>> D?tum: 06.12.2011 17:19 >>>>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>>>> >>>>>> CC: soap at python.org >>>>>> On 12/06/11 18:14, azurIt wrote: >>>>>>> Burak, >>>>>>> >>>>>>> can you, please, help me with this a little more? Where exactly should i put that code? Into _base.py file? Thank you! >>>>>>> >>>>>>> azur >>>>>> yes, in the MethodContext class, like so: >>>>>> >>>>>> class MethodContext(object): >>>>>> def get_out_object(self): >>>>>> return self.__out_object >>>>>> >>>>>> def set_out_object(self, what): >>>>>> import traceback >>>>>> traceback.print_stack() >>>>>> self.__out_object = what >>>>>> >>>>>> out_object = property(get_out_object, set_out_object) >>>>>> >>>>>> # (...) >>>>>> # rest of the class definition >>>>>> >>>>>> hth, >>>>>> burak >>>>>> >>>>>> >>>>>> >>>>>>> ______________________________________________________________ >>>>>>>> Od: "Burak Arslan" >>>>>>>> Komu: azurIt >>>>>>>> D?tum: 05.12.2011 18:33 >>>>>>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>>>>>> >>>>>>>> CC: soap at python.org >>>>>>>> On 12/05/11 17:55, azurIt wrote: >>>>>>>>> Any hints ? :) >>>>>>>> patch rpclib code to instrument the out_object attribute. have the >>>>>>>> instrumentation spit tracebacks on assignments. that way you'll be able >>>>>>>> to track where that strange value comes from. >>>>>>>> >>>>>>>> off the top of my head, add these to the MethodContext class: >>>>>>>> >>>>>>>> def get_out_object(self): >>>>>>>> return self.__out_object >>>>>>>> >>>>>>>> def set_out_object(self, what): >>>>>>>> import traceback >>>>>>>> traceback.print_stack() >>>>>>>> self.__out_object = what >>>>>>>> >>>>>>>> out_object = property(get_out_object, set_out_object) >>>>>>>> >>>>>>>> every _second_ request? heh, that's fun :) >>>>>>>> >>>>>>>> good luck, >>>>>>>> burak >>>>>>>> >>>>>>>> >>>>>>>>> azur >>>>>>>>> _______________________________________________ >>>>>>>>> Soap mailing list >>>>>>>>> Soap at python.org >>>>>>>>> http://mail.python.org/mailman/listinfo/soap >>>>>>> _______________________________________________ >>>>>>> Soap mailing list >>>>>>> Soap at python.org >>>>>>> http://mail.python.org/mailman/listinfo/soap >>>>> _______________________________________________ >>>>> Soap mailing list >>>>> Soap at python.org >>>>> http://mail.python.org/mailman/listinfo/soap >>>> _______________________________________________ >>>> Soap mailing list >>>> Soap at python.org >>>> http://mail.python.org/mailman/listinfo/soap >>> >> _______________________________________________ >> Soap mailing list >> Soap at python.org >> http://mail.python.org/mailman/listinfo/soap >> > _______________________________________________ > Soap mailing list > Soap at python.org > http://mail.python.org/mailman/listinfo/soap From azurit at pobox.sk Tue Dec 6 19:20:19 2011 From: azurit at pobox.sk (azurIt) Date: Tue, 06 Dec 2011 19:20:19 +0100 Subject: [Soap-Python] rpclib - very strange problem In-Reply-To: <4EDE5664.4060602@arskom.com.tr> References: <20111205165555.6797A2FC@pobox.sk>, <4EDD006D.1070004@arskom.com.tr>, <20111206171412.5226202B@pobox.sk>, <4EDE4098.8020706@arskom.com.tr>, <20111206174610.138D675E@pobox.sk>, <4EDE4818.2060309@arskom.com.tr>, <4EDE486D.7000009@arskom.com.tr>, <20111206184307.222350AF@pobox.sk>, <20111206184816.DE38E0CF@pobox.sk> <4EDE5664.4060602@arskom.com.tr> Message-ID: <20111206192019.45E49E67@pobox.sk> little more info: - the process which gets crazy is the one which was used as last (so, when i set wsgi to use only one process, 100% of requests are invalid) - upgrading mod_wsgi to the newest version didn't fix anything Burak, are you 100% sure this can't be rpclib problem ? ______________________________________________________________ > Od: "Burak Arslan" > Komu: azurIt > D?tum: 06.12.2011 18:52 > Predmet: Re: [Soap-Python] rpclib - very strange problem > > CC: soap at python.org >On 12/06/11 19:48, azurIt wrote: >> Burak, i got something!! :) i'm running two wsgi processes for my wsgi application (via mod_wsgi). invalid result is always returned by first of them and valid result is always returned by the second (until i restart wsgi app). this is why every second request gets crazy (there's a 50% chance). now why is this happening ? some kind of desynchronization between processes ? >> > >ah, now it makes more sense. i'm not familiar with mod_wsgi, but i don't >think mod_wsgi processes share information one way or the other. are you >sure both initialize correctly? > >why not use twisted, cherrypy or any other pure-python http solution and >use apache as a reverse-proxy? > >burak > >> ______________________________________________________________ >>> Od: "azurIt" >>> Komu: >>> D?tum: 06.12.2011 18:43 >>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>> >>> cool, it's working now. problem is that traceback for both cases (where result is ok and is not ok) looks the same: >>> >>> >>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/wsgi.py", line 168, in __call__ >>> return self.__handle_rpc(req_env, start_response) >>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/wsgi.py", line 239, in __handle_rpc >>> self.get_out_object(ctx) >>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/_base.py", line 73, in get_out_object >>> self.app.process_request(ctx) >>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/application.py", line 102, in process_request >>> ctx.out_object = self.call_wrapper(ctx) >>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 190, in __setattr__ >>> object.__setattr__(self, k, v) >>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 51, in set_out_object >>> traceback.print_stack() >>> >>> >>> i can only see rpclib code, not mine. any hints how can i show something more ? thnx!!! >>> >>> azur >>> >>> >>> ______________________________________________________________ >>>> Od: "Burak Arslan" >>>> Komu: azurIt >>>> D?tum: 06.12.2011 17:53 >>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>> >>>> CC: soap at python.org >>>> On 12/06/11 18:51, Burak Arslan wrote: >>>>> On 12/06/11 18:46, azurIt wrote: >>>>>> Sorry for bordering, i would write/fix it by myself but i don't fully understand your code. This is what it is doing now: >>>>> you should read about the property built-in. >>>>> >>>>>> Traceback (most recent call last): >>>>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/application.py", line 102, in process_request >>>>>> ctx.out_object = self.call_wrapper(ctx) >>>>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 191, in __setattr__ >>>>>> raise ValueError("use the udc member for storing arbitrary data " >>>>>> ValueError: use the udc member for storing arbitrary data in the method context >>>>> set self.frozen to false in the constructor's last line. >>>> or rather add self.__out_object=None to the ctor. >>>> >>>>> i'd forgotten about the __getattr__ in that class, you can modify that >>>>> as well if you understand better what that does. >>>>> >>>>> burak >>>>>> ______________________________________________________________ >>>>>>> Od: "Burak Arslan" >>>>>>> Komu: azurIt >>>>>>> D?tum: 06.12.2011 17:19 >>>>>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>>>>> >>>>>>> CC: soap at python.org >>>>>>> On 12/06/11 18:14, azurIt wrote: >>>>>>>> Burak, >>>>>>>> >>>>>>>> can you, please, help me with this a little more? Where exactly should i put that code? Into _base.py file? Thank you! >>>>>>>> >>>>>>>> azur >>>>>>> yes, in the MethodContext class, like so: >>>>>>> >>>>>>> class MethodContext(object): >>>>>>> def get_out_object(self): >>>>>>> return self.__out_object >>>>>>> >>>>>>> def set_out_object(self, what): >>>>>>> import traceback >>>>>>> traceback.print_stack() >>>>>>> self.__out_object = what >>>>>>> >>>>>>> out_object = property(get_out_object, set_out_object) >>>>>>> >>>>>>> # (...) >>>>>>> # rest of the class definition >>>>>>> >>>>>>> hth, >>>>>>> burak >>>>>>> >>>>>>> >>>>>>> >>>>>>>> ______________________________________________________________ >>>>>>>>> Od: "Burak Arslan" >>>>>>>>> Komu: azurIt >>>>>>>>> D?tum: 05.12.2011 18:33 >>>>>>>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>>>>>>> >>>>>>>>> CC: soap at python.org >>>>>>>>> On 12/05/11 17:55, azurIt wrote: >>>>>>>>>> Any hints ? :) >>>>>>>>> patch rpclib code to instrument the out_object attribute. have the >>>>>>>>> instrumentation spit tracebacks on assignments. that way you'll be able >>>>>>>>> to track where that strange value comes from. >>>>>>>>> >>>>>>>>> off the top of my head, add these to the MethodContext class: >>>>>>>>> >>>>>>>>> def get_out_object(self): >>>>>>>>> return self.__out_object >>>>>>>>> >>>>>>>>> def set_out_object(self, what): >>>>>>>>> import traceback >>>>>>>>> traceback.print_stack() >>>>>>>>> self.__out_object = what >>>>>>>>> >>>>>>>>> out_object = property(get_out_object, set_out_object) >>>>>>>>> >>>>>>>>> every _second_ request? heh, that's fun :) >>>>>>>>> >>>>>>>>> good luck, >>>>>>>>> burak >>>>>>>>> >>>>>>>>> >>>>>>>>>> azur >>>>>>>>>> _______________________________________________ >>>>>>>>>> Soap mailing list >>>>>>>>>> Soap at python.org >>>>>>>>>> http://mail.python.org/mailman/listinfo/soap >>>>>>>> _______________________________________________ >>>>>>>> Soap mailing list >>>>>>>> Soap at python.org >>>>>>>> http://mail.python.org/mailman/listinfo/soap >>>>>> _______________________________________________ >>>>>> Soap mailing list >>>>>> Soap at python.org >>>>>> http://mail.python.org/mailman/listinfo/soap >>>>> _______________________________________________ >>>>> Soap mailing list >>>>> Soap at python.org >>>>> http://mail.python.org/mailman/listinfo/soap >>>> >>> _______________________________________________ >>> Soap mailing list >>> Soap at python.org >>> http://mail.python.org/mailman/listinfo/soap >>> >> _______________________________________________ >> Soap mailing list >> Soap at python.org >> http://mail.python.org/mailman/listinfo/soap > > From azurit at pobox.sk Tue Dec 6 19:59:40 2011 From: azurit at pobox.sk (azurIt) Date: Tue, 06 Dec 2011 19:59:40 +0100 Subject: [Soap-Python] rpclib - very strange problem In-Reply-To: <20111206192019.45E49E67@pobox.sk> References: <20111205165555.6797A2FC@pobox.sk>, <4EDD006D.1070004@arskom.com.tr>, <20111206171412.5226202B@pobox.sk>, <4EDE4098.8020706@arskom.com.tr>, <20111206174610.138D675E@pobox.sk>, <4EDE4818.2060309@arskom.com.tr>, <4EDE486D.7000009@arskom.com.tr>, <20111206184307.222350AF@pobox.sk>, <20111206184816.DE38E0CF@pobox.sk>, <4EDE5664.4060602@arskom.com.tr> <20111206192019.45E49E67@pobox.sk> Message-ID: <20111206195940.FD80852A@pobox.sk> Good news everyone! :D Burak i now EXACTLY know why this all is happening and i only don't know how to easily fix it (but i'm sure you will have some ideas). Here is my code which is run if user cannot be authenticated (= so it is run if i remove my session from DB and try to access API): def cannot_auth_function(ctx, state): return {"state": state} def run_before_auth(ctx): ... if not perm: ctx.descriptor.function = cannot_auth_function ctx.in_object = (perm["state"],) director_auth.event_manager.add_listener("method_call", run_before_auth) Problem is that ctx.descriptor.function is probably pointer to real function which gets permanently (=until it is reloaded into memory) replaced by cannot_auth_function. Any hints how should i do this correctly ? :) azur ______________________________________________________________ > Od: "azurIt" > Komu: > D?tum: 06.12.2011 19:22 > Predmet: Re: [Soap-Python] rpclib - very strange problem > >little more info: > - the process which gets crazy is the one which was used as last (so, when i set wsgi to use only one process, 100% of requests are invalid) > - upgrading mod_wsgi to the newest version didn't fix anything > >Burak, are you 100% sure this can't be rpclib problem ? > > > >______________________________________________________________ >> Od: "Burak Arslan" >> Komu: azurIt >> D?tum: 06.12.2011 18:52 >> Predmet: Re: [Soap-Python] rpclib - very strange problem >> >> CC: soap at python.org >>On 12/06/11 19:48, azurIt wrote: >>> Burak, i got something!! :) i'm running two wsgi processes for my wsgi application (via mod_wsgi). invalid result is always returned by first of them and valid result is always returned by the second (until i restart wsgi app). this is why every second request gets crazy (there's a 50% chance). now why is this happening ? some kind of desynchronization between processes ? >>> >> >>ah, now it makes more sense. i'm not familiar with mod_wsgi, but i don't >>think mod_wsgi processes share information one way or the other. are you >>sure both initialize correctly? >> >>why not use twisted, cherrypy or any other pure-python http solution and >>use apache as a reverse-proxy? >> >>burak >> >>> ______________________________________________________________ >>>> Od: "azurIt" >>>> Komu: >>>> D?tum: 06.12.2011 18:43 >>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>> >>>> cool, it's working now. problem is that traceback for both cases (where result is ok and is not ok) looks the same: >>>> >>>> >>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/wsgi.py", line 168, in __call__ >>>> return self.__handle_rpc(req_env, start_response) >>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/wsgi.py", line 239, in __handle_rpc >>>> self.get_out_object(ctx) >>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/server/_base.py", line 73, in get_out_object >>>> self.app.process_request(ctx) >>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/application.py", line 102, in process_request >>>> ctx.out_object = self.call_wrapper(ctx) >>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 190, in __setattr__ >>>> object.__setattr__(self, k, v) >>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 51, in set_out_object >>>> traceback.print_stack() >>>> >>>> >>>> i can only see rpclib code, not mine. any hints how can i show something more ? thnx!!! >>>> >>>> azur >>>> >>>> >>>> ______________________________________________________________ >>>>> Od: "Burak Arslan" >>>>> Komu: azurIt >>>>> D?tum: 06.12.2011 17:53 >>>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>>> >>>>> CC: soap at python.org >>>>> On 12/06/11 18:51, Burak Arslan wrote: >>>>>> On 12/06/11 18:46, azurIt wrote: >>>>>>> Sorry for bordering, i would write/fix it by myself but i don't fully understand your code. This is what it is doing now: >>>>>> you should read about the property built-in. >>>>>> >>>>>>> Traceback (most recent call last): >>>>>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/application.py", line 102, in process_request >>>>>>> ctx.out_object = self.call_wrapper(ctx) >>>>>>> File "/usr/lib/python2.5/site-packages/rpclib-2.4.1_beta-py2.5.egg/rpclib/_base.py", line 191, in __setattr__ >>>>>>> raise ValueError("use the udc member for storing arbitrary data " >>>>>>> ValueError: use the udc member for storing arbitrary data in the method context >>>>>> set self.frozen to false in the constructor's last line. >>>>> or rather add self.__out_object=None to the ctor. >>>>> >>>>>> i'd forgotten about the __getattr__ in that class, you can modify that >>>>>> as well if you understand better what that does. >>>>>> >>>>>> burak >>>>>>> ______________________________________________________________ >>>>>>>> Od: "Burak Arslan" >>>>>>>> Komu: azurIt >>>>>>>> D?tum: 06.12.2011 17:19 >>>>>>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>>>>>> >>>>>>>> CC: soap at python.org >>>>>>>> On 12/06/11 18:14, azurIt wrote: >>>>>>>>> Burak, >>>>>>>>> >>>>>>>>> can you, please, help me with this a little more? Where exactly should i put that code? Into _base.py file? Thank you! >>>>>>>>> >>>>>>>>> azur >>>>>>>> yes, in the MethodContext class, like so: >>>>>>>> >>>>>>>> class MethodContext(object): >>>>>>>> def get_out_object(self): >>>>>>>> return self.__out_object >>>>>>>> >>>>>>>> def set_out_object(self, what): >>>>>>>> import traceback >>>>>>>> traceback.print_stack() >>>>>>>> self.__out_object = what >>>>>>>> >>>>>>>> out_object = property(get_out_object, set_out_object) >>>>>>>> >>>>>>>> # (...) >>>>>>>> # rest of the class definition >>>>>>>> >>>>>>>> hth, >>>>>>>> burak >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> ______________________________________________________________ >>>>>>>>>> Od: "Burak Arslan" >>>>>>>>>> Komu: azurIt >>>>>>>>>> D?tum: 05.12.2011 18:33 >>>>>>>>>> Predmet: Re: [Soap-Python] rpclib - very strange problem >>>>>>>>>> >>>>>>>>>> CC: soap at python.org >>>>>>>>>> On 12/05/11 17:55, azurIt wrote: >>>>>>>>>>> Any hints ? :) >>>>>>>>>> patch rpclib code to instrument the out_object attribute. have the >>>>>>>>>> instrumentation spit tracebacks on assignments. that way you'll be able >>>>>>>>>> to track where that strange value comes from. >>>>>>>>>> >>>>>>>>>> off the top of my head, add these to the MethodContext class: >>>>>>>>>> >>>>>>>>>> def get_out_object(self): >>>>>>>>>> return self.__out_object >>>>>>>>>> >>>>>>>>>> def set_out_object(self, what): >>>>>>>>>> import traceback >>>>>>>>>> traceback.print_stack() >>>>>>>>>> self.__out_object = what >>>>>>>>>> >>>>>>>>>> out_object = property(get_out_object, set_out_object) >>>>>>>>>> >>>>>>>>>> every _second_ request? heh, that's fun :) >>>>>>>>>> >>>>>>>>>> good luck, >>>>>>>>>> burak >>>>>>>>>> >>>>>>>>>> >>>>>>>>>>> azur >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> Soap mailing list >>>>>>>>>>> Soap at python.org >>>>>>>>>>> http://mail.python.org/mailman/listinfo/soap >>>>>>>>> _______________________________________________ >>>>>>>>> Soap mailing list >>>>>>>>> Soap at python.org >>>>>>>>> http://mail.python.org/mailman/listinfo/soap >>>>>>> _______________________________________________ >>>>>>> Soap mailing list >>>>>>> Soap at python.org >>>>>>> http://mail.python.org/mailman/listinfo/soap >>>>>> _______________________________________________ >>>>>> Soap mailing list >>>>>> Soap at python.org >>>>>> http://mail.python.org/mailman/listinfo/soap >>>>> >>>> _______________________________________________ >>>> Soap mailing list >>>> Soap at python.org >>>> http://mail.python.org/mailman/listinfo/soap >>>> >>> _______________________________________________ >>> Soap mailing list >>> Soap at python.org >>> http://mail.python.org/mailman/listinfo/soap >> >> >_______________________________________________ >Soap mailing list >Soap at python.org >http://mail.python.org/mailman/listinfo/soap > From burak.arslan at arskom.com.tr Tue Dec 6 21:34:03 2011 From: burak.arslan at arskom.com.tr (burak.arslan at arskom.com.tr) Date: Tue, 06 Dec 2011 22:34:03 +0200 Subject: [Soap-Python] rpclib - very strange problem In-Reply-To: <20111206195940.FD80852A@pobox.sk> References: <20111205165555.6797A2FC@pobox.sk>, <4EDD006D.1070004@arskom.com.tr>, <20111206171412.5226202B@pobox.sk>, <4EDE4098.8020706@arskom.com.tr>, <20111206174610.138D675E@pobox.sk>, <4EDE4818.2060309@arskom.com.tr>, <4EDE486D.7000009@arskom.com.tr>, <20111206184307.222350AF@pobox.sk>, <20111206184816.DE38E0CF@pobox.sk>, <4EDE5664.4060602@arskom.com.tr> <20111206192019.45E49E67@pobox.sk> <20111206195940.FD80852A@pobox.sk> Message-ID: On 06.12.2011 20:59, azurIt wrote: > Problem is that ctx.descriptor.function is probably pointer to real > function which gets permanently (=until it is reloaded into memory) > replaced by cannot_auth_function. Any hints how should i do this > correctly ? :) > shit. okay, i added a reset() to the MethodContext object. That way you'll be able to restore the original function when perm == True. Does this fix your problem? i knew this would turn out to be an rpclib problem :) congrats for spotting this. best, burak From azurit at pobox.sk Wed Dec 7 00:58:31 2011 From: azurit at pobox.sk (azurIt) Date: Wed, 07 Dec 2011 00:58:31 +0100 Subject: [Soap-Python] rpclib - very strange problem In-Reply-To: References: <20111205165555.6797A2FC@pobox.sk>, <4EDD006D.1070004@arskom.com.tr>, <20111206171412.5226202B@pobox.sk>, <4EDE4098.8020706@arskom.com.tr>, <20111206174610.138D675E@pobox.sk>, <4EDE4818.2060309@arskom.com.tr>, <4EDE486D.7000009@arskom.com.tr>, <20111206184307.222350AF@pobox.sk>, <20111206184816.DE38E0CF@pobox.sk>, <4EDE5664.4060602@arskom.com.tr>, <20111206192019.45E49E67@pobox.sk>, <20111206195940.FD80852A@pobox.sk> Message-ID: <20111207005831.EAD7AE27@pobox.sk> FIXED!! :) but i put it inside 'cannot_auth_function': def cannot_auth_function(ctx, state): ctx.descriptor.reset_function() return {"state": state} so it will be called only when it's needed. thank you very much Burak! also don't forget to add a note here: http://arskom.github.com/rpclib/faq.html#how-do-i-alter-the-behaviour-of-a-user-method-without-using-decorators azur ______________________________________________________________ > Od: burak.arslan at arskom.com.tr > Komu: > D?tum: 06.12.2011 21:34 > Predmet: Re: [Soap-Python] rpclib - very strange problem > >On 06.12.2011 20:59, azurIt wrote: >> Problem is that ctx.descriptor.function is probably pointer to real >> function which gets permanently (=until it is reloaded into memory) >> replaced by cannot_auth_function. Any hints how should i do this >> correctly ? :) >> > >shit. > >okay, i added a reset() to the MethodContext object. That way you'll be >able to restore the original function when perm == True. Does this fix >your problem? > >i knew this would turn out to be an rpclib problem :) congrats for >spotting this. > >best, >burak > >_______________________________________________ >Soap mailing list >Soap at python.org >http://mail.python.org/mailman/listinfo/soap > From jiaxiaolei19871112 at gmail.com Wed Dec 7 06:46:17 2011 From: jiaxiaolei19871112 at gmail.com (=?UTF-8?B?6LS+5pmT56OK?=) Date: Wed, 7 Dec 2011 13:46:17 +0800 Subject: [Soap-Python] how to make a axis2-client for a python webservice server-side Message-ID: Hi, all: I was doing something about webservice. What a need to do is using a axis2-client to invoke a webservice developed by python. I tried to provide kinds of webservice server-side, and invoke them by axis2-client. While, all is failed. In the contents below, I provide the wsdl, axis2 client-side and the server-side made by python. Hope some axis2 experts can give me some points. Thanks ahead. Method 1: # server-side: tornadows import logging import tornado.httpserver import tornado.ioloop import tornado.web from tornadows import soaphandler from tornadows import webservices from tornadows import xmltypes from tornadows.soaphandler import webservice from tornado.options import define, options define('mode', default='deploy') define('port', type=int, default=8000) options['logging'].set('warning') class SMSService(soaphandler.SoapHandler): @webservice(_params=xmltypes.Integer,_returns=xmltypes.Integer) def getPrice(self,a): return 1987 if __name__ == '__main__': service = [('SMSService',SMSService)] app = webservices.WebService(service) ws = tornado.httpserver.HTTPServer(app) ws.listen(options.port) logging.warn("SMSService running on: localhost:%d", options.port) tornado.ioloop.IOLoop.instance().start() # wsdl: you can find it in web browser through the url ? http://172.16.2.46:8000/SMSService?wsdl? # client: package client; import javax.xml.namespace.QName; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.rpc.client.RPCServiceClient; public class client_for_python { public static void main(String[] args) throws Exception { // step 1: ??RPC????WebService RPCServiceClient serviceClient = new RPCServiceClient(); Options options = serviceClient.getOptions(); // step 2: ????WebService?URL // url for python String url2 = "http://172.16.2.46:8000/SMSService"; EndpointReference targetEPR = new EndpointReference(url2); options.setTo(targetEPR); // step 3: ??getGreeting?????? // step 5-6: (similiar whit // it!)?????getPrice?????????????getGreeting??????? Class[] classes = new Class[] { int.class }; QName opAddEntry = new QName( "http://172.16.2.46:8000/SMSService/getPrice"); System.out.println(serviceClient.invokeBlocking(opAddEntry, new Object[] {1}, classes)[0]); } } # NOTE: the client get nothing from sever-side and server-side get nothing from Axis2-client. Apart from it, I made a server-side using soaplib. Still be failed though. # server-side: soaplib from soaplib.wsgi_soap import SimpleWSGISoapApp from soaplib.service import soapmethod from soaplib.serializers.clazz import ClassSerializer from soaplib.serializers.primitive import String, Integer, Array, DateTime class SMSService(SimpleWSGISoapApp): @soapmethod(_returns=Integer) def getPrice(self): return 11 if __name__=='__main__': try: from wsgiref.simple_server import make_server server = make_server('localhost', 7789,SMSService()) server.serve_forever() except ImportError: print "Error: example server code requires Python >= 2.5" #wsdl: I cannot get wsdl form web browser, and I get the wsdl using "w3m http//localhost:7789/?wsdl' from the server-side. # client: Java Axis2 package client; import javax.xml.namespace.QName; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.rpc.client.RPCServiceClient; public class client_for_python_soaplib { public static void main(String[] args) throws Exception { // step 1: ??RPC????WebService RPCServiceClient serviceClient = new RPCServiceClient(); Options options = serviceClient.getOptions(); // step 2: ????WebService?URL // url for python String url2 = "http://172.16.2.46:7789"; EndpointReference targetEPR = new EndpointReference(url2); options.setTo(targetEPR); // step 3: ??getGreeting?????? // step 5-6: (similiar whit // it!)?????getPrice?????????????getGreeting??????? Class[] classes = new Class[] { int.class }; QName opAddEntry = new QName(url2, "SMSService.SMSService"); System.out.println(serviceClient.invokeBlocking(opAddEntry, new Object[] {1}, classes)[0]); } } # output: Exception in thread "main" org.apache.axis2.AxisFault: Connection refused: connect at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197) at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531) at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:102) at client.client_for_python_soaplib.main(client_for_python_soaplib.java:25) Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:519) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140) at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:125) at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:621) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193) ... 11 more Thanks again for your time and sprit. Any info is welcome! -- Jia Xiaolei -------------- next part -------------- An HTML attachment was scrubbed... URL: From jiaxiaolei19871112 at gmail.com Wed Dec 7 06:59:18 2011 From: jiaxiaolei19871112 at gmail.com (=?UTF-8?B?6LS+5pmT56OK?=) Date: Wed, 7 Dec 2011 13:59:18 +0800 Subject: [Soap-Python] a question about suds In-Reply-To: References: Message-ID: Hi, all: In fact,I had sent the mail to fedora-suds-list at redhat.com few days ago.While, nobody give a response.Today, I would like some suds users and lovers can give some points. Thank in advance. These days I have been doing something about python webservice. Suds, as a client-end, it's good.But, a problem puzzled me: 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: # filename: suds.py import suds def test_weather(): from suds.xsd.doctor import ImportDoctor, Import imp = Import('http://www.w3.org/2001/XMLSchema') d = ImportDoctor(imp) url = "http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl" client = suds.client.Client(url,doctor=d,cache=None,xstq=False,faults=False) print 'client', client a = 10.0 b = 3.0 #output1 = client.service.getRegionCountry() output = client.service.getWeather(100) print 'weatherv', output # output: Traceback (most recent call last): File "suds_client.py", line 787, in test_weather() File "suds_client.py", line 739, in test_weather client = suds.client.Client(url,doctor=d,cache=None,xstq=False,faults=False) 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) #NOTE: 1: the url "http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl" is avaliable, you can click it and see the wsdl. 2: the url is provided by a corporation in China, in another page ( http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?op=getWeather), put a number in the field ?theCityCode? and click the butter , you can get a xml file has contains the results. Anyone can have a try! I like suds and believe it's strong and stable enough. Hope someone can tell me what's the reason it throw exception? -- Jia Xiaolei -- NAME: ???/Jia Xiaolei MOBILE: 13011292217 QQ: 281304051 MICRO-BLOG: http://weibo.com/2183890715 GMAIL: jiaxiaolei19871112 at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dieter at handshake.de Wed Dec 7 08:17:53 2011 From: dieter at handshake.de (Dieter Maurer) Date: Wed, 7 Dec 2011 08:17:53 +0100 Subject: [Soap-Python] [Pywebsvcs-talk] a question about suds In-Reply-To: References: Message-ID: <20191.4897.637489.913520@localhost.localdomain> ??? 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 From jiaxiaolei19871112 at gmail.com Wed Dec 7 08:38:35 2011 From: jiaxiaolei19871112 at gmail.com (=?UTF-8?B?6LS+5pmT56OK?=) Date: Wed, 7 Dec 2011 15:38:35 +0800 Subject: [Soap-Python] [Pywebsvcs-talk] a question about suds In-Reply-To: <20191.4897.637489.913520@localhost.localdomain> References: <20191.4897.637489.913520@localhost.localdomain> Message-ID: Hi, Dieter: Thanks for your replay. 1:By the url " http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl" , we can get the words : 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(): url = "http://localhost:7789/?wsdl" 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 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 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 MICRO-BLOG: http://weibo.com/2183890715 GMAIL: jiaxiaolei19871112 at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dieter at handshake.de Wed Dec 7 09:02:22 2011 From: dieter at handshake.de (Dieter Maurer) Date: Wed, 7 Dec 2011 09:02:22 +0100 Subject: [Soap-Python] [Pywebsvcs-talk] a question about suds In-Reply-To: References: <20191.4897.637489.913520@localhost.localdomain> Message-ID: <20191.7566.910071.823832@localhost.localdomain> ??? wrote at 2011-12-7 15:38 +0800: > ... >1:By the url " >http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl" , we can >get the words : > >xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"xmlns:soapenc=" >http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime=" >http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://WebXml.com.cn/" >xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12=*" >http://schemas.xmlsoap.org/wsdl/soap12/*"xmlns:http=" >http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl=" >http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://WebXml.com.cn/"> > > >Maybe it's the fault of soap1.2 This tells us (only), that namespace prefixes are defined for both "SOAP" (1.1) as well as "SOAP1.2". The WSDL may define two different ports, one destined for "SOAP" clients another one for "SOAP1.2" clients. In such a case, ensure that "suds" is using the port for "SOAP" clients. The "suds" documentation tells you how to specify the use of a specific port. In the cases, where I have seen different ports for "SOAP" and "SOAP1.2" in a WSDL, the port name has distinguished between the two protocols. I have not seen a more formal difference (but I may not have looked with sufficient intensity). >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. I am not idle ;-) >#NOTE: the code can also be found in " >http://soaplib.github.com/soaplib/2_0/pages/helloworld.html" > ... >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 "/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? When it works sometimes, this excludes a WSDL problem. Nethertheless, the problem does not look client side -- but server side. You are getting a very low level exception: "httplib" (responsible for the elementary http request/response exchange) complaining about a bad status line (the first line of an HTTP response). The error information (the other part, aside from the traceback) should tell you which "line" has been received. You will find that it does not correspond to the HTTP specification. To understand in details what happens between a client and a server, a TCP logger (e.g. "etherreal", "wireshark", ...) can be used. It protocols the communication between server and client and you can see precisely which side is responsible for bad behavior. -- Dieter From shahjapan at gmail.com Wed Dec 7 09:16:47 2011 From: shahjapan at gmail.com (Japan Shah) Date: Wed, 7 Dec 2011 13:46:47 +0530 Subject: [Soap-Python] [Pywebsvcs-talk] a question about suds In-Reply-To: <20191.7566.910071.823832@localhost.localdomain> References: <20191.4897.637489.913520@localhost.localdomain> <20191.7566.910071.823832@localhost.localdomain> Message-ID: We're facing the same issue with suds & soaplib.. we've ended up with a solution that we're using FileCache for suds so after implementing caching suds side, we're facing BadStatusLine problem very rarely... On Wed, Dec 7, 2011 at 1:32 PM, Dieter Maurer wrote: > ??? wrote at 2011-12-7 15:38 +0800: > > ... > >1:By the url " > >http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl" , we can > >get the words : > > > > >xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"xmlns:soapenc=" > >http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime=" > >http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://WebXml.com.cn/" > >xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12=*" > >http://schemas.xmlsoap.org/wsdl/soap12/*"xmlns:http=" > >http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl=" > >http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://WebXml.com.cn/ > "> > > > > > >Maybe it's the fault of soap1.2 > > This tells us (only), that namespace prefixes are defined for > both "SOAP" (1.1) as well as "SOAP1.2". > > The WSDL may define two different ports, one destined for "SOAP" clients > another one for "SOAP1.2" clients. In such a case, ensure that > "suds" is using the port for "SOAP" clients. > > The "suds" documentation tells you how to specify the use of a specific > port. > > > In the cases, where I have seen different ports for "SOAP" and "SOAP1.2" > in a WSDL, the port name has distinguished between the two protocols. > I have not seen a more formal difference (but I may not have looked > with sufficient intensity). > > > >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. > > I am not idle ;-) > > > >#NOTE: the code can also be found in " > >http://soaplib.github.com/soaplib/2_0/pages/helloworld.html" > > ... > >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 "/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? > > When it works sometimes, this excludes a WSDL problem. > > Nethertheless, the problem does not look client side -- but server side. > You are getting a very low level exception: "httplib" (responsible > for the elementary http request/response exchange) complaining > about a bad status line (the first line of an HTTP response). > The error information (the other part, aside from the traceback) should > tell you which "line" has been received. You will find that it does not > correspond to the HTTP specification. > > > To understand in details what happens between a client and a server, > a TCP logger (e.g. "etherreal", "wireshark", ...) can be used. > It protocols the communication between server and client and you > can see precisely which side is responsible for bad behavior. > > > > -- > Dieter > _______________________________________________ > Soap mailing list > Soap at python.org > http://mail.python.org/mailman/listinfo/soap > -- -- #Japan Shah -------------- next part -------------- An HTML attachment was scrubbed... URL: From jiaxiaolei19871112 at gmail.com Wed Dec 7 09:40:43 2011 From: jiaxiaolei19871112 at gmail.com (=?UTF-8?B?6LS+5pmT56OK?=) Date: Wed, 7 Dec 2011 16:40:43 +0800 Subject: [Soap-Python] [Pywebsvcs-talk] a question about suds In-Reply-To: <20191.7566.910071.823832@localhost.localdomain> References: <20191.4897.637489.913520@localhost.localdomain> <20191.7566.910071.823832@localhost.localdomain> Message-ID: Thanks for your replay. Sorry for the word "idle". In fact, I am a Chinese, who live in Beijing City, China. Shamed for the terrible english. If we talk a man wih free time, which word should we use? idle, free, leisure,or something else? :) Okay, last two question: 1: I am a novice to soap, absolutely a newbie. Last week I began to develop Java Axis2 webservice and Python webservice. In python, the server-side use tornadows(tornado web service). They work together well, at least, I have never meet. "The "suds" documentation tells you how to specify the use of a specific port." In fact, I did not know how to specific port in suds. Some helps to me? :) 2: Have you once did something about Java axis2 client? I try to invoke a webservice develped by tornadows using axis2-client, but failed. I provided server-side, client-side and wsdl as follows. If leisure and pleasrue, hava a glance. # server: import logging import tornado.httpserver import tornado.ioloop import tornado.web from tornadows import soaphandler from tornadows import webservices from tornadows import xmltypes from tornadows.soaphandler import webservice from tornado.options import define, options define('mode', default='deploy') define('port', type=int, default=8000) options['logging'].set('warning') class SMSService(soaphandler.SoapHandler): @webservice(_params=xmltypes.Integer,_returns=xmltypes.Integer) def getPrice(self,a): return 1987 if __name__ == '__main__': service = [('SMSService',SMSService)] app = webservices.WebService(service) ws = tornado.httpserver.HTTPServer(app) ws.listen(options.port) logging.warn("SMSService running on: localhost:%d", options.port) tornado.ioloop.IOLoop.instance().start() # client: package client; import javax.xml.namespace.QName; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.rpc.client.RPCServiceClient; public class client_for_python { public static void main(String[] args) throws Exception { // step 1: ??RPC????WebService RPCServiceClient serviceClient = new RPCServiceClient(); Options options = serviceClient.getOptions(); // step 2: ????WebService?URL // url for python String url2 = "http://172.16.2.46:8000/SMSService"; EndpointReference targetEPR = new EndpointReference(url2); options.setTo(targetEPR); // step 3: ??getGreeting?????? // step 5-6: (similiar whit // it!)?????getPrice?????????????getGreeting??????? Class[] classes = new Class[] { int.class }; QName opAddEntry = new QName( "http://172.16.2.46:8000/SMSService/getPrice"); System.out.println(serviceClient.invokeBlocking(opAddEntry, new Object[] {1}, classes)[0]); } } ## the prolem: no response and server-side get no data #wsdl: Thanks ! -- Jia Xiaolei On Wed, Dec 7, 2011 at 4:02 PM, Dieter Maurer wrote: > ??? wrote at 2011-12-7 15:38 +0800: > > ... > >1:By the url " > >http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl" , we can > >get the words : > > > > >xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"xmlns:soapenc=" > >http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime=" > >http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://WebXml.com.cn/" > >xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12=*" > >http://schemas.xmlsoap.org/wsdl/soap12/*"xmlns:http=" > >http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl=" > >http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://WebXml.com.cn/ > "> > > > > > >Maybe it's the fault of soap1.2 > > This tells us (only), that namespace prefixes are defined for > both "SOAP" (1.1) as well as "SOAP1.2". > > The WSDL may define two different ports, one destined for "SOAP" clients > another one for "SOAP1.2" clients. In such a case, ensure that > "suds" is using the port for "SOAP" clients. > > The "suds" documentation tells you how to specify the use of a specific > port. > > > In the cases, where I have seen different ports for "SOAP" and "SOAP1.2" > in a WSDL, the port name has distinguished between the two protocols. > I have not seen a more formal difference (but I may not have looked > with sufficient intensity). > > > >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. > > I am not idle ;-) > > > >#NOTE: the code can also be found in " > >http://soaplib.github.com/soaplib/2_0/pages/helloworld.html" > > ... > >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 "/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? > > When it works sometimes, this excludes a WSDL problem. > > Nethertheless, the problem does not look client side -- but server side. > You are getting a very low level exception: "httplib" (responsible > for the elementary http request/response exchange) complaining > about a bad status line (the first line of an HTTP response). > The error information (the other part, aside from the traceback) should > tell you which "line" has been received. You will find that it does not > correspond to the HTTP specification. > > > To understand in details what happens between a client and a server, > a TCP logger (e.g. "etherreal", "wireshark", ...) can be used. > It protocols the communication between server and client and you > can see precisely which side is responsible for bad behavior. > > > > -- > Dieter > -- NAME: ???/Jia Xiaolei MOBILE: 13011292217 QQ: 281304051 MICRO-BLOG: http://weibo.com/2183890715 GMAIL: jiaxiaolei19871112 at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From dieter at handshake.de Wed Dec 7 10:01:14 2011 From: dieter at handshake.de (Dieter Maurer) Date: Wed, 7 Dec 2011 10:01:14 +0100 Subject: [Soap-Python] [Pywebsvcs-talk] a question about suds In-Reply-To: References: <20191.4897.637489.913520@localhost.localdomain> <20191.7566.910071.823832@localhost.localdomain> Message-ID: <20191.11098.530392.138317@localhost.localdomain> ??? wrote at 2011-12-7 16:40 +0800: > ... >"The "suds" documentation tells you how to specify the use of a specific >port." In fact, I did not know how to specific port in suds. I know that it is in the documentation. But, I will not read for you ;-) -- Dieter From jiaxiaolei19871112 at gmail.com Wed Dec 7 10:02:08 2011 From: jiaxiaolei19871112 at gmail.com (=?UTF-8?B?6LS+5pmT56OK?=) Date: Wed, 7 Dec 2011 17:02:08 +0800 Subject: [Soap-Python] [Pywebsvcs-talk] a question about suds In-Reply-To: References: <20191.4897.637489.913520@localhost.localdomain> <20191.7566.910071.823832@localhost.localdomain> Message-ID: We're facing the same issue with suds & soaplib.. > > we've ended up with a solution that we're using FileCache for suds so > after implementing caching suds side, > we're facing BadStatusLine problem very rarely... > Thanks for the feedback ! Two question: :) 1: do you mean : client = suds.client.Client(url,cache=None) ==> client = suds.client.Client(url) or: from suds.transport.cache import FileCache mycache = FileCache(days=90) mytransport = MyTransport(cache=mycache) #NOTE: In fact, set cache did not solve the problem at all. Besides, if remote server makes some change, the cache of client is terrible. 2: Now, what's the server-side you are using? soaplib? Just a advice, tornadows is pretty good. Maybe you have never heard of tornadows, but you must hear of tornado of facebook. So, if pleasure, do some study about tornadows. some useful link,hope they are helpful to you: https://github.com/rancavil/tornado-webservices/wiki/Python-Web-Services-with-Tornado http://innovaser.cl/innovaser.php -- Jia Xiaolei -------------- next part -------------- An HTML attachment was scrubbed... URL: From jiaxiaolei19871112 at gmail.com Wed Dec 7 10:03:44 2011 From: jiaxiaolei19871112 at gmail.com (=?UTF-8?B?6LS+5pmT56OK?=) Date: Wed, 7 Dec 2011 17:03:44 +0800 Subject: [Soap-Python] [Pywebsvcs-talk] a question about suds In-Reply-To: <20191.11098.530392.138317@localhost.localdomain> References: <20191.4897.637489.913520@localhost.localdomain> <20191.7566.910071.823832@localhost.localdomain> <20191.11098.530392.138317@localhost.localdomain> Message-ID: >"The "suds" documentation tells you how to specify the use of a specific > >port." In fact, I did not know how to specific port in suds. > > I know that it is in the documentation. But, I will not read for you ;-) > > okay, thanks all the same! I will read it myself. Thanks! -- Jia Xiaolei -- NAME: ???/Jia Xiaolei MOBILE: 13011292217 QQ: 281304051 MICRO-BLOG: http://weibo.com/2183890715 GMAIL: jiaxiaolei19871112 at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Wed Dec 7 10:39:04 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Wed, 07 Dec 2011 11:39:04 +0200 Subject: [Soap-Python] Fwd: some questions about soaplib In-Reply-To: References: <4EDE2DB9.4030908@arskom.com.tr> Message-ID: <4EDF3438.9080101@arskom.com.tr> On 12/07/11 07:51, ??? wrote: > Exception in thread "main" org.apache.axis2.AxisFault: Connection > refused: connect I think this speaks enough for itself. You don't even read what you're sending us, so why should we? Burak From jiaxiaolei19871112 at gmail.com Wed Dec 7 11:02:13 2011 From: jiaxiaolei19871112 at gmail.com (=?GB2312?B?vNbP/sDa?=) Date: Wed, 7 Dec 2011 18:02:13 +0800 Subject: [Soap-Python] Fwd: some questions about soaplib In-Reply-To: <4EDF3438.9080101@arskom.com.tr> References: <4EDE2DB9.4030908@arskom.com.tr> <4EDF3438.9080101@arskom.com.tr> Message-ID: > Exception in thread "main" org.apache.axis2.AxisFault: Connection > > refused: connect > > I think this speaks enough for itself. You don't even read what you're > sending us, so why should we? > > Burak > Hi, Burak: I certainly read what I sent. In part 1, serve-side is tornadows, the axis2-client cannot invoke the server, and returns nothing In part 2, server-side is soaplib. the server is developed in ubuntu linux,"172.16.2.46" is its ip, when you exceute "w3m http://localhost:7789/?wsdl", "w3m http://127.0.0.1:7789/?wsdl", thay are okay. but "w3m: Can't load http://172.16.2.46:7789/?wsdl." is failed. I develop tornadows in the same ubuntu linux, "w3m http://172.16.2.46:8000/SMSService?wsdl" is also okay. In the local area network, "http://172.16.2.46:8000/SMSService?wsdl" is also okay. I do not know the difference of tornadows and soaplib, so sent them together. w_jiaxiaolei at pabb-608:~$ ifconfig eth0 Link encap:Ethernet HWaddr 1c:6f:65:d4:b3:d3 inet addr:172.16.2.46 Bcast:172.16.255.255 Mask:255.255.0.0 inet6 addr: fe80::1e6f:65ff:fed4:b3d3/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2538292 errors:0 dropped:0 overruns:0 frame:0 TX packets:979243 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:276531149 (276.5 MB) TX bytes:621990155 (621.9 MB) Interrupt:32 Base address:0xa000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:2619 errors:0 dropped:0 overruns:0 frame:0 TX packets:2619 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:410554 (410.5 KB) TX bytes:410554 (410.5 KB) w_jiaxiaolei at pabb-608:~$ w3m http://172.16.2.46:8000/SMSService?wsdl w_jiaxiaolei at pabb-608:~$ w3m http://127.0.0.1:7789/?wsdl w_jiaxiaolei at pabb-608:~$ w3m http://localhost:7789/?wsdl w_jiaxiaolei at pabb-608:~$ w3m http://172.16.2.46:7789/?wsdl w3m: Can't load http://172.16.2.46:7789/?wsdl. Okay, now let's forget part 2, look at part 1 only. How to invoke a python webservice server-side(tornadow, soaplib, or others) using Axis2? ------------------------------ part 1----------------------------- # server-side: tornadows import logging import tornado.httpserver import tornado.ioloop import tornado.web from tornadows import soaphandler from tornadows import webservices from tornadows import xmltypes from tornadows.soaphandler import webservice from tornado.options import define, options define('mode', default='deploy') define('port', type=int, default=8000) options['logging'].set('warning') class SMSService(soaphandler.SoapHandler): @webservice(_params=xmltypes.Integer,_returns=xmltypes.Integer) def getPrice(self,a): return 1987 if __name__ == '__main__': service = [('SMSService',SMSService)] app = webservices.WebService(service) ws = tornado.httpserver.HTTPServer(app) ws.listen(options.port) logging.warn("SMSService running on: localhost:%d", options.port) tornado.ioloop.IOLoop.instance().start() # wsdl: you can find it in web browser through the url ? http://172.16.2.46:8000/SMSService?wsdl? # client: package client; import javax.xml.namespace.QName; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.rpc.client.RPCServiceClient; public class client_for_python { public static void main(String[] args) throws Exception { // step 1: ??RPC????WebService RPCServiceClient serviceClient = new RPCServiceClient(); Options options = serviceClient.getOptions(); // step 2: ????WebService?URL // url for python String url2 = "http://172.16.2.46:8000/SMSService"; EndpointReference targetEPR = new EndpointReference(url2); options.setTo(targetEPR); // step 3: ??getGreeting?????? // step 5-6: (similiar whit // it!)?????getPrice?????????????getGreeting??????? Class[] classes = new Class[] { int.class }; QName opAddEntry = new QName( "http://172.16.2.46:8000/SMSService/getPrice"); System.out.println(serviceClient.invokeBlocking(opAddEntry, new Object[] {1}, classes)[0]); } } # NOTE: the client get nothing from sever-side and server-side get nothing from Axis2-client. ------------------------------- part 2 -------------------------------------------- Apart from it, I made a server-side using soaplib. Still be failed though. # server-side: soaplib from soaplib.wsgi_soap import SimpleWSGISoapApp from soaplib.service import soapmethod from soaplib.serializers.clazz import ClassSerializer from soaplib.serializers.primitive import String, Integer, Array, DateTime class SMSService(SimpleWSGISoapApp): @soapmethod(_returns=Integer) def getPrice(self): return 11 if __name__=='__main__': try: from wsgiref.simple_server import make_server server = make_server('localhost', 7789,SMSService()) server.serve_forever() except ImportError: print "Error: example server code requires Python >= 2.5" #wsdl:* I cannot get wsdl form web browser, and I get the wsdl using "w3m http//localhost:7789/?wsdl' from the server-side.* # client: Java Axis2 package client; import javax.xml.namespace.QName; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.rpc.client.RPCServiceClient; public class client_for_python_soaplib { public static void main(String[] args) throws Exception { // step 1: ??RPC????WebService RPCServiceClient serviceClient = new RPCServiceClient(); Options options = serviceClient.getOptions(); // step 2: ????WebService?URL // url for python String url2 = "http://172.16.2.46:7789"; EndpointReference targetEPR = new EndpointReference(url2); options.setTo(targetEPR); // step 3: ??getGreeting?????? // step 5-6: (similiar whit // it!)?????getPrice?????????????getGreeting??????? Class[] classes = new Class[] { int.class }; QName opAddEntry = new QName(url2, "SMSService.SMSService"); System.out.println(serviceClient.invokeBlocking(opAddEntry, new Object[] {1}, classes)[0]); } } # output: Exception in thread "main" org.apache.axis2.AxisFault: Connection refused: connect at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197) ... -- Jia Xiaolei -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Wed Dec 7 17:53:43 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Wed, 07 Dec 2011 18:53:43 +0200 Subject: [Soap-Python] Small error running rpclib under python3 - found and fixed Message-ID: <4EDF9A17.30406@arskom.com.tr> On 06.12.2011 10:28, Frank Millman wrote: > Hopefully this is useful information. I will be happy to take this further > if you would like. Hi Frank, Thank you very much for providing these clues, appreciated. So, I've done most of the grunt work for Python3 migration. 2to3 is a stupid tool, so I run every option to --fix one by one and studied their output. I manually patched rpclib where I didn't like the changes, and distilled a safe-to-run subset in 2to3.sh. Fwiw, I don't plan to do this the way Django people did and run rpclib from the same code base for both python-2 and python-3. Rpclib will need to be packed two times for two python versions. could you patch setup.py for it? i don't think I'll have time anytime soon for that. As of db2f7a1 in my personal fork, I got the binary_soap and binary_http examples to work. running suds from python2 environment works just fine. As for the ''.join(whatever) issues you kept hitting on, i think the strategy is to get rid of them using [v.(encode|decode)('encoding') for v in whatever] but it's all context-dependent. see 240908f for a few tricks. Your way of doing list(whatever)[0] breaks some promises in the interface design, so it's not the right thing to do. Thank you very much for your time, and I hope these help. Best Regards, Burak From burak.arslan at arskom.com.tr Wed Dec 7 17:56:08 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Wed, 07 Dec 2011 18:56:08 +0200 Subject: [Soap-Python] Fwd: some questions about soaplib In-Reply-To: References: <4EDE2DB9.4030908@arskom.com.tr> <4EDF3438.9080101@arskom.com.tr> Message-ID: <4EDF9AA8.7000103@arskom.com.tr> On 07.12.2011 12:02, ??? wrote: > > > Exception in thread "main" org.apache.axis2.AxisFault: Connection > > > refused: connect > > I think this speaks enough for itself. You don't even read what you're > sending us, so why should we? > > Burak > > Hi, Burak: > > I certainly read what I sent. > hi jia, "connection refused" is not a soap error. please have it working before asking soap-related questions. best, burak -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Wed Dec 7 19:12:18 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Wed, 07 Dec 2011 20:12:18 +0200 Subject: [Soap-Python] rpclib - very strange problem In-Reply-To: <20111207005831.EAD7AE27@pobox.sk> References: <20111205165555.6797A2FC@pobox.sk>, <4EDD006D.1070004@arskom.com.tr>, <20111206171412.5226202B@pobox.sk>, <4EDE4098.8020706@arskom.com.tr>, <20111206174610.138D675E@pobox.sk>, <4EDE4818.2060309@arskom.com.tr>, <4EDE486D.7000009@arskom.com.tr>, <20111206184307.222350AF@pobox.sk>, <20111206184816.DE38E0CF@pobox.sk>, <4EDE5664.4060602@arskom.com.tr>, <20111206192019.45E49E67@pobox.sk>, <20111206195940.FD80852A@pobox.sk> <20111207005831.EAD7AE27@pobox.sk> Message-ID: <4EDFAC82.5090109@arskom.com.tr> On 12/07/11 01:58, azurIt wrote: > FIXED!! :) but i put it inside 'cannot_auth_function': > > def cannot_auth_function(ctx, state): > ctx.descriptor.reset_function() > return {"state": state} > > so it will be called only when it's needed. great to hear azur. sorry, i should have told you this when i suggested you to fiddle with ctx.descriptor. i don't know how but this slipped my mind. > thank you very much Burak! also don't forget to add a note here: > http://arskom.github.com/rpclib/faq.html#how-do-i-alter-the-behaviour-of-a-user-method-without-using-decorators > i just did that. thanks for reminding this. best, burak From burak.arslan at arskom.com.tr Thu Dec 8 11:52:13 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Thu, 08 Dec 2011 12:52:13 +0200 Subject: [Soap-Python] soap in python Message-ID: <4EE096DD.1010401@arskom.com.tr> hello, As you may know, there's an incomplete comparison document for rpclib, available here: http://arskom.github.com/rpclib/h_and_f.html#comparison-with-other-rpc-frameworks Three new additions to this document is going to be: http://packages.python.org/WSME/ https://github.com/stepank/pyws https://github.com/rancavil/tornado-webservices I've briefly looked at all three. They have almost the same goals, implement almost the same protocols, same way. Especially tornadows looks almost like soaplib back when it was 0.8.1, when it wasn't even using lxml. Is there any particular reason the authors of these libraries chose to implement a soap / rpc library from scratch instead of contributing to an existing library? Also, would you mind helping me with that document? We could even spin it off the rpclib documentation if you desire. I'm simply curious, yet very interested in your input. Best Regards, Burak From dieter at handshake.de Thu Dec 8 12:19:09 2011 From: dieter at handshake.de (Dieter Maurer) Date: Thu, 8 Dec 2011 12:19:09 +0100 Subject: [Soap-Python] Fwd: some questions about soaplib In-Reply-To: <4EDF9AA8.7000103@arskom.com.tr> References: <4EDF9AA8.7000103@arskom.com.tr> Message-ID: <20192.40237.879679.869079@localhost.localdomain> Burak Arslan wrote at 2011-12-7 18:56 +0200: >On 07.12.2011 12:02, ??? wrote: > ... >"connection refused" is not a soap error. please have it working before >asking soap-related questions. "connection refused" means that there is no server listening. This, you must ensure the server has started successfully (and kept running). -- Dieter From cdevienne at gmail.com Thu Dec 8 12:37:24 2011 From: cdevienne at gmail.com (Christophe de Vienne) Date: Thu, 08 Dec 2011 12:37:24 +0100 Subject: [Soap-Python] soap in python In-Reply-To: <4EE096DD.1010401@arskom.com.tr> References: <4EE096DD.1010401@arskom.com.tr> Message-ID: <4EE0A174.7050307@gmail.com> Hello, I am the author of http://packages.python.org/WSME/. The original goal of this project is to write a better TGWebServices, while keeping a very similar (if not identical) API. The "better" things I needed were : * Batch calls (for the ExtDirect implementation which is the one I am using the most the this time, and also for json-rpc which will come sooner or later). * Extendible type system * Take the protocol implementations out of the core API so that they can be safely tweaked * Portability to TG2 without rewriting everything like I had to do for http://pypi.python.org/pypi/TGWebServices/2.0.0a2 The bonus of this rewrite was to remove completely the TG requirement. Note that only a subset of each protocol is generally implemented, the one that is necessary to expose the API. Not knowing well rpclib, I cannot say much more to outline the differences with WSME. Tell me if you need more informations, Regards, Christophe Le 08/12/2011 11:52, Burak Arslan a ?crit : > hello, > > As you may know, there's an incomplete comparison document for rpclib, > available here: > > http://arskom.github.com/rpclib/h_and_f.html#comparison-with-other-rpc-frameworks > > Three new additions to this document is going to be: > > http://packages.python.org/WSME/ > https://github.com/stepank/pyws > https://github.com/rancavil/tornado-webservices > > I've briefly looked at all three. They have almost the same goals, > implement almost the same protocols, > same way. Especially tornadows looks almost like soaplib back when it > was 0.8.1, when it wasn't even using lxml. > > Is there any particular reason the authors of these libraries chose to > implement a soap / rpc library from scratch instead of contributing to > an existing library? > > Also, would you mind helping me with that document? We could even spin > it off the rpclib documentation if you desire. > > I'm simply curious, yet very interested in your input. > > Best Regards, > Burak > > _______________________________________________ > Soap mailing list > Soap at python.org > http://mail.python.org/mailman/listinfo/soap -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Sat Dec 10 12:34:28 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Sat, 10 Dec 2011 13:34:28 +0200 Subject: [Soap-Python] soap in python In-Reply-To: <4EE0A174.7050307@gmail.com> References: <4EE096DD.1010401@arskom.com.tr> <4EE0A174.7050307@gmail.com> Message-ID: <4EE343C4.3050703@arskom.com.tr> Hi Christophe, Thank you very much for responding. On 12/08/11 13:37, Christophe de Vienne wrote: > Hello, > > I am the author of http://packages.python.org/WSME/. > > The original goal of this project is to write a better TGWebServices, > while keeping a very similar (if not identical) API. > The "better" things I needed were : > > * Batch calls (for the ExtDirect implementation which is the one I > am using the most the this time, and also for json-rpc which will > come sooner or later). > How do you support batching with soap? Soap the protocol does not support batching as far as i know. (i.e. soap:Body has max_occurs=1 in the soap 1.1 schema) > * Extendible type system > can you elaborate on that? both rpclib and ladon support extensible types one way or the other. > * Take the protocol implementations out of the core API so that they > can be safely tweaked > again, these are one of the major features of both rpclib and ladon. or am i misunderstanding something? > * Portability to TG2 without rewriting everything like I had to do > for http://pypi.python.org/pypi/TGWebServices/2.0.0a2 > I can't comment on this as i'm not familiar with turbogears. here's a django wrapper for rpclib: https://gist.github.com/1242760 Would writing a tg wrapper be much more work than this? > The bonus of this rewrite was to remove completely the TG requirement. > > Note that only a subset of each protocol is generally implemented, the > one that is necessary to expose the API. > Oh especially with soap, that's how it works almost everywhere :) Best, Burak -------------- next part -------------- An HTML attachment was scrubbed... URL: From cdevienne at gmail.com Sat Dec 10 21:42:23 2011 From: cdevienne at gmail.com (Christophe de Vienne) Date: Sat, 10 Dec 2011 21:42:23 +0100 Subject: [Soap-Python] soap in python In-Reply-To: <4EE343C4.3050703@arskom.com.tr> References: <4EE096DD.1010401@arskom.com.tr> <4EE0A174.7050307@gmail.com> <4EE343C4.3050703@arskom.com.tr> Message-ID: <4EE3C42F.8070602@gmail.com> Hi Burak, Le 10/12/2011 12:34, Burak Arslan a ?crit : > > Hi Christophe, > > Thank you very much for responding. > > On 12/08/11 13:37, Christophe de Vienne wrote: >> Hello, >> >> I am the author of http://packages.python.org/WSME/. >> >> The original goal of this project is to write a better TGWebServices, >> while keeping a very similar (if not identical) API. >> The "better" things I needed were : >> >> * Batch calls (for the ExtDirect implementation which is the one I >> am using the most the this time, and also for json-rpc which will >> come sooner or later). >> > > How do you support batching with soap? Soap the protocol does not > support batching as far as i know. (i.e. soap:Body has max_occurs=1 in > the soap 1.1 schema) I support it the simplest way : I don't. Batch calls are implemented only in the protocols that supports it. Right now ExtDirect, and later json-rpc. And they come with their load of problems, most notably the response status code handling (and errors generally speaking) and the transaction handling. >> * Extendible type system >> > can you elaborate on that? both rpclib and ladon support extensible > types one way or the other. In a few words : User can define its own complex types, as well as defining how custom simple types should be encoded/decoded, even in a very specific way for some protocols thanks to simplegeneric (not documented yet). A detailed explanation of the type system is available here : http://packages.python.org/WSME/types.html >> * Take the protocol implementations out of the core API so that >> they can be safely tweaked >> > > again, these are one of the major features of both rpclib and ladon. > or am i misunderstanding something? Well, I was underlining the improvements over TGWebServices, not the differences with rpclib or ladon which I do not know well enough. Based on what you say though, I think I should have better to them to either pick ideas or stop doing extra work ^^. However note that the first feature of WSME is to be an almost drop-in replacement for TGWebServices (only renaming the decorators is enough for most of the code, and otherwise a few changes on how the api gets published). >> * Portability to TG2 without rewriting everything like I had to do >> for http://pypi.python.org/pypi/TGWebServices/2.0.0a2 >> > > I can't comment on this as i'm not familiar with turbogears. here's a > django wrapper for rpclib: > https://gist.github.com/1242760 Would writing a tg wrapper be much > more work than this? Probably not : it would be about the same complexity. But I intend to add is the possibility to use the @requires decorators of TG inside the WSME tree. I don't know if it is easy to do, I did not have a look yet. >> The bonus of this rewrite was to remove completely the TG requirement. >> >> Note that only a subset of each protocol is generally implemented, >> the one that is necessary to expose the API. >> > > Oh especially with soap, that's how it works almost everywhere :) Server-side it is a sane approach. Client-side is another story. Cheers, Christophe -------------- next part -------------- An HTML attachment was scrubbed... URL: From info.ksamuel at gmail.com Wed Dec 14 19:25:15 2011 From: info.ksamuel at gmail.com (Kevin Samuel) Date: Wed, 14 Dec 2011 19:25:15 +0100 Subject: [Soap-Python] How make soaplib to accept an escaped XML literal as string data ? Message-ID: <4EE8EA0B.5010902@gmail.com> Hello, I have a service including the (simplified) following method: @soap(String _returns=String) ) def UploadResponse(self, xml_string): do_stuff(xml_string) Content is suppoed to be an XML literal sent from a 3rd party on which I have no control on. Unfortunalty, if "xml_string" contains any XML string in the SOAP envelop, the "xml_string" parameter will be emtpy. Now it make sense because etree parse it and when soaplib extract text from it, there is no text node in the parameter node (since it full of XML nodes), so it returns an empty string. The problem is that __it does the same with an escaped XML string__ because in core._base.py happens this: def parse_xml_string(self, xml_string, charset=None): from xml.sax.saxutils import unescape, escape x = unescape(xml_string, {"'": "'", """: '"'}) return _parse_xml_string(x, charset) The entire SOAP envelop is unescaped, including the content of each parameter, turning it into valid XML, which is then parsed by etree. I'm not sure why this is needed, nor why this is apply to the entire document. Is there a way to bypass that ? I can't force my 3rd party to use CDATA. Best regards, Kevin Samuel From burak.arslan at arskom.com.tr Wed Dec 14 20:32:11 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Wed, 14 Dec 2011 21:32:11 +0200 Subject: [Soap-Python] How make soaplib to accept an escaped XML literal as string data ? In-Reply-To: <4EE8EA0B.5010902@gmail.com> References: <4EE8EA0B.5010902@gmail.com> Message-ID: <4EE8F9BB.8080106@arskom.com.tr> On 12/14/11 20:25, Kevin Samuel wrote: > The problem is that __it does the same with an escaped XML string__ > because in core._base.py happens this: > > def parse_xml_string(self, xml_string, charset=None): > from xml.sax.saxutils import unescape, escape > x = unescape(xml_string, {"'": "'", """: '"'}) > return _parse_xml_string(x, charset) Hi Kevin, This came up before. I don't have the faintest idea about why that code is there. My two kuru?es say you can just get rid of it. Burak From burak.arslan at arskom.com.tr Wed Dec 14 21:07:45 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Wed, 14 Dec 2011 22:07:45 +0200 Subject: [Soap-Python] How make soaplib to accept an escaped XML literal as string data ? In-Reply-To: <4EE8FA9C.1030108@gmail.com> References: <4EE8EA0B.5010902@gmail.com> <4EE8F9BB.8080106@arskom.com.tr> <4EE8FA9C.1030108@gmail.com> Message-ID: <4EE90211.7040207@arskom.com.tr> On 12/14/11 21:35, Kevin Samuel wrote: > from soaplib.core._base import Application, _parse_xml_string > > def parse_xml_string_monkey_patch(self, xml_string, charset=None): > return _parse_xml_string(xml_string, charset=None) > > Application.parse_xml_string = parse_xml_string_monkey_patch > > It works fine, so I suppose it can be removed from the source code. > Should I fill a ticket on github ? Should I make a clone and a pull > request just for that ? no need, i removed the call to unescape. you did notice that warning about how soaplib is not maintained though, yes? best, burak From burak.arslan at arskom.com.tr Wed Dec 14 21:46:54 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Wed, 14 Dec 2011 22:46:54 +0200 Subject: [Soap-Python] How make soaplib to accept an escaped XML literal as string data ? In-Reply-To: <4EE902AA.9060506@gmail.com> References: <4EE8EA0B.5010902@gmail.com> <4EE8F9BB.8080106@arskom.com.tr> <4EE8FA9C.1030108@gmail.com> <4EE90211.7040207@arskom.com.tr> <4EE902AA.9060506@gmail.com> Message-ID: <4EE90B3E.7050502@arskom.com.tr> On 12/14/11 22:10, Kevin Samuel wrote: > Nope, I came to soaplib from here: > > http://soaplib.github.com/soaplib/2_0/index.html > > I can't see any mention of it. heh, good point :) I just added a warning to the documentation page as well. thanks, burak From jiaxiaolei19871112 at gmail.com Wed Dec 7 06:31:54 2011 From: jiaxiaolei19871112 at gmail.com (=?UTF-8?B?6LS+5pmT56OK?=) Date: Wed, 7 Dec 2011 13:31:54 +0800 Subject: [Soap-Python] some questions about soaplib In-Reply-To: <4EDE2DB9.4030908@arskom.com.tr> References: <4EDE2DB9.4030908@arskom.com.tr> Message-ID: Hi Burak, Thanks much for your replay. part 1: What you want to said is below, is not it? 1: soaplib work as client is incomplete. A good choice for webservice client is suds. 2: "Currently, the only advantage of using rpclib as a soap client is its speed and if you need speed that bad, you should not be using soap (or xml) anyway.", do you mean that soap is slow and we did nothing about it. part 2: "Does this answer your question, or is there any more", In fact, i want to know why sometimes suds throws a stack of exceptions when invoke soaplib sever. I have to admire most of time it's okay and wastes longer time. The details is reported in problem 2 of my mail. part 3: Do you have some experience about Java Axis2? I developed a webservice server-side using tornadows(tornadow webservice.Besides soaplib, tornadows is the best server-side I have meet). I use suds-client invoke tornadows-server successfully. While, if i use Java Axis2 invoke it, nothing happened and the request nearly not reach the server. In actual fact, how to invoke a webservice server-side successfully is my true question. What I need is provide a python webservice server-side which can be invoked by Java Axis2. This is why i try to find a good webservice server-side, including soaplib. you can see the code in detail: # server-side: tornadows import logging import tornado.httpserver import tornado.ioloop import tornado.web from tornadows import soaphandler from tornadows import webservices from tornadows import xmltypes from tornadows.soaphandler import webservice from tornado.options import define, options define('mode', default='deploy') define('port', type=int, default=8000) options['logging'].set('warning') class SMSService(soaphandler.SoapHandler): @webservice(_params=xmltypes.Integer,_returns=xmltypes.Integer) def getPrice(self,a): return 1987 if __name__ == '__main__': service = [('SMSService',SMSService)] app = webservices.WebService(service) ws = tornado.httpserver.HTTPServer(app) ws.listen(options.port) logging.warn("SMSService running on: localhost:%d", options.port) tornado.ioloop.IOLoop.instance().start() # wsdl: you can find it in web browser through the url ? http://172.16.2.46:8000/SMSService?wsdl? # client: package client; import javax.xml.namespace.QName; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.rpc.client.RPCServiceClient; public class client_for_python { public static void main(String[] args) throws Exception { // step 1: ??RPC????WebService RPCServiceClient serviceClient = new RPCServiceClient(); Options options = serviceClient.getOptions(); // step 2: ????WebService?URL // url for python String url2 = "http://172.16.2.46:8000/SMSService"; EndpointReference targetEPR = new EndpointReference(url2); options.setTo(targetEPR); // step 3: ??getGreeting?????? // step 5-6: (similiar whit // it!)?????getPrice?????????????getGreeting??????? Class[] classes = new Class[] { int.class }; QName opAddEntry = new QName( "http://172.16.2.46:8000/SMSService/getPrice"); System.out.println(serviceClient.invokeBlocking(opAddEntry, new Object[] {1}, classes)[0]); } } # NOTE: the client get nothing from sever-side and server-side get nothing from Axis2-client. Apart from it, I made a server-side using soaplib. Still be failed though. # server-side: soaplib from soaplib.wsgi_soap import SimpleWSGISoapApp from soaplib.service import soapmethod from soaplib.serializers.clazz import ClassSerializer from soaplib.serializers.primitive import String, Integer, Array, DateTime class SMSService(SimpleWSGISoapApp): @soapmethod(_returns=Integer) def getPrice(self): return 11 if __name__=='__main__': try: from wsgiref.simple_server import make_server server = make_server('localhost', 7789,SMSService()) server.serve_forever() except ImportError: print "Error: example server code requires Python >= 2.5" #wsdl: I cannot get wsdl form web browser, and I get the wsdl using "w3m http//localhost:7789/?wsdl' from the server-side. # client: Java Axis2 package client; import javax.xml.namespace.QName; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.rpc.client.RPCServiceClient; public class client_for_python_soaplib { public static void main(String[] args) throws Exception { // step 1: ??RPC????WebService RPCServiceClient serviceClient = new RPCServiceClient(); Options options = serviceClient.getOptions(); // step 2: ????WebService?URL // url for python String url2 = "http://172.16.2.46:7789"; EndpointReference targetEPR = new EndpointReference(url2); options.setTo(targetEPR); // step 3: ??getGreeting?????? // step 5-6: (similiar whit // it!)?????getPrice?????????????getGreeting??????? Class[] classes = new Class[] { int.class }; QName opAddEntry = new QName(url2, "SMSService.SMSService"); System.out.println(serviceClient.invokeBlocking(opAddEntry, new Object[] {1}, classes)[0]); } } # output: Exception in thread "main" org.apache.axis2.AxisFault: Connection refused: connect at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:197) at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:404) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:231) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:443) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531) at org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:102) at client.client_for_python_soaplib.main(client_for_python_soaplib.java:25) Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:519) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140) at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:125) at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707) at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397) at org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:621) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193) ... 11 more Thanks ahead for your time and sprit. -- Jia Xiaolei On Tue, Dec 6, 2011 at 10:59 PM, Burak Arslan wrote: > > Hi Jia, > > If you need a soap client, just use suds and don't bother with > rpclib/soaplib. It's just incomplete. Currently, the only advantage of > using rpclib as a soap client is its speed and if you need speed that bad, > you should not be using soap (or xml) anyway. > > Does this answer your question, or is there any more questions hidden in > the heap below? > > best, > burak > > > On 12/06/11 16:03, ??? wrote: > > Hi, all: > > Recently, I have been do something about python webservice. Above all > the methods of python webservice, soaplib is welcome and popular. When > using soaplib, some problems puzzled me as follows. > > porlbem 1: soaplib provide client-side or not? > Usually, I use soaplib as follows: > > # file-name: soaplib_server.py: > # -*- coding:utf-8 -*- > > from soaplib.wsgi_soap import SimpleWSGISoapApp > from soaplib.service import soapmethod > from soaplib.serializers.clazz import ClassSerializer > from soaplib.serializers.primitive import String, Integer, Array, DateTime > > > class SMS(ClassSerializer): > class types: > mobile = String > content = String > > class SMSService(SimpleWSGISoapApp): > @soapmethod(String, _returns=Array(SMS)) > def get_sms(self,id): > sms_lst = [] > sms = SMS() > sms.mobile = "13011292217" > sms.content = "hi, it's a test!" > sms_lst.append(sms) > return sms_lst > > def make_client(): > from soaplib.client import make_service_client > client = make_service_client('http://localhost:7789/' ,SMSService()) > return client > > if __name__=='__main__': > try: > from wsgiref.simple_server import make_server > server = make_server('localhost', 7789,SMSService()) > server.serve_forever() > except ImportError: > print "Error: example server code requires Python >= 2.5" > > #file-name: suds_client.py > import suds > > def test_soaplib3(): > import logging > logging.basicConfig(level=logging.ERROR) > > url = "http://localhost:7789/?wsdl" > client = suds.client.Client(url,cache=None) > print 'client', client > output = client.service.get_sms('jia') > print 'output', output > > #NOTE: Certainly, it's okay. Below is the output: > > #output: > client > Suds ( https://fedorahosted.org/suds/ ) version: 0.3.7 GA build: > R580-20091016 > > Service ( SMSService ) tns="SMSService.SMSService" > Prefixes (1) > ns0 = "SMSService.SMSService" > Ports (1): > (SMSService) > Methods (1): > get_sms(xs:string id, ) > Types (4): > SMS > SMSArray > get_sms > get_smsResponse > > > output (SMSArray){ > _type = "tns:SMSArray" > SMS[] = > (SMS){ > content = "hi, it's a test!" > mobile = "13011292217" > }, > } > > #NOTE: do you find the "def make_client():" in the server-side ? It's no > use when we use suds_client.py. Now, let me talk the problem: > I think soaplib is only a server-side and without client, you also can > find the words as follows in "http://soaplib.github.com/soaplib/2_0/": > "Soaplib is an easy to use Python library for publishing SOAP web services > using WSDL 1.1 standard, and answering SOAP 1.1 requests. With a very small > amount of code, soaplib allows you to write a useful web service and deploy > it as a WSGI application. (Non-WSGI scenarios are also supported.)" > Most of scenes, soaplib make as server and suds did for client. They can > work together well. > In a web page, I found someone use client by soaplib, the client can be > write as follows: > > # file-name: soaplib_client.py > # -*- coding:utf-8 -*- > > from soaplib_server3 import SMSService > from soaplib_server3 import make_client > import lxml.etree as et > > a = make_client() > ret = a.get_sms('jia') > print 'ret:', ret > print 'type of ret:', type(ret) > for i,r in enumerate(ret): > print 'i:',i, r.mobile, r.content > > #output: > ret: [] > type of ret: > i: 0 13011292217 hi, it's a test! > > #NOTE: now, the questions are : > 1: Whether soaplib can provide client? > 2: If the answer for question 1 is okay, then the second question is : how > to provide a webservice client using soaplib? Is the method "client = > make_service_client('http://localhost:7789/' ,SMSService())" which is be > used in my soaplib_serve.py? > 3: if you agree that soaplib can make as websevice client-side, I would > like to ask: The client relays so heavily on sever-side, in the > client-side, it requests some classes or modules in server side are > imported. If we use soaplib-client to invoke a remote server(it may be > developed in Java, C#, php or other language, or python which is not in the > some local), how we get the class in server? > > I do not whether i speak my question clearly. In actual fact, what I > eager to know is how to provide a client-side using soaplib if soaplib can. > > > part 2: Is there someone find it spend much time and not stable to > invoke soaplib using suds as follows. > #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(): > > url = "http://localhost:7789/?wsdl" > 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", > } > ? > or the exception below(it?s not present 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 > 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 time and concentration. Any relay is welcome. > > -- Jia Xiaolei > > > _______________________________________________ > Soap mailing listSoap at python.orghttp://mail.python.org/mailman/listinfo/soap > > > -- NAME: ???/Jia Xiaolei MOBILE: 13011292217 QQ: 281304051 MICRO-BLOG: http://weibo.com/2183890715 GMAIL: jiaxiaolei19871112 at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jimws123 at gmail.com Wed Dec 7 23:51:18 2011 From: jimws123 at gmail.com (Jim) Date: Wed, 7 Dec 2011 23:51:18 +0100 Subject: [Soap-Python] [Pywebsvcs-talk] a question about suds In-Reply-To: References: <20191.4897.637489.913520@localhost.localdomain> Message-ID: 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, ??? 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 : > > xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"xmlns:soapenc=" > http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime=" > http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://WebXml.com.cn/" > xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12=*" > http://schemas.xmlsoap.org/wsdl/soap12/*"xmlns:http=" > http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl=" > http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://WebXml.com.cn/"> > > > 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(): > > url = "http://localhost:7789/?wsdl" > 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 > 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 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 > MICRO-BLOG: http://weibo.com/2183890715 > GMAIL: jiaxiaolei19871112 at gmail.com > > > > ------------------------------------------------------------------------------ > 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 at lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pywebsvcs-talk > Also archived at http://groups.google.com/group/pywebsvcs > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From burak.arslan at arskom.com.tr Fri Dec 16 18:28:43 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Fri, 16 Dec 2011 19:28:43 +0200 Subject: [Soap-Python] [rpclib] a new major beta release, 2.5.0 (#115) In-Reply-To: References: Message-ID: <4EEB7FCB.3010900@arskom.com.tr> On 12/16/11 19:07, azurit wrote: > what are the goals until mark 'beta' can be removed ? :) we are running rpclib for some time in production on quite big services. > > --- > Reply to this email directly or view it on GitHub: > https://github.com/arskom/rpclib/pull/115#issuecomment-3179775 rpclib will be released as stable when 1) all tests are green and 2) all of the following issues are fixed: https://github.com/arskom/rpclib/issues?sort=created&direction=desc&state=open&page=1&milestone=2 you should help me with those if you want rpclib to be released in non-beta status asap. those are real problems that affect some use cases. so i can't lift the beta tag w/o solving these. the beta tag gives me right to slightly break backwards compatibility every release. so currently i rather like it. see here: http://arskom.github.com/rpclib/h_and_f.html#versioning when it's lifted, rpclib will be a true production-worthy library. i don't see this happening soon given the amount of contributions i'm getting (slightly higher than zero) and given the complexity of the sqlalchemy recursion loop problem. best burak From vsza at vsza.hu Sun Dec 18 17:29:59 2011 From: vsza at vsza.hu (Veres-Szentkiralyi Andras) Date: Sun, 18 Dec 2011 17:29:59 +0100 Subject: [Soap-Python] Introducing SudsSigner: WSS digital signature for SUDS Message-ID: <201112181729.59755.vsza@vsza.hu> Hi, I implemented basic WS-Security-compliant digital signature support for SUDS as a message plugins, so it's usable without modifying the library source code. I put most information necessary to try it into the README.md file, in case you're interested about the internals, I've written my masters thesis about it, latter can be downloaded from http://vsza.hu/thesis-beta.pdf I tested my solution with Apache CXF, so any other interoperation experiences are welcome, along with other suggestions and/or patches. The code can be downloaded from my GitHub repository: http://git.io/sudsign -- Regards, Andr?s Veres-Szentkir?lyi From burak.arslan at arskom.com.tr Mon Dec 19 12:35:33 2011 From: burak.arslan at arskom.com.tr (Burak Arslan) Date: Mon, 19 Dec 2011 13:35:33 +0200 Subject: [Soap-Python] Introducing SudsSigner: WSS digital signature for SUDS In-Reply-To: <201112181729.59755.vsza@vsza.hu> References: <201112181729.59755.vsza@vsza.hu> Message-ID: <4EEF2185.9060803@arskom.com.tr> On 12/18/11 18:29, Veres-Szentkiralyi Andras wrote: > Hi, > I implemented basic WS-Security-compliant digital signature support for SUDS > as a message plugins, so it's usable without modifying the library source > code. I put most information necessary to try it into the README.md file, in > case you're interested about the internals, I've written my masters thesis > about it, latter can be downloaded from http://vsza.hu/thesis-beta.pdf > > I tested my solution with Apache CXF, so any other interoperation experiences > are welcome, along with other suggestions and/or patches. > > The code can be downloaded from my GitHub repository: http://git.io/sudsign Wow, I got cited in an MSc. thesis, albeit indirectly :) Thank you and congratulations! I got a favour to ask: would you mind updating the ZSI and SoapPy parts for rpclib comparison document with fragments from your thesis? I could plagiarize from the document but I'd feel much more comfortable if that happened by your hand. it's here: https://github.com/arskom/rpclib/blob/master/doc/source/comparison.rst again, thanks and congrats :) burak