Lately i've been playing a bit around with the spreadshirt webservice. We wanted a navigation based on the desings and automation of reoccuring tasks is so wonderfull. So i had a look in the rss feed and didnt find any usefull infos. The only other ways to get infos from spreadshirt i am aware of is either the xml export (dont know much, dont have premium access or an export file) and the webservice. I took the webservice approach....
Soap with python:
During my research i found SOAPPy, the new ZSI variant and soap element. The last wanted me to handle too much of the message stuff and i ditched it for my purpose. The framework itself looked nice and if you want construct the messages yourself i bet its a good choice.
Then i tried soappy and zsi. Zsi offeres a tool to generate the classes for the given wsdl and you just code against them. Everything else is handled internaly. A bit like axis for java and yeah it actually was easy and worked well until i wanted to get the articles of the spreadshirtshop. baam doesnt work anymore. The wsdl is wrong! They dont maintain their own public interface descriptions. The webservice works, but does not give back what it should as per wsdl. ZSI was out.
Next i tried soappy and hey it worked. in- and output is constructed by runtime and doesnt seem to be validated against the wsdl. But you need to know what to all. Create a SOAPProxy for your service and just use the name of the soap message as method name. See example:
import SOAPpy server = SOAPpy.SOAPProxy("http://www.spreadshirt.net/services.php") token = server.initialize_session(shopId) entries= server.get_designs(token, shopId):
Takes the shopid and creates a session for us. The received token (sessionid) is used by following call(s). Now we get the designs by calling get_designs, use the token and the shopid again as parameters and wow get a lot of nice designs.
For more info on the spreadshirt webservice look in their doc. At least this was correct as far as i could see. (even the webservice offered 3 methods, which werent described in the doc)
I am still impressed how easy some tasks are in python. Guess i had to write some more gluecode in java...
comments powered by Disqus