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.
Whenever I start development on a LiveCycle project, which usually involves LC Forms, LC Reader Extensions, LC Output, and LC PDF Generator. I utilize Acrobat for most of my prototyping and debugging. I’ll list the frequently used techniques:
- LC Reader Extensions – For those beginning to build forms with LC Designer know their form will be Reader Extended before going into production. I’ve seen cases where they will modify a form, manually Reader Extend, and then test their change. To save time, get a copy of Acrobat installed on your machine and use that to test changes. The other way is just too
- LC Forms – Most likely you will be exporting data from a PDF or importing data into a PDF. You need to test a form or a generated XML that binds to a form. A quick way is to open the pdf in Acrobat then to –
- Export Data from a form: Acrobat menu -> Forms -> Manage Form Data -> Export Data
- Import Data into a form: Acrobat menu -> Forms -> Manage Form Data -> Import Data
- LC PDF Generator – You run into a problem where LC PDF Generator gives you an error while converting a non-PDF file. Open the non-PDF file in its native application and print as a PDF. The most common error is permission not to export data or print.
- LC Output – Here I prefer to use a unit test case, in most cases flattening a PDF will work file in Acrobat but making an API call reveals more details.
Hope this helps.
I like the traditional "Hello World" examples, that’s what I look for when ever I start coding in a new language, framework or library; so I’ll give the reader a "Hello World" example.
So open up your favorite text editor and the following self-explanatory code to HelloWorld.js
//Say Hello World
cName: "helloWorldBtn", // A name for your button
cExec: "helloWorld()", //Function to Call
cLabel: "Hello World", //The Text on the Button
cTooltext: "Say Hello World" //The Help Text
Drop the HelloWorld.js to:
Restart Acrobat and open-up any PDF and you should see the following button added to the tool-bar.
Clicking on the button you should see your Hello World alert.