Getting Open Laszlo to talk to a Java Web Service
Synopsis - This posting discusses SOAP interoperability between Open Laszlo and Java, finishing with a working example of a Laszlo application talking to a Java-based web service exposed using XFire.
So, I've decided to take the rich internet application (RIA) plunge, and Open Laszlo is my weapon of choice. It provides some nice-looking, object-oriented, GUI components. It also runs on Macromedia Flash, which is pretty widely deployed and very stable. It's basically an open-source alternative to Macromedia Flex, which appealed to me since I'm not into buying enterprise software for personal use (who is, really?). It's not a full comparison, but Steven Webster has some interesting opinions on the subject.
One of the ostensibly cool things about Laszlo is that it supports RPC directly to Java objects as well to SOAP services, plus document style (a.k.a. document literal) web service integration. I'm a big fan of keeping architectures as simple as possible (which is I like a lot of Rod Johnson's ideas). So naturally, my initial impulse was to explore this Java RPC stuff in Laszlo. Well, after some experimenting, it became pretty clear to me that one of the most powerful features of Laszlo is its databinding functionality, which is built around the dataset tag and is heavily XML based. As far as I can tell after a couple of days of experimenting with it, the dataset tag and RPC don't mix, which is as true of the Java RPC model as it is of SOAP RPC. So, that left me with SOAP document style integration.
To make a long story short, SOAP interoperability is not where it needs to be and Laszlo's implementation doesn't make it any easier. Laszlo's SOAP support is built around Axis (I'm not sure which version, but it appears to be pre-1.2). If you're trying to do document style web services, this is strike one. On top of this, Laszlo has to deal with the challenge of deserializing return values into objects that can be accessed from Javascript. Not surprisingly, this leads to Laszlo implementing a rather convoluted extension to Axis (no knock on the Laszlo guys, as I wouldn't even have known where to begin to tackle this one!). The fact that I wasn't able to find any examples of Laszlo talking to an Axis (or even Java) web service in the very good Laszlo documentation, nor anywhere on the web should have been a clear sign that I was in trouble. Remember, Laszlo is deployed on a Java platform after-all!
Thankfully, the Laszlo team seems to be paying attention to the WS-I's Basic Profile specification. Finally, a pitch we can hit! If Laszlo can talk to a Dot Net web service, it has to be able to talk to a Java one too, doesn't it? Turns out that it can, but as most things with SOAP it's not intuitive. Completing this example should give the reader a good idea of how to get started on making Laszlo and Java interoperate over SOAP.
I'm just getting going with this myself and I have a feeling that I'm going to really like Laszlo now that I've got a workable SOAP set-up. As I learn more, I'll try to post additional articles and examples.

2 Comments:
I enjoyed your sample album -- makes me wish I'd chosen a Bentley as my get-away car! I also noticed that your prices seem very reasonable compared to what we're accustomed to in the States--kudos for not taking advantage of couples on their best day.
For some reason the JavaWorld print link is broken. Just go here for the non-print version of the article.
Post a Comment
<< Home