Documente Academic
Documente Profesional
Documente Cultură
Page 1 of 35
Contents
Trademarks ...........................................................................................................................3
Introduction...........................................................................................................................3
Prerequisites......................................................................................................................3
Additional References.......................................................................................................4
Setting up the Development Environment............................................................................4
Preparing to run the Setup Wizard....................................................................................4
Running the Setup Wizard ................................................................................................4
WebSphere Configuration ................................................................................................7
MDM Configuration and Deployment..............................................................................8
Database Information........................................................................................................9
Resolving problems that occur during setup and configuration .....................................10
Setup Wizard Task Descriptions.........................................................................................10
Importing the MDM Resources ......................................................................................10
Modify the Web Service Configuration..........................................................................11
Configuring the WebSphere Application Server ............................................................11
Creating the database ......................................................................................................12
Deploying the MDM EAR..............................................................................................13
Deploying the MDM Configuration ...............................................................................13
Verifying the Install ........................................................................................................13
Restoring the setup tool ..................................................................................................14
Creating a new Hub Module ...............................................................................................14
Creating an Addition.......................................................................................................16
Code Generation .............................................................................................................19
Merging CustomerResources..........................................................................................20
Configuring the domain ..................................................................................................21
Adding an Entity Extension ................................................................................................21
Sharing the code..................................................................................................................25
Sharing the workspace ....................................................................................................25
Sharing the model ...........................................................................................................27
Testing the Extensions ........................................................................................................27
Testing the addition using Web Services........................................................................28
Testing the addition using the service controller bean....................................................30
Appendix A: Web Services Test sample code....................................................................31
Appendix B: Service controller sample code......................................................................33
Page 2 of 35
Trademarks
IBM, DB2, InfoSphere, Rational and WebSphere are trademarks of International
Business Machines Corporation in the United States, other countries, or both.
EJB, Java, Java Naming and Directory Interface, JDBC, J2EE, and all Java-based
trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries,
or both.
Other company, product, or service names may be trademarks or service marks of others.
Introduction
The IBM InfoSphere Master Data Management (MDM) Server 9 provides a solution for
managing enterprise data.
The framework provides a comprehensive data model and associated business services
that can be extended to create a customized solution tailored to your business.
This article provides guidance on how these extensions are developed using the MDM
Workbench supplied with the MDM Server product. The following topics are discussed
with the use of examples to help you get started:
The majority of this whitepaper is also applicable to the IBM InfoSphere Master
Information Hub (MIH). The MIH workbench provides similar capabilities to the MDM
Workbench, allowing the user to add new entities to the application.
Prerequisites
MDM Server version 9 can be deployed onto either WebSphere Application Server 6.1 or
7.0.0.5. Throughout this article version 7.0.0.5 will be used. The versions and fixpack
Copyright International Business Machines Corporation 2009, 2010
Page 3 of 35
levels of the pre-requisite software are important and are documented in the MDM
Workbench infoCenter.
Additional References
To complement the information provided in this document, additional information can be
found from the following sources:
The MDM Workbench developerWorks homepage
http://www.ibm.com/developerworks/spaces/mdmworkbench
MDM Workbench developerWorks forum
http://jtlog.wordpress.com/2009/02/11/mdm-workbench-developerworks-forum
Page 4 of 35
Click File > New > Other. The New wizard opens.
On the Select a wizard page select InfoSphere Master Information Hub >
Development and Test Environment.
Click Next.
You will then see a dialog detailing all the tasks that can be run.
Figure1.PNG
Each setup task is explained in more detail later in this document.
If the wizard has been run previously, the Restore the Development Environment Setup
Tool task should be run on its own prior to running any other task. This ensures that no
Page 5 of 35
residual information from a previous run has been left within the tool configuration, and
clears the saved information from the following pages of the wizard.
While it is possible to run all of the setup tasks in one step, it is recommended to run the
first 5 tasks, up to Create an Application Database. Then verify that your workspace
security settings match those of the application server (see this section). Once this is
complete then re-launch the setup wizard and invert the selection to choose the remaining
8 tasks.
It is important to note that running the wizard turns off the workspace Build
Automatically option. If you wish to re-enable automatic builds then select Build
Automatically from the Project menu.
When working through the wizard the following additional dialogs will be displayed to
input the required information. Some of the tasks do not require all of this information so
some dialogs may be omitted.
Page 6 of 35
WebSphere Configuration
Figure 2: WebSphere Configuration
Figure2.PNG
For the WebSphere Configuration:
1. Choose the WebSphere version. For this article we are using version 7.0. Selecting
the WebSphere version will automatically configure the WebSphere home.
2. Select the required profile from the Profile Name drop-down box. If you have
not yet created a WebSphere Application Server profile, use the Create Profile
button to launch the Profile Management Tool. Selecting a profile will fill in the
correct values for the bootstrap port, node name, and cell name.
3. In Backup profile at specify the directory where the profile backup will be
placed.
4. In Application distribution file specify the location of the MDM Distribution
file.
5. In Unpack distribution to specify where the distribution will be unpacked.
Copyright International Business Machines Corporation 2009, 2010
Page 7 of 35
Figure3.PNG
For the Application Configuration and Deployment:
1. Click the Detect host name button to add in your machines host name, or type
localhost.
2. The Deployment name is defaulted to MDMServer.
3. In the Temporary output folder specify the folder or pathname where the MDM
EAR from your workspace will be exported to.
Page 8 of 35
Database Information
Figure 4: Database Information
Figure4.PNG
For the database information panel:
1. Check that the Database home is set to the correct location. This should be
$DB2_INSTALL_LOC/java
2. Specify the username and password for the user that will create the database
3. Specify the name of the database.
Before you can continue from the database information panel you must click the Test
Connection button. This will validate the database settings and once the settings have
been successfully checked, the Next and Finish buttons will be enabled.
Once all the required information has been specified, clicking the Finish button will
execute the selected setup tasks.
Copyright International Business Machines Corporation 2009, 2010
Page 9 of 35
Task Details:
These tasks are responsible for setting up the workspace within RSA/RAD.
The task Import Application Projects into Workspace performs several actions:
1.
2.
3.
4.
Extracts the MDM application and resources into the specified unpack location.
Imports the MDM EAR and the EAR manifest file into the workspace.
Updates the classpath settings for the MDM projects.
Imports the database scripts (from the MDM/database folder within the unpacked
location) into a project called MDMDatabase.
5. Creates a CustomerResources project and unzips the properties.jar and
DWLSchemas.jar into this project.
6. Imports the ManagementAgent and ManagementConsole (from the MDM folder
within the unpacked location) into the workspace.
Page 10 of 35
ibm-webservices-bnd.xmi
ibm-webservices-ext.xmi
Within the same folder there are example files with the suffix
SecurityEnabled/SecurityDisabled. You will need to copy the contents of the files that
match your WAS security setting into the above two files.
Task Details:
There are two tasks associated with configuring the application server:
The Backup WebSphere Profile task will backup the profile to the directory specified in
the wizard.
The Configure WebSphere Profile task creates all the required application server
resources, including Message Queues and JDBC Connections. It also sets the server
classpath to include resources held in the CustomerResources project. This enables
developers to configure the MDM Server directly within the CustomerResources folder
without having to repackage the configuration into the appropriate jars held in the EAR.
The classpath setting can be checked using the WAS admin console.
1. Select your server from Servers / Application Servers.
2. From Server Infrastructure, expand Java and Process Management.
3. Choose Process Definition, and from Additional Properties select Java Virtual
Machine.
4. From General Properties confirm the classpath settings that point to the resources.
Page 11 of 35
Figure5.PNG
To validate that the task has completed successfully, use the WAS Admin console and
check that the jdbc/DWLConfig Data source has been created. This task must complete
successfully or deploying the MDM EAR to WAS will fail.
Task Details:
The Create an Application Database task will create the required DB2 database. The
database created using the task will have full Compound Triggers with Delete (more about
this on creating the new MDM Module). It will also have data set to the insurance
industry. This may not match the choices you make when installing MDM Server, but is
adequate for a development and test environment.
To use Oracle as your database, you should refer to the Tech note Setting up the MDM
Server development environment with WebSphere Application Server and an Oracle
database from the IBM support website.
Page 12 of 35
To check that the application server can connect to the database, use the WAS admin
console to test the connection (via Resources/JDBC/Data sources).
Clean workspace
Prepare for deployment
Build workspace
Export Application EAR
Deploy Application to WebSphere Profile
Task Details:
These tasks build an EAR file for the application, and then deploy the EAR onto
WebSphere Application Server. An alternative to running these tasks is to manually run
Project > Clean from the build menu and then hot-deploy the EAR to the WAS server. To
hot-deploy the EAR ensure that your server is show in the Servers view, and then right
click the server and use Add and Remove Projects to add the MDM EAR project.
If you have run the wizard, but would prefer to use the hot-deploy functionality, you must
remember to remove the deployed application from the server (using the WAS admin
console) before hot-deploying the MDM EAR project.
Deploy Configuration
Task Details:
The task Deploy Configuration runs the management agent and console to deploy the
configuration held in the exported EAR. This means that even if you have hot-deployed
the MDM application, you will have to run the Export Application EAR for this task to
successfully complete.
To check that the task completed successfully, view the APPSOFTWARE and
CONFIGELEMENT tables within the database.
Page 13 of 35
Task Details:
These tasks import and run the Install VerificationTest. To determine whether the tests
have successfully completed, you will need to examine the response files found in
InstallVerification/xml/response. Each response file should have SUCCESS as the
Result Code. You will need to refresh the Install Verification project before the response
files are visible in the workspace.
Task Details:
As previously mentioned, this task cleans up the configuration within the tool, as well as
the saved responses to the pages within the wizard. This task should be run before setting
up each new development environment.
Page 14 of 35
Figure6.PNG
The following fields are required:
Project name the name of the new hub module project
Base Java package name Java classes generated for this hub module project will
be defined in sub-packages within the specified package name
Service namespace URI The URI that will be used to invoke the Web services
EAR project name Select the MDM EAR project
The first time that a Hub Module Project is created the application level configuration
must also be supplied:
Hub base name the name of the new application
Database schema name the name of the database schema
Within the new Module Project the following files are created: the module.mdmxmi
model file, mdmgen.xml (an ANT build script used to generate the code) and
mdmgen.properties that defines additional properties that can be specified for the ANT
script.
Copyright International Business Machines Corporation 2009, 2010
Page 15 of 35
Figure7.PNG
The application module contains the hub base name, as well as the schema name,
databases and history triggers to be generated. It is important to match the schema name
and triggers to those that will be used for the real application.
Creating an Addition
Data Additions and Data Extensions can be added to the model in one of two ways:
For example, the Reminder addition, which will be used to add reminder notes for users, is
required to have the following attributes:
Page 16 of 35
Type
Long
priorityTpCd
Type Code
remindPartyId
Reference
remindRecordedBy
String
remindDtm
TimeStamp
remindDesc
String
recordedDtm
TimeStamp
Description
The primary key of the new
table / addition. (In the
model editor, check that the
primary key option is
selected.)
A type code reference to the
PriorityType code table
(located in the
DWLBusinessServices
module, underneath the
Task folder).
Reference to the Party entity
(located in the Party
module). This is the
association between the
Reminder and the Party that
should be reminded.
The name of the user that
recorded the reminder.
The date on which the
reminder is to happen.
The description of the
reminder.
The date on which the
reminder was recorded.
In this example, the Hub Module editor is used to create the Reminder addition.
1. Open the ExampleModule/module.mdmxmi file (it automatically opens in the Hub
Module editor).
2. Select the Model tab.
3. Within the Contents tree on the left hand pane, right click on the ExampleModule
folder and choose New > Entity.
4. In the right hand pane, enter Reminder as the entity name.
The Hub Module editor will display the new entity, along with additional standard
content, including a primary key attribute, an error reason, and add, update and get record
transactions.
Page 17 of 35
Figure8.PNG
Next, use the model editor to create the remaining content underneath the Reminder entity.
For each, right click the entity and choose New > Attribute (or Reference, or Type Code),
and then configure the name and type.
By default any new addition (Entity) will have add, update and get record transactions
created. The add and update transactions are mandatory and cannot be deleted, however
the user can specify as many Get Record transactions as they require. The Get Record
transaction provides a parameter list which can be modified to include any of the attributes
available to the entity. For this example the default getReminder transaction is replaced
with two new Get Record transactions. Again, use the Hub Module model editor to make
the changes.
Modify the getRecord transaction to get the reminder associated with a specific
ReminderpkId primary key:
1. Select the getReminder transaction and rename the record to
getReminderByReminderId.
2. Verify that the Query Parameters list only contains ReminderpkId and the option
Multiple Records Returned remains unchecked.
Add a transaction to get all reminders associated with a specific person
Page 18 of 35
Figure9.PNG
Code Generation
When the model is complete you can use the 'Generate Code' action to create the addition.
This process will create several new projects in the workspace:
Page 19 of 35
The ANT script that runs the codegen will also incorporate these projects into the
application EAR and ensure that classpaths are modified so that all projects compile
cleanly.
Unless the Web services need to be customized (which is unlikely), all modifications to
the code are performed in the ExampleModule. The Reminder Business Object (BObj) can
be found in the component sub-package whilst the data access classes can be found in
the entityObject sub-package.
By selecting the ExampleModule project and opening the Tasks view, all the
MDM_TODO markers can be viewed. These markers show where customizations can be
performed e.g. customized validation logic; as well as tasks that have to be performed in
order to complete the implementation.
Merging CustomerResources
Additional files are created in the resources folder within the hub module project. There
are two different types of generated resources: database scripts, and snippets for inclusion
into the CustomerResources project.
The database scripts are generated for each of the database systems that are selected in the
application.mdmxmi file. Review each file for MDM_TODO statements. For the
Reminder example, provided that the application.mdmxmi specifies the correct database
schema name, the files should be complete. Each script includes a comment that explains
which order the scripts should be run in, and how to run them using the DB2 tools.
Another method is to use RSAs built-in Data Connectivity tools to run the specified SQL.
To do this open the SQL files in the default SQL editor, and then right click and select
Run SQL.
The snippets within the resources folder need to be merged into the Customer Resources
project. In each case, the filename tells you which file within the Customer Resources
should be updated.
The properties files are easy to merge; you simply copy the contents into the
corresponding file. It is good practice to surround the changes with a comment, so that
other team members will be able to understand which changes have come from which
module.
The XSD files are a little more difficult to merge. In each case you need to copy the
snippet into the correct target file. Once all the snippets are copied, select the request and
response schemas for your hub (ExampleHubRequest.xsd and ExampleHubResponse.xsd
for this example), and use RSA to validate the files. If there are any validation errors then
you must resolve the errors before deploying the modified application.
Page 20 of 35
For this example, you will find that the ReminderLastUpdateDate and
ReminderLastUpdateUser elements defined by the new snippets clash with the existing
definitions of those elements in some of the existing schemas. Simply commenting out
these two definitions within the ExampleHubRequest.xsd and ExampleHubResponse.xsd
should resolve the problems. Re-run the validation to check that all of the problems are
now resolved.
Page 21 of 35
Figure10.PNG
When you have created the new hub module you must remember to modify the Start Id for
the metadata (as found on the Hub Module Overview page). This will ensure that database
metadata does not conflict with that defined in the previous module. In this example we
have set the start id to 1010000, so that the range of ids that will be used does not overlap
with the ExampleModule.
Page 22 of 35
Figure 11: Setting the 'Start Id' for the new hub module
Figure10.PNG
The new entity extension will be called ExtendedPerson and will extend the Person
Business Object. Rather than adding a new table to the database you may choose to extend
the existing table. Using the hub module editor you can create the new entity extension
and then add attributes to it.
In this case, a RiskScore (String) and a RiskRecordedDt (Timestamp) are being added.
When complete, the model should look like the following:
Page 23 of 35
Figure12.PNG
Selecting the ExtendedPerson entity extension in the hub module editor shows two
additional options:
Add fields to base table Use this option if you want the extra fields to be added
directly to the base entities database table rather than creating an additional
database table.
Override base query Use this option to provide generated code to customize
the SQL called by the entity.
Generation of this model will produce just one additional project ExampleExtModuleWS.
The other projects that were created in the addition are not required as no additional
transactions have been defined. If build automatically has been turned off, you must
remember to rebuild the workspace. Additionally, in the database metadata scripts, you
should examine the MDM_TODO markers and complete the SQL statements. For
example:
Page 24 of 35
The workspace is large. Typically a workspace will contain more than 30,000 files
and occupy around 500MB of disk space.
Some SCSs require artifacts to be checked out prior to them being modified. With
that in mind, the table below shows the artifacts that may be modified and need to
be checked out when creating extensions to the MDM Server
Files
META-INF/application.xml
.project
.settings/org.eclipse.wst.common.component
DWLCommonServicesEJB ejbModule/META-INF/ejb-jar.xml
Comment
Updated
when new
modules are
added to the
MDM
application
Updated
Page 25 of 35
ejbModule/META-INF/ibm-ejb-jar-bnd.xmi
X_EJB
X_WS
X_WS
X_WS
X_WS
X_WS_HTTPRouter
X_WSEJB
X_WSEJB
when a new
controller
EJB is added
ejbModule/META-INF/MANIFEST.MF
Updated to
add
dependency
to extension
modules
build/mapping.properties
Used for
build/was_jaxrpc_tdjava.properties
code
build/wsgen.xml
generation,
no need to
save in
source code
repository
.classpath
Updated to
adjust the
classpath for
the module
src/*ext/to Java classes
Generated
classes for
Web services
src/*_Helper, _Deser, _Ser Java classes
Web services
deployment
code that
does not
need to be
saved in the
source code
repository
WebContent/WEB-INF/wsdl/Extensions.xsd Web service
WebContent/WEB-INF/wsdl/*Ext.xsd
schema files
for data
extensions
ejbModule/META-INF/MANIFEST.MF
Updated to
add
dependency
to extension
WS modules
ejbModule/META-INF/*mapping.xml
Web service
type
mapping
files updated
to include
data
extension
Page 26 of 35
X_WSEJB
ejbModule/META-INF/wsdl/Extensions.xsd
ejbModule/META-INF/wsdl/*Ext.xsd
X_WSEJB
mdmgen_backups
type
mappings
Web service
schema files
for data
extensions
Mapping
files are
copied here
by and used
by the code
generator
Note: X signifies the MDM Project that is going to be extended e.g. Party
Page 27 of 35
1. The CustomerResources have been updated with the resources from the module
project
2. The updated application EAR has been deployed to the test server
3. That the database has been updated with the additional SQL scripts
If you are not extending Person, Organization or Contract, it is a good idea to re-run the
Install Verification test. This will validate that the server is operating normally, and help
diagnose any problems with the merged CustomerResources.
There are several ways to connect to the MDM Server, and many ways to structure the
code that makes these calls. Here we describe two simple ways to call the server one
using Web Services and another sending XML messages to the service controller bean.
These tests could be extended to build a comprehensive test suite for the extensions, and
in a development environment, this suite should be executed and extended as each
customization is built.
These testing methods are suitable for building automated test suites. A more interactive
approach, where a graphical user interface is created to view and update the contents of
the MDM Server, is often useful. The User Interface Generator (included in the MDM
Workbench) could be used to rapidly build such tools.
Page 28 of 35
Figure13.PNG
When the wizard completes, Java code will have been generated to enable you to call the
Web service. If you need to call more than one Web service (to call both the Party Web
service as well as the new addition, for example) then generate Web service client code for
each service in turn. The Party WSDL is located at
PartyWS_HTTPRouter/WebContent/WEB-INF/wsdl/PartyService.wsdl. While generating
the second Web service you may need to give RSA permission to overwrite some of the
generated files.
The example in Appendix A uses both the Party and ExampleModule Web services. It
calls into the Party Web service to find the ID of a party, and then creates a reminder for
that ID. If your MDM system does not contain any Party instances then you will need to
create instances before the search will return any results.
As with any Web service, if your services are not located at the URL contained in the
service definition then you will have to adapt the sample code to include the correct
service URL when using the locator class to create the service port object.
Page 29 of 35
Page 30 of 35
Figure14.PNG
com.ibm.xmlns.prod.websphere.wcc.common.intf.schema.Control;
com.ibm.xmlns.prod.websphere.wcc.party.intf.schema.PersonSearchResultsResponse;
com.ibm.xmlns.prod.websphere.wcc.party.schema.PersonSearch;
com.ibm.xmlns.prod.websphere.wcc.party.schema.PersonSearchResult;
Page 31 of 35
import
import
import
import
import
import
import
com.ibm.xmlns.prod.websphere.wcc.party.service.PartyService;
com.ibm.xmlns.prod.websphere.wcc.party.service.PartyService_Service;
com.ibm.mdm.examples.examplemodule.intf.schema.ReminderResponse;
com.ibm.mdm.examples.examplemodule.schema.PriorityType;
com.ibm.mdm.examples.examplemodule.schema.Reminder;
com.ibm.mdm.examples.examplemodule.service.ExampleModuleService;
com.ibm.mdm.examples.examplemodule.service.ExampleModuleService_Service;
Page 32 of 35
control.setRequesterName("cusadmin");
control.setRequesterLanguage(100);
ReminderResponse response =
exampleService.addReminder(control, reminder);
statusValue =
response.getStatus().getProcessingStatus().getValue();
System.out.println("Added reminder with response status: " +
statusValue);
} catch(Exception e) {
System.out.println("Caught exception");
e.printStackTrace(System.out);
}
}
}
java.io.StringReader;
java.text.DateFormat;
java.text.SimpleDateFormat;
java.util.Calendar;
java.util.Date;
java.util.HashMap;
java.util.TimeZone;
java.util.Vector;
import
import
import
import
import
import
javax.naming.InitialContext;
javax.xml.parsers.DocumentBuilder;
javax.xml.parsers.DocumentBuilderFactory;
javax.xml.xpath.XPath;
javax.xml.xpath.XPathConstants;
javax.xml.xpath.XPathFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
import
import
import
import
import
com.dwl.base.error.DWLError;
com.dwl.base.error.DWLStatus;
com.dwl.base.exception.DWLResponseException;
com.dwl.base.requestHandler.beans.DWLServiceController;
com.dwl.base.requestHandler.beans.DWLServiceControllerHome;
Page 33 of 35
Page 34 of 35
"<DWLControl>" +
"<requesterName>cusadmin</requesterName>" +
"<requesterLanguage>100</requesterLanguage>" +
"</DWLControl>" +
"</RequestControl>" +
"<TCRMTx>" +
"<TCRMTxType>addReminder</TCRMTxType>" +
"<TCRMTxObject>ReminderBObj</TCRMTxObject>" +
"<TCRMObject>" +
"<ReminderBObj>" +
"<PriorityTpCdType>2</PriorityTpCdType>" +
"<RemindPartyId>" +
partyId +
"</RemindPartyId>" +
"<RemindRecordedBy>" +
partyName +
"</RemindRecordedBy>" +
"<RemindDtm>" +
reminderString +
"</RemindDtm>" +
"<RemindDesc>Test reminder</RemindDesc>" +
"<RecordedDtm>" + now + "</RecordedDtm>" +
"</ReminderBObj>" +
"</TCRMObject>" +
"</TCRMTx>" +
"</TCRMService>";
System.out.println("Sending xml:\n" + reminderXML);
xmlResponse = (String) mdm.processRequest(context, reminderXML);
System.out.println("Response xml:\n" + xmlResponse);
} catch(Exception e) {
System.out.println("Caught exception");
e.printStackTrace(System.out);
if(e instanceof DWLResponseException) {
DWLResponseException dwl = (DWLResponseException) e;
DWLStatus status = dwl.getStatus();
if(status != null) {
Vector<DWLError> errors = status.getDwlErrorGroup();
for(DWLError error : errors) {
System.out.println(error.getDetail());
System.out.println(error.getErrorMessage());
}
}
}
}
}
}
Page 35 of 35