I contacted the developer of the Web Service to see if he could help troubleshoot the com.sun.xml.internal.ws.server.UnsupportedMediaException that I was getting. At first he said he wasn't getting the exception but when I sent him the code of the simple Java client I had built he reproduced the error.
It appeared that my code was sending a blank string for one of the query parameters and rather than sending XML the service was generating an HTML error page--something a SOAP service is not supposed to do. The developer determined that the problem was with the Saxon9 library file built into the Web service projects. The Saxon library is needed for XSLT 2.0 transformations but, apparently, there are problems using Saxon9 with Glassfish. Once the library was moved out of the projects and into the system lib for Glassfish, the service began returning the correct error messages. From there, it was up to me to do my usual fumbling around with trial and error and using the NetBeans debugger to get the portlet working.
Meanwhile, I had the opportunity to do some reading in the book "JBoss Portal Server Development" by Ramanujam Rao. The sample code accompanying the book gave me an idea on how to restructure the geonames portlet. Instead of having one form on the view page with a pulldown to select the four different service options I created 5 different view pages. The initial page is a table with links and descriptions of the 4 services. Behind the links I use the renderURL to load the view page for the selected service. This made it much easier to break out the slight differences in input parameters for each of the 4. It took me awhile to grasp the correct logic flow to make sure the right page is displayed at the right time and that the data is there for dispaly when it's supposed to be.
That exercise gave me a better understanding of when to use renderURL versus actionURL and the difference between parameters and attributes. Since the Portlet Specification is modeled after the Servlet Specification I would probably have an easier time grasping the concepts if I were more familiar with the Servlet spec.
On to the next one--Geographic Translator service. Looks complicated.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment