Processing Management Center services

Processing Management Center services involves transforming URL requests into Process BODs and Change BODs.

It is sometimes difficult to determine whether a URL will be transferred to a Process service or a Change service. In general, when working with primary objects, such as a product, URLs are transferred to a Process service, and when working with secondary objects, such as a product description, URLs are transferred to a Change service. For example, adding a product transfers to a Process service with an actionCode of Add, but adding a product description is a Change service with an actionCode of Add and an actionExpression that points to the description.

An actionExpression is an element that represents a processing instruction that pertains to the request. The actionCode attribute indicates the operation, while the value points to the element to apply the action expression to.

An actionCode is a URL parameter that indicates the type of action to be performed on the Noun or Noun part. Valid values are Add and Delete. For more information about actionCodes and actionExpressions, see and Transforming URL requests into Change BODs.

To create a Struts action using the BusinessObjectDocumentAction class, use the following properties in the struts-extension.xml file:
  1. contextParameters
    Optional: A comma separated list of the URL parameters that represent information placed in the business context area of the request. Unless the colon override is specified, the name of the context parameter is the URL parameter. For example, if masterCatalogId:catalogId is specified, the URL parameter value of masterCatalogId is used, but the context parameter name is catalogId. If storeId is specified, the URL parameter and context name are storeId.
  2. documentRootFactory
    The factory that is used to create the BOD object. For example, com.ibm.commerce.catalog.facade.datatypes.CatalogFactory.
  3. var
    The array variable that contains the BOD objects from the WebSphere Commerce server to be used in the response JSP file. For example, catalogEntries.
  4. verb
    The verb of the BOD documentRootFactory.
  5. clientLibrary
    The class name of the client library to invoke.
  6. clientLibraryMethod
    The method to invoke on the client library to initiate the service request.
  7. actionCode
    The actionCode of the request. If this is not specified, the URL request must specify the actionCode as a URL parameter.
  8. defaultParameters
    A list of parameters in query string format.
For more information about creating new Struts actions to process Management Center services, see Processing Management Center services by transforming URL requests into BODs.
New Struts actions are registered in the struts-extension.xml file. To initialize the mapping file for the Management Center Web application, use the BusinessObjectDocumentPlugin Struts plug-in. The following sample code shows the mapping to a Change BOD and a Process BOD.
<action path="/CreateCatalogEntryDescription" parameter="CatalogEntryDescription"
	type="com.ibm.commerce.foundation.client.facade.bod.servlet.struts.BusinessObjectDocumentAction"
	className="com.ibm.commerce.foundation.client.facade.bod.servlet.struts.BusinessObjectDocumentActionMapping">
		<set-property property="contextParameters"1
			value="storeId,langId,masterCatalogId:catalogId" />
		<set-property property="verb"4 value="Change" />
		<set-property property="documentRootFactory"2
			value="com.ibm.commerce.catalog.facade.datatypes.CatalogFactory" />
		<set-property property="clientLibrary"5
			value="com.ibm.commerce.catalog.facade.client.CatalogFacadeClient" />
		<set-property property="clientLibraryMethod"6
			value="changeCatalogEntry" />
		<set-property property="actionCode"7 value="Change"/>
</action>
<action path="/CreateCatalogEntry" parameter="CatalogEntry"
			type="com.ibm.commerce.foundation.client.facade.bod.servlet.struts.BusinessObjectDocumentAction"
			className="com.ibm.commerce.foundation.client.facade.bod.servlet.struts.BusinessObjectDocumentActionMapping">
			<set-property property="contextParameters"
				value="storeId,langId,masterCatalogId:catalogId" />
			<set-property property="verb" value="Process" />
			<set-property property="documentRootFactory"
				value="com.ibm.commerce.catalog.facade.datatypes.CatalogFactory" />
			<set-property property="clientLibrary"
				value="com.ibm.commerce.catalog.facade.client.CatalogFacadeClient" />
			<set-property property="clientLibraryMethod"
				value="processCatalogEntry" />
			<set-property property="actionCode" value="Create"/>
			<set-property property="var"3 value="catalogEntries" />
			<forward name="success" path="/jsp/commerce/catalog/restricted/RespondCreateCatalogEntry.jsp"/>
		</action>
To access nouns from a newly-created custom service module, you must add an additional plug-in statement. For example:
<plug-in
className="com.ibm.commerce.foundation.client.facade.bod.servlet.struts.BusinessObjectDocumentPlugInImpl">
<set-property property="config"
value="/WEB-INF/config/<custom-component>/wc-config-clientobjects.xml" />
</plug-in>

After registering the Struts actions, you must configure the mapping between the URL parameters and the BOD Nouns. For more information about configuring this mapping, see Processing Management Center services by transforming URL requests into BODs.