Recently, I was developing a LiveCycle ES component that uses Java APIs that are new to me. As I was thinking about how to implement the functionality that these new APIs offered into a LiveCycle ES component, a development pattern occurred to me. This pattern can be used by any LiveCycle ES component developer.
Because a LiveCycle ES component runs as a service, there isn’t an easy way to debug the application logic. That is, how can I set a breakpoint in the Java code and step through it? How can I ensure that these APIs are doing what they are supposed to do?
The answer is to use Java APIs inside a test Java console application. Then, you can set a breakpoint and step through your Java application logic to ensure the application logic works properly. Once you are satisfied the application works, copy the application logic from your test Java project to your Java project that creates a custom component.
This worked for me. The new Java APIs I was using were proxy Java APIs that consume a web service that returns real-time weather information. That is right – I wanted to embed a custom service into LiveCycle ES that returns real-time weather information so I can embed weather information into a PDF document. And using this pattern, I was able to ensure that the Java APIs worked before I used them inside a LiveCycle ES component.
Note: If you are interested in knowing how to create a custom LiveCycle ES component that invokes an external web service, then keep an eye out for a future development article titled Invoking Web Services using Custom Components to appear on the LiveCycle ES developer center. As a component developer, this is an article you won’t want to miss.