I have an wsdl file describing the communication server-client on a Java product.
I'm implementing a new server based on Python that will implement the same services.
Do you know of any method to create the Python server code based on the wsdl, that does not requires me to write all of the complextypes involved?
Also, what Api do you recommend?
This question has not received enough attention.
The currently accepted answer is good, but its answer is 'no'. Is there really no reasonably maintained and general solution?
Unfortunately, I don't think the negative answer is due to lack of attention to the question. There really is no support for WSDL in python. If you want to avoid the complexities of building your own soap envelope from scratch the only thing I can recommend you is building a sample envelope using any of the many soap webservices tools (soapui for instance) and then use it as a template string (I know, horrible) in your python code
UPDATE you could use spyne. It's a python RPC toolkit that among other protocols supports SOAP. It will create the WSDL for you, but if your objective is implementing the service described by the WSDL you already have then you'll have to fine tune your spyne service (written in python) until the generated WSDL matches the original
When it comes to SOAP support, Python unfortunately no longer is with "batteries included". The support on client side is acceptable but on server side you are basically on your own.
You might want to look at the following for starters:
http://wiki.python.org/moin/WebServices
http://pywebsvcs.sourceforge.net/
http://doughellmann.com/2009/09/01/evaluating-tools-for-developing-with-soap-in-python.html
If you really want to go on this route, it seems that ZSI is the tool to use, although I have my doubts that it will work with the latest 2.x Python distribution.
Using Python 2.6.6, I tried to use ZSI 2.0 to build a web service starting from the WSDL. Got some "module has been deprecated" warnings when generating the code with wsdl2py and wsdl2dispatch, had to separately install PyXML and hack my sys.path just to make it resolve first or else I got "module ext.reader does not exist" then only to end up with a disappointing "ZSI:EvaluateException Got None for nillable(False), minOccurs(1) element" error on a basic "Hello world!" WS with a required element.
Switched to ZSI 2.1_a1 which no longer needs PyXML and wsdl2py does it all (what wsdl2dispatch did for 2.0) but still ended up in a dead end with "ZSI:EvaluateException Got None for nillable(False), minOccurs(1) element" errors.
The experience wasn't very fun but it was enough for me to form an opinion about what Python has to offer for SOAP web services... which ain't much (and that was just for basic web services nothing fancy like WS-* specs). YMMV!
EDIT : I recently bumped into this SO question, and although oriented versus a client solution, it does also mention a few libraries for building SOAP services.
Related
I have been trying to wrap my head around a few things and I havent found a concrete solution for the same.
I want to use a SOAP web service to get an XML data and then parse the received XML data.
So far, I have only found libraries compatible with python 2.xx and I want something comaptible with python 3.xx. I have tried Zeep but I wasnt able to configure it as its module was released on May 15th.
Anyway, I would like to be guided towards a library which can help me setup a SOAP client on python 3.6 allowing me to use its methods to send requests and consume the response.
My research has shown zeep is really the only currently maintained one. I'm using python 3.6 and using it for SOAP (5/2019).
Quick google search came up with these links which are fresh for 5/2019:
What SOAP libraries exist for Python 3.x? which I believe is already referenced in the comments (I'm new and can't comment).
Another link
https://www.slant.co/topics/268/~best-soap-client-libraries-for-python is good, though the "last updated" column is misleading. Zeep has been updated with in months, but the others have not been updated in years.
I need to implement client notification for android and I thought to use c2dm.
Is there any framework for c2dm in python ? Does anybody have experience with server side c2dm in python ?
I don't know of an existing library, but I also recently searched how to send notifications to my droid using Python, and I came throuht this blog post which explains how C2DM works and gives a sample Python implementation. I didn't test it yet, but I believe it could be useful as a base at least.
EDIT:
There is also this site which offers the ability to send C2DM notifications to your droid via their servers using an API, and there's even a python library to access it more easily.
EDIT 2:
To use NotifyMyAndroid, it seems you have to install their software on your phone (of I didn't understand how it works ^^)
Any pointers, advice on implementing a REST API on App Engine with Python? Using webapp for the application itself.
What I currently know is that I can:
hack up my own webapp handlers for handling REST-like URIs, but this seems to lose its elegance for larger amounts of resources. I mean, it's simple when it comes to temperature/atlanta, but not so much* for even a rather simple /users/alice/address/work (though do keep in mind that I'm not saying this after having implemented that, just after spending some time trying to design an appropriate handler, so my perception may be off).
use the REST functionality provided by one of the bigger Python web frameworks out there. I have some unexplainable sympathy towards web2py, but, since it's not used for the project, bundling it with the application just to provide some REST functionality seems.. overkill?
(Huh, looks like I don't like any of these approaches. Tough.)
So here's me asking: what advice, preferably based on experience, would you have for me here? What are my options, is my view of them correct, did I miss something?
Thanks in advance.
I had a similar issue. Wanting to quickly get my DataStore exposed via REST to WebApps.
Found: AppEngine REST Server.
I have only used it lightly so far, but it certainly appears to be very useful with a small amount of work. And it does use webapp as you suggested.
ProtoRPC is bundled with the SDK, and it is robust and actively developed (however experimental). Although I think the source code itself is a little convoluted, the feature-set is pretty complete and it was made by someone with experience in creating this kind of library. It supports transmiting using JSON, ProtocolBuffer and URL-encoded formats.
Also, you can create APIs that work on the server side and client side -- it defines a 'message' protocol with implementations in Python and JavaScript. I used other "RESTful" Python libraries, but no other provided this consistency out of the box.
Here is the project page and here is the mailing list.
Edit: maybe their documentation is lacking some keywords, but just to be clear: one or the purposes of ProtoRPC is to provide a solid foundation to create REST services.
I'm looking for a Payment gateway that offers Python SDK which would run on GAE. So far I've looked at Braintree[1] and TrustCommerce[2], and both required C-based libraries to work, which won't work on GAE. If there's no such thing, which payment gateway would you recommend that provides a possibly JSON-based API or a nice RESTful API.
[1] http://www.braintreepayments.com/
[2] http://www.trustcommerce.com/
Braintree uses PycURL library which is C-based
TrustCommerce comes with some C files that need to be compiled during install
EDIT:
I'll vote close on this, because it's been suggested that such thing is impossible because URLfetch has a 10 second limit which is not sufficient in this case. For those interested, it has been suggested to me that using a proxy for payment processing would be better.
It would be really helpful if you provided links. I googled and found this TrustCommerce, but I guess maybe it's a different company to the one you are talking about because they say there is sample Python code.
I didn't sign up for a trial account just to see if the Python API requires a C library. Afterall maybe it's not even the same TrustCommerce you have looked at.
This isn't really the right site to do your research, you should come back and ask for help if you have problems using the API when you have found/chosen one.
anyone using nagare framework on google app engine ?
it seems interesting, but i could not find any documentaiton on how to use it on
google app engine, as it uses stackless python.
so any chances of its running on google app engine ?
also, how stack less python differ from normal python ?
thanks.
links :
Nagare Framework
Stackless python
I currently have a not-yet-released, prototype version of Nagare for GAE (you can see the canonical Counter example at http://nagareproject.appspot.com/)
Here are the 3 Nagare components not working on GAE, with their workarounds in this prototype:
Stackless Python:
Problem: GAE is only pure vanilla CPython
Solution: well, use only pure Python
Limitation: in Nagare, Stackless Python is used to obtain continuation objects. Without Stackless, we lose the call()/answer() feature of Nagare. But note that call()/on_answer() is still working.
Lxml:
Problem: C module not accepted on GAE
Solution: HTML generation rewrote using only ElementTree
Limitation: no more advance Lxml features like XSL or complex XPATH expressions
PEAK-Rules:
Problem: standard AST tree management removed on GAE
Solution: rules management for HTML/JS generation rewrote
Limitation: the security and URL dispatch rules must be written by the developer without the help of generic methods
So, this version of Nagare is pretty much working fine on GAE. And I dare to say that, even with these limitations, Nagare still stay on GAE a better programming environement than the others Python frameworks.
If you want to test it, send a message in the Nagare users group or send me a personal mail to alain.poirier at net-ng.com
If it has a hard dependency on Stackless, it won't run on AppEngine. AE has its own Python runtime. If it doesn't leverage any of Stackless's non-standard extensions to Python, it might work, but I'd say that your chances aren't very good that it would just work.