Winter Break with Google App Engine, Google Web Toolkit, ZSI.

For winter break I decided to test some things that I've had in the back log for a while. These things are Google App Engine, Google Web Toolkit, ZSI.

I really like the new technologies that Google is implementing. I personally aren't a fan of javascript, and the way they have managed to hide a lot of it through the use of GWT is amazing, and can actually make you more productive.

Basically what GWT empowers you to do is build an UI pretty much like you would in AWT in Java, this is great for doing basic widgets, like those used in Web Dynpro in SAP. And you can modify their colors and characteristics with CSS aswell.

So you can mostly focus on your code and develop stuff faster.

I'm not a big fan of JSON and would like to avoid it. python-gwt-rpc looks promising.

Another tool I reviewed was Google App Engine. I can say it is amazing, I like it, just like it. Maybe I'm biased because I like python programming.I also went on to mess around a bit with ZSI, which is the python soap web service engine I suppose. Although documentation is scarce; got to add up pieces to get it to do what you need.I wanted to put a web server on python cgi, so I started writing a small wsdl:

<?xml version="1.0" encoding="UTF-8"?>

Then I applied wsdl2py from a python 2.5 installation script's dir on it. From it I grabbed the output python files

Uploaded it to the location along with ZSI in a directory

#!/usr/local/bin/python -d
from CurrentServer_server import *
from ZSI import *
import sys
serialized_result = ""

try:
ps = ParsedSoap(sys.stdin)
curr = ps.Parse(currentRequest.typecode)
sw = SoapWriter(sys.stdout)
result = currentResponse()
result._current = curr._voltage / curr._resistance
sw.serialize(result,currentResponse.typecode)
sw.close()
serialized_result = str(sw)

except ParseException, e:
FaultFromZSIException(e).AsSOAP(OUT)
except Exception, e:
FaultFromException(e, 1).AsSOAP()

if len(serialized_result) > 0:
print 'Content-type: text/xml'
print
print serialized_result
else:
print 'Content-type: text/plain'
print
print 'This is a place holder for a webservice'

Surprisingly, that is all that is needed on the server side.

I also wrote a test client on python and on c# .net to make sure it worked correctly.

Code for C#

Added webreference using the wsdl then...

using zsitesting.linuxReal; // namespace of the webreference


private void Form1_Load(object sender, EventArgs e)
{
c = new CurrentServer(); // form loader
}

private void button1_Click(object sender, EventArgs e)
{
// this is just a button on a 3 textbox form
double d1 = Double.Parse(textBox1.Text);
double d2 = Double.Parse(textBox2.Text);
textBox3.Text = c.Current(d1,d2).ToString();
}

The python client requires to use wsdl2py and grab the client side files for current server.


from CurrentServer_client import *
import sys

loc = CurrentServerLocator()
port = loc.getCurrentPort(tracefile=sys.stdout)

msg = currentRequest()
msg._resistance = 1.5
msg._voltage = 2.0

rsp = port.Current(msg)
print "current: ", rsp._current

There are a few other items that I'm currently working on regarding exploration. Mainly messing with django and google app engine, the google datastore, etc.

Have been playing around with my pic16f84a and learning more about electronics, I guess that could be called a hobby of mine now a days.