I seem to be getting nowhere fast with the Geographic Translator Web Service client. Once everything was fixed to account for the fact that the services WSDL URL had changed, I realized that the confusing instructions on how to pass parameters to the translator service that I had spent days trying to understand was not meant to be the way to call the service. The posted client and instructions I had been looking at were created to provide a method of testing the RESTful interface to the web service.
As part of the new server that went online to host the SOAP services, the developer posted a sample client for the Geographic Translator Service that was a more familiar way to collect input from the user. Each piece of the input was its own textbox or pulldown menu, instead of several cryptic strings of coded letters and numbers separated by an exclamation point. I had wondered why the data would be input that way only to then have to be parsed apart in order to set up the individual parameter fields in the web service call. Being able to see this version of a web client in action really helped clarify what was going on with the service.
But changing that horse in midstream led to a new difficulty. When a user selects which one of the 36 coordinate systems that will be used as the input system for the transformation, that changes the number and type of parameters that must be entered to represent the coordinate. The HTML page needs to change dynamically to present the user with the correct entry fields after the coordinate system selection is made.
I thought that I had come up with a solution by making use of div tags and some Javascript that would display or not display the appropriate div after the user selected the coordinate system from a pulldown. To get a feel for how it would work I started small by limiting the possible coordinate systems to just 5 of the 36. It took awhile to get the divs set up the way that looked best and, even then, I was stumped on how to get any of them, except the first, to change style when displayed to align the input parameters to the right.
Getting the alignment to look nice turned out to be the least of my problems. It was when I decided they looked good enough and went to the next step of actually submitting the data that I could see it wouldn't work. I had wanted to use the same names for the input fields in each of the divs and only have one form. But after several fruitless attempts to try to get the right data to be passed in to the right fields after the coordinate system was changed I decided that it could not be done that way. After the submission of the form it appears that the server does not make a distinction between parameters that are named the same thing but are in different divs within the same form.
The only way I could think to do it next, was to start all over with a redesign where I would have a separate JSP page for each of the different coordinate systems. It was tedious work starting over and copying and pasting to make the set of JSP pages. And not the best solution because I could see there was a lot of duplicate code. But at least I was getting the right data in when I ran through the first test. It was when I selected the pulldown to choose a different coordinate system that I realized the fallacy of my thinking. I had a JSP page ready and waiting to display for that next coordinate system but what was going to trigger the display of that page? A Javascript function that was called by an onClick in the select tag had enabled the display of the div in the method I had used before. But now without the Javascript there was nothing to dynamically change the HTML and nothing to rerender the portlet so that the doView would get called to display the proper JSP page.
What to try next? I wonder if I could make use of what's there and just figure out a way to fit in a renderURL call because that would call the doView method. Would I put a link somewhere for the user to click, sort of like when I had the "Back" functionality in one of the portlets? Or should I start over and make a beginning page where the user first selects the coordinate system as a link that loads the correct JSP page?
While looking for some more ideas on the Internet I stumbled on an example that has dynamic HTML to hide and show a div like what I had earlier. I wish I had seen this example instead of the one I followed. This one has a form within each of the divs. I bet mine would have worked if I had done it that way instead of trying to just have a single form and use the divs to separate out the parameter fields. Usually when I try something and it doesn't work I make a copy of it, just in case. But, wouldn't you know, this time I did not save any of what I had when I was trying to use the Javascript with the div tags. Enough for one day. Maybe my thoughts will fall into place and give me the proper solution the next time that I look at it.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment