Finally, I felt like I had all the components (Tomcat, GWT, J2EE Classfish, Eclipse) installed with a modicum level of understanding gleaned from creating/deploying working code from tutorials to piece together E2E web app. So, I boldly proceeded. However, I was met with new series of challenges or should I say, "learning opportunities"...
FIRST STUMBLING BLOCK
Figuring out how to import Web Service WSDLs for use by View or Controller (JSP/Servlet or GWT framework overaly). After much time, I pieced together that I need to create, in my project, a "web service client proxy" using the WSDL (Eclipse ->Dynamic Web Project -> New -> Web Services -> Web Service Client -> Pop-up Wizard to specify/import WSDL). This creates the plumbing including a class called MyxxxServiceProxy.Java. This class then needs to be instantiated, and its methods called, in my View or Controller…at least this is my working theory
SECOND STUMBLING BLOCK
My Eclipse IDE would not let me import the WSDL using aforementioned wizard. I tried external internet published web services (thinking something may be wrong with my locally authored services). I tried my services running locally on both Glassfish and Tomcat. I tried pasting the WSDL file as resource direct into my Eclipse project…nothing. Google search on error - "IWAB0014E Unexpected exception occurred." - showed this was a known bug that was addressed in previous versions of Eclipse, so should be fixed in my current version (Juno 4.2) but no dice. Suggested workarounds included - restarting/changing workspaces and starting/restarting development mode web server - but none worked. Finally, I tried importing WSDL from my eclipse IDE on my Mac (as opposed to my Ubuntu VM)…success…but now I had to shift development to my Mac but I accepted this for now.
THIRD STUMBLING BLOCK
Now I could, in theory, create views and controllers to consume my web service resource. In practice, I had never actually done this step. In all my disparate tutorials, none had made this crucial connection between either JSP/Servlet or GWT(Client/Server) and Soap/HTML service. So, making this step work, demanded more stumbling, but that itself was not the actual third stumbling block. That, came with my Apple Eclipse IDE being unable to load my local Tomcat Server in it's dev mode.
"Could not load the Tomcat server configuration at /usr/local/apache-tomcat-7.0.29/conf. The configuration may be corrupt or incomplete.
Reason:
Could not load the Tomcat server configuration at /usr/local/apache-tomcat-7.0.29/conf. The configuration may be corrupt or incomplete."
Clearly, the "Reason", which was just a repeat of the error, was very helpful…not. I tried changing, in config/server.xml, apache tomcat port#s from 8080 currently used by my Glassfish server running in my Ubuntu vm which is networked with Mac via Virtualbox (though did not think that was source of error as previous port conflict errors in Eclipse have been more explicit). I also tried tomcat-users.xml configuration. Thinking that the users/roles that I added to manage tomcat from browser, where causing problems for IDE…nothing. Then, as I was typing this journal entry it just hit me "try google !" (dooooh)…and I did. This time, unlike with STUMBLE#2, I met with success. Results indicated that there was an OS (not Tomcat) permissions issue with Eclipse being able to read/write configuration files in tomcat config directory. So, taking the blunt mallet solution approach, I promptly chmod rwx * in /config…even though, something (i.e., common sense) tells me that universal rwx on any folder…especially your web server folder…is generally not a good thing. But I'll come back to it later. For now, glad to be back in business…sorta.
RESOLUTION TO STUMBLE#2
Downloaded/installed new instance of eclipse. That means, also had to reinstall Glassfish plugins and GWT plugins. But tests show WSDL import/client proxy generation is working. Notably, there's no diffence in "Build" version between new/old eclipse versions. One just works. The other doesn't…..aaargh!
Version: Juno Release
Build id: 20120614-1722
TRYING TO CREATE JSP/SERVLET THAT CONSUME WEB SERVICES
After, getting new Eclipse JUNO installed and web service client proxy generation working, I fooled around trying to figure out if/how standard JSP/Servlet framework and Eclipse JSP editor could be used to provide basic/rudimentary web app UI used to call SOAP/HTTP web service. Meeehhn, I know that somehow this "should be possible" but JSP as an "easier" method to deliver client side UI from servlet (as opposed to using servlet to create/format HTML using standard printout) is whack. Maybe there are neat tools out there, besides Eclipse, to do this kind of direct Servlet/JSP formating or maybe I just have not properly wrapped my head arond JSP/Servlets. Eitherway, I was convinced direct coding of Servlet/JSP is not the answer...so, back to Google GWT.
BACK TO GOOGLE GWT
As I journaled on 8/16, I had successfully completed the GWT Stock Watcher sample tutorial which included creating GWT Service and calling from GWT client via GWT RPC. However, available documentation stated that GWT RPC was not same as SOAP/HTTP and that SOAP/HTTP was not directly supported, instead generic HTTP calls could be used. However, since "Eclipse" and its Axis/WebToolkit modules where doing the actual generation of client proxy from WSDL which were then exposed as regular Java classes to components within project, I figured.....eeeah, why not give it a try...
No comments:
Post a Comment