Select your user interface:
Code Table Example: AppFxWebService (Java)
The entire code sample can be found here: CodeTableExampleJavaAppFxWebService.zip
Note: This ZIP does not include the generated classes necessary to run the main project. You must generate those classes. But there is a modified WSDL, and the client architecture is established. Also, authentication code is not included in this sample project. For more information, see Create a Client with JAX-WS and Authentication and Authorization.
Step 1 - Create a Java application project with a JAX-WS client for AppFxWebService.
This is described in Create a Client with JAX-WS.
Step 2 - Add a JFrame to the application.
For example, in NetBeans, right-click the project and click New > JFrame. You may have to navigate through New > Other. Then enter a name, select the package, and click Finish.
Step 3 - Add a jLabel and jComboBox to the JFrame.
Rename the jLabel and jComboBox appropriately.
jLabelAddressType
jComboBoxAddressType
Add text to the label. In this case, the combo box will support selecting an Address Type.
Step 4 - Instantiate the JFrame from the main method.
public static void main(String[] args) { CodeTableExampleJFrame mainScreen = new CodeTableExampleJFrame(); mainScreen.setVisible(true); mainScreen.setEnabled(true); }
Step 5 - Find the endpoint operation to get the list of entries in the Address Type code table.
Use the Endpoint Reference to find the endpoint operation that gets a list of entries for a given code table.
AppFxWebService
CodeTableEntryGetList
Step 6 - Find the feature identifier to supply to the endpoint operation.
Note: For a discussion about feature metadata, see Feature Metadata.
-
Browse to Administration > Application > Features.
-
Click Code table search.
-
Search for the Address Type code table.
-
Select the result. The page that describes the code table appears.
- Copy the Database table name: ADDRESSTYPECODE.
Step 7 - Create the request and reply.
-
In the JFrame class variable declarations, add a request and reply to get the list of entries in the code table. The request and reply objects reflect the name of the endpoint operation: CodeTableEntryGetListRequest and CodeTableEntryGetListReply. In this example, the generated classes are referenced through import. Also, the generated classes have not been copied as in other examples.
package codetableexamplejavaappfxwebservice; import _1.api.webservice.appfx.blackbaud.AppFxWebService; import _1.api.webservice.appfx.blackbaud.ClientAppInfoHeader; import _1.api.webservice.appfx.blackbaud.CodeTableEntryGetListReply; import _1.api.webservice.appfx.blackbaud.CodeTableEntryGetListRequest; public class CodeTableExampleJFrame extends javax.swing.JFrame { AppFxWebService _appFxWebService = new AppFxWebService(); ClientAppInfoHeader _clientAppInfoHeader = new ClientAppInfoHeader(); CodeTableEntryGetListRequest req = new CodeTableEntryGetListRequest(); CodeTableEntryGetListReply reply = new CodeTableEntryGetListReply();
-
To CodeTableName for the request, assign ADDRESSTYPECODE, which is the database table name you retrieved from the shell.
public CodeTableExampleJFrame() { initComponents(); _clientAppInfoHeader.setREDatabaseToUse("BBInfinity"); req.setCodeTableName("ADDRESSTYPECODE"); req.setClientAppInfo(_clientAppInfoHeader); reply = _appFxWebService.getAppFxWebServiceSoap12().codeTableEntryGetList(req); jComboBoxAddressType.removeAllItems(); for (int i = 0; i < reply.getRows().getR().size(); i++){ jComboBoxAddressType.addItem(reply.getRows().getR().get(i).getCode()); }
Note: You can also specify other options. See the following snippet from the Endpoint Reference.
<soap12:Body> <CodeTableEntryGetListRequest xmlns="Blackbaud.AppFx.WebService.API.1"> <CodeTableName>string</CodeTableName> <IncludeInactive>boolean</IncludeInactive> <RefreshCache>boolean</RefreshCache> <ReturnListSortMethod>boolean</ReturnListSortMethod> <UseCodeTableEntrySecurity>boolean</UseCodeTableEntrySecurity> </CodeTableEntryGetListRequest> </soap12:Body> </soap12:Envelope>
-
Add ClientAppInfo to the request. The Infinity application requires information such as which database to use.
public CodeTableExampleJFrame() { initComponents(); _clientAppInfoHeader.setREDatabaseToUse("BBInfinity"); req.setCodeTableName("ADDRESSTYPECODE"); req.setClientAppInfo(_clientAppInfoHeader); reply = _appFxWebService.getAppFxWebServiceSoap12().codeTableEntryGetList(req); jComboBoxAddressType.removeAllItems(); for (int i = 0; i < reply.getRows().getR().size(); i++){ jComboBoxAddressType.addItem(reply.getRows().getR().get(i).getCode()); }
-
Invoke the request.
public CodeTableExampleJFrame() { initComponents(); _clientAppInfoHeader.setREDatabaseToUse("BBInfinity"); req.setCodeTableName("ADDRESSTYPECODE"); req.setClientAppInfo(_clientAppInfoHeader); reply = _appFxWebService.getAppFxWebServiceSoap12().codeTableEntryGetList(req); jComboBoxAddressType.removeAllItems(); for (int i = 0; i < reply.getRows().getR().size(); i++){ jComboBoxAddressType.addItem(reply.getRows().getR().get(i).getCode()); }
Step 8 - Populate the combo box with the list from the reply.
public CodeTableExampleJFrame() {
initComponents();
_clientAppInfoHeader.setREDatabaseToUse("BBInfinity");
req.setCodeTableName("ADDRESSTYPECODE");
req.setClientAppInfo(_clientAppInfoHeader);
reply =
_appFxWebService.getAppFxWebServiceSoap12().codeTableEntryGetList(req);
jComboBoxAddressType.removeAllItems();
for (int i = 0; i < reply.getRows().getR().size(); i++){
jComboBoxAddressType.addItem(reply.getRows().getR().get(i).getCode());
}