REST gateway example: Inserting and accessing data into a REST map from a Java client with the ObjectMap APIs

When data is inserted into a map with the REST gateway, a wrapper class of type com.ibm.websphere.xsa.RestValue is used to wrap the supplied content-type and request body. You can use the same RestValue class to insert and get data from the map from a Java client with the ObjectMap APIs.

Java client code to access REST maps

RestValue rv = new RestValue();
rv.setContentType(“application/xml”);
String myXml=”<customer>brian</customer>”;
rv.setValue(myXml.getBytes(“UTF8”));
ogSession.begin();
ObjectMap map = ogSession.getMap(“myMap.LUT”);
map.insert(“brian”,rv);
ogSession.commit();