So, I just found TGWebServices. It looks very usable. Thanks a lot Kevin. I went straight of and wrote a quick test. It generates the WSDL just fine, but now I would like to test it by making a client request on that servcie.
As I am quite comfy with PHP, I wrote a quick client script that should access it. But it fails (details will follow). Now, It has been a while since I last used PHP, and as it happens, PHP now has SOAP support built-in. So I just copied a client example from http://www.tutorials.de/forum/860394-post1.html (mind you, it's in german, but the code should be understandable). What do you guys use to test the web services. I also tried ZSI, but it gave me some errors too. Here is the test-code I wrote and the errors: ------------------------------------------------------------------------------ - Controller ------------------------------------------------------------------------------ [...] class WsRoot(WebServicesRoot): @wsexpose(int) @wsvalidate(int, int) def mul( x, y ): return x*y @wsexpose(str) @wsvalidate(int) def stringify( x ): return "--%d--" % x class Root(controllers.RootController): wsevent = WsRoot('http://192.168.1.2:8080/wsevent/') [...] ------------------------------------------------------------------------------ - Client (PHP) ------------------------------------------------------------------------------ try{ $client = new SoapClient( 'http://192.168.1.2:8080/wsevent/ soap/api.wsdl' ); $result = $client->stringify(5); } catch (Exception $e) { print "\n\n"; die(print_r($e,1 )); } ------------------------------------------------------------------------------ - Error (PHP) ------------------------------------------------------------------------------ omnivore:test $ php wstest.php SoapFault Object ( [message:protected] => [string:private] => [code:protected] => 0 [file:protected] => /home/exhuma/work/test/wstest.php [line:protected] => 32 [trace:private] => Array ( [0] => Array ( [function] => __call [class] => SoapClient [type] => -> [args] => Array ( [0] => stringify [1] => Array ( [0] => 5 ) ) ) [1] => Array ( [file] => /home/exhuma/work/test/wstest.php [line] => 32 [function] => stringify [class] => SoapClient [type] => -> [args] => Array ( [0] => 5 ) ) ) [faultstring] => Function ("stringify") is not a valid method for this service [faultcode] => Client [faultcodens] => http://schemas.xmlsoap.org/soap/envelope/ ) ------------------------------------------------------------------------------ - Client (Python) ------------------------------------------------------------------------------ #!/usr/bin/env python import sys,time from ZSI.client import NamedParamBinding as NPBinding b = NPBinding(url='http://192.168.1.2:8080/wsevent/soap/', tracefile=sys.stdout) b.stringify( x=1 ) ------------------------------------------------------------------------------ - Error (Python) ------------------------------------------------------------------------------ omnivore:travelguide26 $ python wstest.py _________________________________ Sun May 13 12:46:56 2007 REQUEST: <SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/ encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" xmlns:xsd="http:// www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP- ENV:Body><stringify><x id="o631568" xsi:type="xsd:int">1</x></ stringify></SOAP-ENV:Body></SOAP-ENV:Envelope> _________________________________ Sun May 13 12:46:57 2007 RESPONSE: 500 Internal Server Error ------- Date: Sun, 13 May 2007 10:46:56 GMT Server: CherryPy/2.2.1 Content-Length: 2751 Content-Type: text/xml;charset=utf-8 Connection: close <Envelope xmlns="http://schemas.xmlsoap.org/soap/ envelope/"><Body><Fault><faultcode>Server</ faultcode><faultstring>("stringify() got multiple values for keyword argument 'x'", <bound method SoapController.index of <tgwebservices.soap.SoapController object at 0x2aaaae15d590>>)</faultstring><detail>Error occurred at Sun May 13 12:46:56 2007 SOAP method: stringify Raw request (first 2K): <SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/ encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ZSI="http://www.zolera.com/schemas/ZSI/" xmlns:xsd="http:// www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/ encoding/"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP- ENV:Body><stringify><x id="o631568" xsi:type="xsd:int"> 1</x></stringify></SOAP-ENV:Body></SOAP- ENV:Envelope> Traceback: Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/ cherrypy/_cphttptools.py", line 105, in _run self.main() File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/ cherrypy/_cphttptools.py", line 254, in main body = page_handler(*virtual_path, **self.params) File "<string>", line 3, in index File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/ turbogears/controllers.py", line 334, in expose output = database.run_with_transaction( File "<string>", line 5, in run_with_transaction File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/ turbogears/database.py", line 302, in so_rwt retval = func(*args, **kw) File "<string>", line 5, in _expose File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/ turbogears/controllers.py", line 351, in <lambda> mapping, fragment, args, kw))) File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/ turbogears/controllers.py", line 378, in _execute_func output = errorhandling.try_call(func, *args, **kw) File "/usr/lib/python2.4/site-packages/TurboGears-1.0.1-py2.4.egg/ turbogears/errorhandling.py", line 73, in try_call return func(self, *args, **kw) File "/usr/lib/python2.4/site-packages/TGWebServices-1.1.2-py2.4.egg/ tgwebservices/soap.py", line 210, in index output = method(**params) File "/usr/lib/python2.4/site-packages/TGWebServices-1.1.2-py2.4.egg/ tgwebservices/controllers.py", line 109, in newfunc return func(self, **kw) TypeError: ("stringify() got multiple values for keyword argument 'x'", <bound method SoapController.index of <tgwebservices.soap.SoapController object at 0x2aaaae15d590>>) </detail></Fault></Body></Envelope> Traceback (most recent call last): File "wstest.py", line 6, in ? b.stringify( x=1 ) File "/usr/lib/python2.4/site-packages/ZSI-2.0.dev_r1240-py2.4.egg/ ZSI/client.py", line 68, in __call__ File "/usr/lib/python2.4/site-packages/ZSI-2.0.dev_r1240-py2.4.egg/ ZSI/client.py", line 175, in RPC File "/usr/lib/python2.4/site-packages/ZSI-2.0.dev_r1240-py2.4.egg/ ZSI/client.py", line 418, in Receive ZSI.FaultException: ("stringify() got multiple values for keyword argument 'x'", <bound method SoapController.index of <tgwebservices.soap.SoapController object at 0x2aaaae15d590>>) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

