Archive for June, 2010

LC Designer: Single Web Service with Many Services

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.

       messageObject:  {

              //Message specific stuff here



I like JSON since its natively represented in JavaScript and I can represent what ever I want. Since most of the web service calls from LC Designer are stateless, I don’t worry about the overhead of using a stateful mechanism which adds bloat. 

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.
  • Unit testing is easier because you can test your JavaScript on the form against a fixed JSON test object.
  • 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.


LiveCycle Development Techniques

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:

  1. 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
  2. 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
  3. 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.
  4. 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.

Acrobat JavaScript Extensions – Hello World

When we think "adding a button to the Acrobat Toolbar or Menu Item" we think: C++ Plugin; There is a far easier and less known alternative via JavaScript. That’s what I’d like to write about today. I’ve finished a project using JavaScript extensions for Acrobat, the customer is very happy because he can and did modify the extension himself. The one caveat is that not all the C++ functions are available in JavaScript but nonetheless still powerful.

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.

Check the JavaScript for Acrobat Documentation for the exact use of each library call.

So open up your favorite text editor and the following self-explanatory code to HelloWorld.js

function helloWorld()
     //Say Hello World
     app.alert("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:

  • Mac – /Users/<user id>/Library/Application Support/Adobe/Acrobat/9.0_x86/ JavaScripts
  • Vista – C:\Users\<user id>\AppData\Roaming\Adobe\Acrobat\9.0\JavaScripts

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.