[Soap-Python] How to interact with SOAP service from client perspective ?

Raphaël Barrois raphael.barrois at polyconseil.fr
Thu Jul 12 09:45:38 CEST 2012


Hi Lukasz,

I encountered the same issue recently with suds and a .net-generated WSDL, so I wrote a patch — works great in production for a few months.
I'm planning to submit it upstream if I can find an example WSDL suds cannot parse.

Hope it helps !

Raphaël BARROIS


-------------- next part --------------
A non-text attachment was scrubbed...
Name: suds-fix-recursive-wsdls.patch
Type: application/octet-stream
Size: 3023 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/soap/attachments/20120712/11db1e4d/attachment-0001.obj>
-------------- next part --------------


On 11 juil. 2012, at 23:56, Lukasz Szybalski wrote:

> 
> 
> On Wed, Jul 11, 2012 at 3:38 PM, Alex <ralienpp at gmail.com> wrote:
> Hi Lukasz,
> 
> 
> I have recently began using rpclib, and as a beginner - I think I will be able to provide some tips that will help you get started.
> 
> 
> First of all, it is not clear from your message what you are trying to do:
> - a client, i.e. connect to an existing server and call its functions, OR
> - a server, i.e. let others connect to your server and call your functions
> 
> 
> I think you want a client; in that case you should use suds:
> https://fedorahosted.org/suds/
> 
> If you want to build a server, then rpclib/spyne is the right tool for the job. You can also give a try to Ladon - it is very friendly with beginners (I managed to set it up and create a server very quickly).
> 
> Eventually I chose rpclib because Burak provided very fast feedback and because rpclib offered some features I needed.
> 
> 
> Using suds is very easy, I attached an example I use myself. It connects to a locally hosted SOAP server; the example assumes that I know the name of the function I want to call, and that I know all of its arguments - which I pass via a dictionary.
> 
> Otherwise, you can also use the factory.create function, which will construct an object for you, and later you just fill in the values, like this:
> 
> 	c = Client('http://localhost:7789/?wsdl')
> 	a = c.factory.create('ns1:PhysicalPersonDataRequest')
> 	a.lastName = u'Samurai'
> 	a.firstName = u'Jack'
> 	a.birthDate = u'1945-12-31'
> 	a.idnp = u'1234567890123'
> 	a.icSerial = u'A'
> 	a.icNumber = u'12345'
> 
> 	result = c.service.RegisterPhysicalPerson(a)
> 
> 
> I hope this helps. 
> 
> 
> Problem with suds is this:
> c = suds.client.Client('http://localhost:7789/?wsdl')
>  RuntimeError: maximum recursion depth exceeded while calling a Python object
> 
> Even if you increase the recursion limit to 10,000 or 100,000 it still fails later with "segmentation fault".
> 
> So rpclib is my only choice here. ZSI (wsdl2py) doesn't have this problem but I can't figure it out, so I was hoping rpclib would work for me, but I need example of client code.
> 
> 1. service = someClientCode(url=h'ttp://example.com/LoginService.svc?wsdl')
> 2. request= RequestObjectforBelowfunction(Username='myuser',Password='mypassword')
> 3. response=service.GetSecurityKey(request)
> 
> 
> 
> Thanks,
> Lucas
> 
> 
> _______________________________________________
> Soap mailing list
> Soap at python.org
> http://mail.python.org/mailman/listinfo/soap



More information about the Soap mailing list