The entire code sample can be found here: CodeTableExampleJavaBizOps.zip
This ZIP does not include the generated classes necessary to run the main project. Those classes must be generated. 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 - Find the feature identifier for the endpoint operation.
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 2 - Create a Java application project with a JAX-WS client for ADDRESSTYPECODE CodeTableService.
This is described in Create a Client with JAX-WS.
You may have to create a binding with JAXB before you use JAX-WS. The URI syntax for the WSDL location of BizOps services can trip the wsimport utility. If you create a JAXB binding and reference the WSDL added to the project during through the binding, you can avoid the URI syntax issue.
An example endpoint URL for ADDRESSTYPECODE CodeTableService is:
http://localhost/bbAppFx/vpp/bizops/db[BBINFINITY]/codetables/ADDRESSTYPECODE/soap.asmx
Step 3 - 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 4 - Add a jLabel and jComboBox to the JFrame.
Rename the jLabel and jComboBox appropriately.
jLabelAddressType
jComboBoxAddressType
Step 5 - Instantiate the JFrame from the main method.
public static void main(String[] args) { CodeTableExampleJFrame mainScreen = new CodeTableExampleJFrame(); mainScreen.setVisible(true); mainScreen.setEnabled(true); }
Step 6 - 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.
CodeTableService for ADDRESSTYPECODE
GetTableEntryList
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: GetTableEntryListRequest and GetTableEntryListReply. The generated classes have not been copied as in other examples.
package codetableexamplejavabizops;
public class CodeTableExampleJFrame extends javax.swing.JFrame {
CodeTableService _codeTableService = new CodeTableService();
GetTableEntryListRequest req = new GetTableEntryListRequest();
GetTableEntryListReply reply = new GetTableEntryListReply();
You can include additional information in the request. See the following snippet from the Endpoint Reference:
<soap12:Body>
<GetTableEntryListRequest xmlns="blackbaud_appfx_server_bizops">
<IncludeInactive>boolean</IncludeInactive>
<RefreshCache>boolean</RefreshCache>
</GetTableEntryListRequest>
</soap12:Body>
</soap12:Envelope>
Invoke the request.
public CodeTableExampleJFrame() {
initComponents();
reply =
_codeTableService.getCodeTableServiceSoap12().getTableEntryList(req);
jComboBoxAddressType.removeAllItems();
for (int i = 0; i < reply.rows.tableEntryListRow.size(); i++){
jComboBoxAddressType.addItem
(reply.rows.tableEntryListRow.get(i).description);
}
Step 8 - Populate the combo box with the list from the reply.
public CodeTableExampleJFrame() {
initComponents();
reply =
_codeTableService.getCodeTableServiceSoap12().getTableEntryList(req);
jComboBoxAddressType.removeAllItems();
for (int i = 0; i < reply.rows.tableEntryListRow.size(); i++){
jComboBoxAddressType.addItem
(reply.rows.tableEntryListRow.get(i).description);
}