Retrieving Management Center objects by transforming nouns into XML

When data is sent in the form of a noun from the WebSphere Commerce Server to Management Center, the Management Center web application transforms the noun into an XML representation. The JSP file that represents the Struts action forward is used to transform a noun into an XML formatted object.

The data that is retrieved for display in Management Center requires must be in a specific XML format. JSP files that represent a Struts action forward are used to transform noun data into XML objects that are in the required format. The following types of JSPs can be used to transform noun data into XML formatted objects:
  • Controller JSP pages. The controller JSPs use the wcf:getData tag to invoke component services. These JSPs are also used to store the noun data that is returned in service responses. These JSP files store this data in JSTL expression language variables that are then used by the serialization JSP fragments to transform the data. For an example of a controller JSP, see GetCatalogEntry.jsp example
  • Serialization JSP fragments. The serialization JSP fragments help to create the response message by formatting the noun data into the XML object representation that is required by Management Center. For more information about serialization JSPs, see creating and registering a serialization JSP file.
Multiple JSPs can be used to transform noun data into an XML object. By using separate JSPs for different parts of the transformation process you can reuse JSPs to transform data from different services. If two different services are invoked, different controller JSPs can be used. Different controller JSPs can use the same serialization JSPs if the XML object that is returned by both services is the same. For example, one service can retrieve a catalog entry for a category and another service can search for catalog entries. Each of these services is invoked differently and uses different controller JSPs, but both can use the same serialization JSP to transform noun data into a catalog entry object.

Adding more data by using the built-in UserData support

If you customize the Management Center to add UserData into an existing noun, the UserData must be transformed into an XML object. The serialization JSP fragments that are provided by default can serialize new UserData values for existing nouns. This default serialization support ensures that UserData can be included in Management Center XML objects that are provided by default. UserData must use parameters with the format prefix_name. For example, xdesc_WarrantyTerms. The prefix must begin with the letter x and identifies the field as UserData. For example, xattr_, xdesc_, or xattrdesc_. The name part of the UserData parameter format is the name of the UserData field. For example, WarrantyTerms.

The following code snippet shows the structure for this UserData within a serialization JSP fragment that is used to transform the data:
<c:forEach var="userDataField" items="${catalogEntry.userData.userDataField}"> 
<xattr_${userDataField.typedKey}>${userDataField.typedValue}</xattr_${userDataField.typedKey}>
</c:forEach>

Since a noun can have UserData at multiple levels, append an identifier to the x prefix to distinguish between UserData with the same field name at different levels of a noun. For instance, xattr_, xdesc_, and xattrdesc_. When a get URL request is called, the configured UserData is returned as a property of a Management Center object. For example, if a UserData field is xattr_WarrantyTerms and a get URL request is called for a noun that includes this field, the UserData is returned as a warranty term property for the Management Center object. For more information about User Data, see Adding data to an existing Management Center object.

Notes

The XML format and JSP files have the following characteristics:
  • The XML format must begin with <?xml version="1.0" encoding="UTF-8"?> to ensure multilingual support.
  • All Management Center objects must have one property that can uniquely identify an object. Although an object can be uniquely identified with two properties, the Management Center can use only one property to identify an object. For information about defining Management Center objects, see Object definitions.
  • The names of the JSP files must follow the existing naming conventions that indicate the purpose of the JSP file. For example, GetSalesCatalog.jsp and SerializeCatalogEntries.jspf.
  • The result set that is returned when multiple objects are returned for Find services must be wrapped in the objects document.
    <objects recordSetReferenceId="${show.recordSetReferenceId}" 
    recordSetCompleteIndicator="${show.recordSetCompleteIndicator}"
    recordSetTotal="${show.recordSetTotal}" 
    recordSetCount="${show.recordSetCount}" 
    recordSetStartNumber="${show.recordSetStartNumber}">
    For more information about Get result paging, see Get Request and the Show Response.

Examples

The following examples are JSP files and the output XML format that are generated during a noun to XML transformation: