Hello,
For training purposes, I've been working on a custom SetValue SBO adaptor to retrieve a value from a repository and place it in a field on a form. In order to do this I've created and compiled two classes both in a package: com.company.adaptor
1. public interface ISetValueDataSourceAdaptor extends IDfBusinessObject {}
2. public class SetValueDataSourceAdaptor extends DfService implements ISetValueAdaptor, ISetValueDataSourceAdaptor { /*implementation*/ }
The documentation said I had to implement ISetValueAdaptor for a SetValue adaptor, and extend DfService for an SBO.
From this I've created two JARs, an interface JAR with class 1, and an implementation JAR with class 2.
In a DocApp I've created a module with name: com.company.adaptor.ISetValueDataSourceAdaptor (as recommended by the dev guide) and included the two JARs as well as XFormsEngine.jar (for the ISetValueAdaptor class). This succeeded.
In Forms Builder I've created a new Data Source adaptor with classname com.company.adaptor.ISetValueDataSourceAdaptor, ticked SBO, and set up the rest of the input and outputs. The Form itself gets a textfield and a listbox which both use the new adaptor in Data & Storage -> External Data Source. Installation and validation succeeds.
Now when I test my form in Webtop, I get the following error:
Failed to construct adaptor MySetValueAdaptor at xpath "/MyForm/ListBox1": java.lang.ClassCastException: com.company.adaptor.SetValueDataSourceAdaptor
I am restricted to Forms Builder 6.0SP1.
I have two questions:
- What am I doing wrong?
- Does anybody have example code for SetValue adaptors as SBOs?
Extra: I have tested the SBO in a test script in java. And I can reproduce the error.
ISetValueDataSourceAdaptor value = (ISetValueDataSourceAdaptor)client.newService("com.company.adaptor.ISetValueDataSourceAdaptor", sessionManager); //works, returns server instance: com.company.adaptor.SetValueDataSourceAdaptor@ce0bb
SetValueDataSourceAdaptor value = (SetValueDataSourceAdaptor)client.newService("com.company.adaptor.ISetValueDataSourceAdaptor", sessionManager); //fails