In my last attempt, I tried rejiggering the GWT Designer Log-in Manager tutorial to implement my own functionality. Specifically, I planned to keep the UI elements (panels, textboxes, buttons etc) but change the labels and functions to implement a Temperature Converter web application which accepted temperature values and made calls to converter service which actually resided in the server back-end. My desire was for the service to be SOAP/HTTP service which was called by GWT server which in turned serviced the GWT client. My implementation approach was to just deal with GWT client/server aspect first before introducing the SOAP service. This is the Log-in Manager tutorial, I started with:
And this was the GWT Remote Procedure Call tutorial which I was leveraging in order to rejigger above tutorial to add RPC functionality:
I had written about completing the RPC tutorial in earlier post (Begining Web/SOA/J2EE Dev). However, this was were I as getting stuck. This RPC tutorial has a rather confusing/clumsy syntax for linnking the web service interface, its implementation, the client proxy and the async callback function. It was not helping that I was trying to learn how to apply the RPC at the same time as I was rejiggering UI tutorial which was also my first exposure to the GWT Designer (Window Builder project). So, I took different approact of first completing start-to-finnish GWT Desinger project and then returing to the RPC aspects. For a fresh start I turned to a different GWT Designer project from the Log-in Manager application. It's another StockWatcher app similar to the one I did in Begining Web/SOA/J2EE Dev but this one is done using GWT Designer/Window Builder:
I completed this tutorial painlessly and it gave me even more appreciation for GWT for web application UI over straight-up HTML/Javascript which, again, is what GWT ultimately generates/deploys. It just makes the coding/development seemingly easier/better because it allows you to develop in good old Java and uses familiar UI development constructs. So, I'm now a GWT client app developer Wizard (not exactly) but the problem still was that I had no server side implementation or link from client to server. Fortunately, I found a different tutorial which had much more straight forward approach to dealing with this GWT RPC:
First, I used the GWT RemoteService Wizard to redo the StockWatcher GWT Designer web application to remotely call the stock watcher service (rather than use client side implementation). Worked like a charm. Then I proceeded to create my very own GWT Designer web application from scratch to implement a temperature conversion application. First, I created the client side using same steps as Stock Watcher tutorial with the temperature conversion logic located in the client, then I followed the GWT Remote Service Wizard steps to transfer the conversion logic to the GWT service, finally I used eclipse webservice client generator to create client class from my web service which was a J2EE application (EAR) I had previous created deployed on Glassfish server. that experience will be covered in future blog entry. The GWT pieces are covered in the Google tutorials but the Eclipse web service client generator is not. From the GWT Window Project in Eclipse, navigate to the following:
File -> New -> Other -> Web Services - Web Service Client
Then enter the WSDL location for you web-service. Turn the dial on the client-o-creator to "Develop Client"...you can turn it all the way up to assemble, deploy, or test but then you'd need to add/configure a suitable Web Application Server to your workspace (which can be a very useful thing to test or get a feel for the Web Service operations but not something needed right this second...especially since I develeloped/deployed this particular service).
Hit Finnish...and presto !
Now, you'll see a new package with a bunch Plain Old Java Objects (pojos) in your project explorer new. Below, this new package is appopriately named com.ola.pojo (named by me when I originally created the webservice). The package contains an Interface class called TempConverter.java which shows the methods that the class provides aka as the operations provided by the service. Additionally, the package includes a bunch of supporting classes TempConverterProxy.java, TempConverterPrixy,TempConverterServiceLocator.java,TempConverterSoapBindingStub.java, all created by the Eclipse tooling from the WSDL which I had specified. All you now need to do use this service is to instantiate an obect of TempConverterProxy and you can call any of its methods/properties just like its a pojo object...pretty neat, I think.
And after all that - creating web service using J2EE, deploying that services as a EAR package into Glassfish J2EE container, Creating GWT RPC server to call/consume that web service, and then finally creating GWT client to provide UI and use the web service methods via RPC calls to GWT server - what you have is...
File -> New -> Other -> Web Services - Web Service Client
Then enter the WSDL location for you web-service. Turn the dial on the client-o-creator to "Develop Client"...you can turn it all the way up to assemble, deploy, or test but then you'd need to add/configure a suitable Web Application Server to your workspace (which can be a very useful thing to test or get a feel for the Web Service operations but not something needed right this second...especially since I develeloped/deployed this particular service).
Hit Finnish...and presto !
Now, you'll see a new package with a bunch Plain Old Java Objects (pojos) in your project explorer new. Below, this new package is appopriately named com.ola.pojo (named by me when I originally created the webservice). The package contains an Interface class called TempConverter.java which shows the methods that the class provides aka as the operations provided by the service. Additionally, the package includes a bunch of supporting classes TempConverterProxy.java, TempConverterPrixy,TempConverterServiceLocator.java,TempConverterSoapBindingStub.java, all created by the Eclipse tooling from the WSDL which I had specified. All you now need to do use this service is to instantiate an obect of TempConverterProxy and you can call any of its methods/properties just like its a pojo object...pretty neat, I think.
And after all that - creating web service using J2EE, deploying that services as a EAR package into Glassfish J2EE container, Creating GWT RPC server to call/consume that web service, and then finally creating GWT client to provide UI and use the web service methods via RPC calls to GWT server - what you have is...
So, at the top of the post, I declared success of full E2E implentation of a web application stack...well, almost the full stack. This humble app is still missing the database/persistence functionality. Next, I'll try to get a diagram together illustrating the full stack. And I'll continue work on another app to also implement persistence.