One side-effect of using Web Services in LC Designer is that you create a lot of data connections; in LC Designer and other IDEs consuming Web Services is not a big deal. For Form Desingers in particular, they seem to be consuming a lot more than the other development groups like: Java, AJAX, etc. And what amounts to is a tens of unique Web Services called within a single form. The problem is keeping up with all the WSDL and server changes. I’ve watched a developer change twenty forms because a single webservice was changed. I’ll show you a simple technique that can solve these problems.
What I do instead of creating many web services is that I create a single web service: invoke(Stirng in, String out)
This web service does nothing else but take a String as input parameter and write a String out as an output parameter. For the format of the String I use JSON. So the web service is more like: invoke(JSON in, JSON out).
Within the JSON in my object has the following:
serviceID, //Says which service to invoke.
//Message specific stuff here
Using a single web service that makes a call for you on the server side has the following advantages:
- Don’t have to stub out a unique service call for every service
- All services are available to you during design time.
- Adding an optional input parameter or adding a additional return parameters doesn’t require regeneration of your stubbed code.
So below is an example of what my LC Worflow process looks like:
In this implementation, there are only two services. One to retreive group information and other for office information. Instead of creating two web services, I just have one. For this project I’ll keep adding services to this process. I’ve had projects where are twenty service calls are represented with a single web service call.