You must have faced quite a good amount of code generation issues if you are working on MDM Server v8 or v8.5. One of the main problems that I have faced was whenever we do not have a hold on the OOTB code generation technique. Say if you need to have OOTB TCRMOrgnaizationSearch/TCRMContractSearch as one of the input for the custom business proxy. MDMServer v8.5 does not expose the objects that are not persisted . Even if you provide the MDM entity details in the reference.mdmxmi in the parent project, it result us with error:-
Errors logged during code generation
Errors occurred during execution
Error executing tag handler: java.lang.NullPointerException
Another problem which we face is, MDM does not support the Transient Object code generation in v8 or 8.5 Hence we have land up with no other option other than to create an Entity, its corresponding classes and will not be persisted. It would be used as a wrapper object. Therefore, your project may have unnecessary files which you may not use in MDM framework.
By this approach it helps the developer to have a strong hold on how your service description should be by writing your own WSDL and generating the java code based on the definition in the WSDL. Definitely, this approach would be challenging as it will not be as simple as clicking the Generate Code in the MDM Model Editor
RAD : 126.96.36.199
MDM : MDM Server v 8.5
WAS : v6.1
Creating Top-Down Web Service
Web services can be created using two methods: top-down development and bottom-up development. Top-down Web services development involves creating a Web service from a WSDL file.
When creating a Web service using a top-down approach, first you design the implementation of the Web service by creating a WSDL file. You can do this using the WSDL Editor. You can then use the Web services wizard to create the Web service and skeleton Java™ classes to which you can add the required code.
Although bottom-up Web service development may be faster and easier, the top-down approach is the recommended way of creating a Web service. By creating the WSDL file first you will ultimately have more control over the Web service, and can eliminate interoperability issues that may arise when creating a Web service using the bottom-up method.
The tools that help to generate the web service artifacts are WSDL2JAVA.bat and JAVA2WSDL.bat.
WSDL2JAVA generates the web service skeletons and the deployment descriptor templates against a WSDL. This is used for the top down approach
JAVA2WSDL generates WSDL from the Java class. This is used for bottom up approach.
This document helps you to create a top to down EJB implementation of Web Service for MDM services. It is quite simple to develop a web service with the help of Web Service editor that is available with the RAD.
By the end of this document, you will be able to create an ejb web service implementation from WSDL to invoke MDM services.
Note: We need to have manual effort to bring up the web service project structure in sync with the classes and the class names that gets generated with the help of MDM model editor.
RAD Preference Settings
Prior to developing the Web Service, you need to set certain Preferences in RAD.
1. Windows > Preferences > Web Services > Resource Management
Check 'Create folders when necessary' and 'Merge generated skeletonfile'
Note: It is a good practice to select this option when you use utility JAR files or third party libraries, in order to avoid these loadable Java Classes that have to be regenerated.
Below are the steps which explain how to create a top down EJB web service implementation:-
1. Create an EJB Project. File > Other > EJB Project > *WSEJB
Next > Import > Browse the mapping.properties file in ProjectWS/build/mapping.properties
Click Next > Generates the Web Service skeleton from the WSDL and publishes the project to the server
Note:- Start the server before generating the web service
You can observe that the class names of the classes that generated are not in sync with the OOTB naming convention
Next task is to change the class names of the EJB classes and service implementation class that generated by the WSDL2Java such as it would be in sync with the OOTB code generation.
Modify the below files:-
i. Move the SearchBindingImpl to ProjectWSEJB/ejbModule/com/test/search/service
ii. Rename the below files:-
SearchBindingImpl -> SearchServiceBean
SearchService_PortType_RI -> SearchServiceRemote
SearchService_PortTypeHome -> SearchServiceRemoteHome
SearchService_PortType -> SearchServiceSEI
iii. ejb-jar.xml ->
a) Modify the mapping of
ejb-name,home,remote,service-endpoint,ejb-class to the renamed class
b) Add DWLServiceController EJB bean in the reference
Open ejb-jar.xml > References Tab > Add > EJB reference > Next > Select DWLCommonServices reference
iv. webservices.xml -> Modify the mapping of service-endpoint-interface, ejb-link class
vi. Add DWLCommonServicesWS and DWLCommonServices projects in Classpath of WSEJB project
protected HashMap instantiateWccTransactionContext(com.ibm.wcc.service.intf.Control control, String serviceName)