Summary:
Use “com.ibm.wbiserver.map.MapService” interface to invoke Business Object Maps from your Java Classes.
Using the MapService interface is pretty straight forward.
In the code sample below, the input to the operation is an instance of FromBO. We create an instance of ToBO and use the ‘simpleTranformation’ method on the MapService to invoke the ‘FromBO_ToBO_Map’ business object map.
public DataObject mapInputtoOutput(DataObject input1) {
//create an instance of the output data object.
BOFactory boFactory = (BOFactory)ServiceManager.INSTANCE.
locateService("com/ibm/websphere/bo/BOFactory");
DataObject output1 = boFactory.create("http://SampleLib/com/test/bo", "ToBO");
//locate the map service
MapService serviceOne = (MapService)ServiceManager.INSTANCE.
locateService("com/ibm/wbiserver/map/MapService");
// invoke the business object map to do the transformation.
try {
serviceOne.simpleTransform("http://SampleLib/com/test/maps",
"FromBO_ToBO_Map",input1, output1);
} catch (WBIMapServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (WBIMapNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (WBIMapFailureException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return output1;
}
You can also use ‘transform’ method on the MapService interface if you would like to invoke business object maps that deal with transformations from multiple BOs to multiple BOs
Please check Must-Have bookmarks for IBM WebSphere Integration Developers for WAS API and other useful references.
Use “com.ibm.wbiserver.map.MapService” interface to invoke Business Object Maps from your Java Classes.
Using the MapService interface is pretty straight forward.
- Use com.ibm.websphere.sca.ServiceManager class to lookup the MapService.
- Use appropriate methods on the MapService to invoke the Business Object Maps.
In the code sample below, the input to the operation is an instance of FromBO. We create an instance of ToBO and use the ‘simpleTranformation’ method on the MapService to invoke the ‘FromBO_ToBO_Map’ business object map.
public DataObject mapInputtoOutput(DataObject input1) {
//create an instance of the output data object.
BOFactory boFactory = (BOFactory)ServiceManager.INSTANCE.
locateService("com/ibm/websphere/bo/BOFactory");
DataObject output1 = boFactory.create("http://SampleLib/com/test/bo", "ToBO");
//locate the map service
MapService serviceOne = (MapService)ServiceManager.INSTANCE.
locateService("com/ibm/wbiserver/map/MapService");
// invoke the business object map to do the transformation.
try {
serviceOne.simpleTransform("http://SampleLib/com/test/maps",
"FromBO_ToBO_Map",input1, output1);
} catch (WBIMapServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (WBIMapNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (WBIMapFailureException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return output1;
}
You can also use ‘transform’ method on the MapService interface if you would like to invoke business object maps that deal with transformations from multiple BOs to multiple BOs
Please check Must-Have bookmarks for IBM WebSphere Integration Developers for WAS API and other useful references.
No comments:
Post a Comment