Information Management IBM InfoSphere Master Data Management, Version 11.3

Sample Code

The following samples of code show how a transaction message is passed to the DWLServiceController in the Request and Response Framework.

Get EJB Home Address

  try{
    Vector vec = (Vector)(TCRMClientEJBHomeHelper.getEjbHome("com/dwl/base/
requestHandler/beans/DWLServiceController"+instanceName,serverName));
    Object object = vec.elementAt(0);
    theDWLServiceControllerHome = (DWLServiceControllerHome)
javax.rmi.PortableRemoteObject.narrow(object, DWLServiceControllerHome.class);
    ut = (UserTransaction)vec.elementAt(1);
  }
  catch (Exception ex){
    TCRMTraceLog.logMessage(ex.toString());
  }

Send Request

try{
  //Create String from the charArray
  String strXmlRequest = new String(charArray);
  //create Session bean's remote interface
  DWLServiceController aDWLServiceController = theDWLServiceControllerHome.create();
  System.out.println("ut.begin()");         
  ut.begin();
  Serializable responseObject = null;
  //call session bean's correspondent method
  
    HashMap context = new HashMap();
    context.put("TargetApplication","tcrm");
    context.put("RequestType", "standard");
    context.put("ResponseType", "standard");
    context.put("Parser", "TCRMService");
    context.put("Constructor", "TCRMService");
    context.put("OperationType", "All");
  try{
  System.out.println("before call the DWLServiceController ");
  responseObject = aDWLServiceController.processRequest( context, strXmlRequest);
  }
  ut.commit();
  }
catch(Exception ex){
  throw new Exception(ex.toString());
  }

If using the default parser and constructor provided in the InfoSphere® MDMRequest and Response Framework, the calling program must assemble the actual transaction as a <TCRMService> XML message string (strXmlRequest in the example). The format and contents of that message are discussed in the following topics.



Last updated: 1 Sep 2016