WebSphere Commerce Developer

Migrating storefront services

Any custom storefront pages that use any of the search-related CatalogNavigationView BOD services must be updated to use the corresponding new search server REST services.

For example, the following snippet is a getData BOD search service that is used to populate a catalog entry recommendations widget:

<wcf:getData type="com.ibm.commerce.catalog.facade.datatypes.CatalogNavigationViewType" var="catalogNavigationView" 
expressionBuilder="getCatalogEntryViewDetailsByID" scope="request" varShowVerb="showCatalogNavigationView" 
maxItems="100" recordSetStartNumber="0" scope="request">
	<c:forEach var="marketingSpotData" items="${marketingSpotDatas.baseMarketingSpotActivityData}">
		<c:if test='${marketingSpotData.dataType eq "CatalogEntryId"}'>
			<wcf:param name="UniqueID" value="${marketingSpotData.uniqueID}"/>
		</c:if>
	</c:forEach>
	<wcf:contextData name="storeId" data="${storeId}" />
	<wcf:contextData name="catalogId" data="${catalogId}" />
	<wcf:param name="searchProfile" value="IBM_findCatalogEntryDetails_PriceMode"/>
</wcf:getData>
<c:set var="eSpotCatalogIdResults" value="${catalogNavigationView.catalogEntryView}"/>
The following snippet is the equivalent REST-based service:

<wcf:rest var="catalogNavigationView" url="${searchHostNamePath}${searchContextPath}/store/${WCParam.storeId}/productview/byIds" >
<c:forEach var="id" items="${catentryIdQueryList}">
	<wcf:param name="id" value="${id}"/>
</c:forEach>
<wcf:param name="langId" value="${langId}" />
<wcf:param name="currency" value="${env_currencyCode}" />
<wcf:param name="responseFormat" value="json" />
<wcf:param name="catalogId" value="${WCParam.catalogId}" />
<wcf:param name="profileName" value="IBM_findProductByIds_Summary" />
</wcf:rest>
<c:set var="eSpotCatalogIdResults" value="${catalogNavigationView.catalogEntryView}"/>

The response data is being formatted in a BOD-like dot notation response to minimize the changes that are required in the storefront. In some cases, the response is simplified and flattened to simpler name-value pairs, rather than using internal maps to group certain fields.

You can examine the JSON response by printing the response object by using the following code:

<wcf:json object="${catalogNavigationView}"/>
You can also invoke the REST service directly from the web browser or by using HTTPRequester or an equivalent client to validate you custom code:

http://localhost/search/resources/store/10152/productview/byId/10001?langId=-1&catalogId=10001&currency=USD&responseFormat=json&pageSize=12&pageNumber=1

For more information about the BOD to REST services mappings, see Mapping between WebSphere Commerce Search BOD services and REST services.

For more information about the WebSphere Commerce REST API for WebSphere Commerce Search, see the complete list of supported query parameters for the following search services:
  • search_product
  • search_category
  • search_site_content