Welcome to the IBM Websphere Commerce Hub


Welcome to the IBM Websphere Commerce Hub

Come join me in my journey to explore the various features and capabilities of IBM Websphere Commerce and understand how retailers can benefit from its really cool out-of-box functionality.

Monday, April 7, 2014

Debugging BOD Framework

Important Trace Strings to debug BOD


BOD Request / Response:  

com.ibm.commerce.foundation.server.command.bod.*

Data Service Facade Trace String: 

com.ibm.commerce.foundation.server.services.dataaccess.DataServiceFacade 

Get Service Flow Trace Strings:

Useful to understand if the code is breaking midway and if you would like to enable tracing for individual commands.

Fetch<ComponentName>Cmd 

The first point to debug the Get / Search service failures. 
The Fetch command fetches the data.Extensions of this Fetch command are associated with a particular XPath expression.The command framework can use the XPath expression and Fetch task command to resolve the Get request to a particular implementation by using the existing WebSphere Commerce command registry (CMDREG) data. Instead of having one implementation for a Fetch business task, the command framework uses the XPath as the selector to resolve the implementation. If a specific implementation is not defined for the given XPath, then a default Fetch is used.

For example , The InventoryAvailability noun uses a default Fetch implementation and to debug , you must enable the trace for :



com.ibm.commerce.inventory.facade.server.commands.FetchInventoryAvailabilityForDKCmdImpl
 
Compose<ComponentName>Cmd 

The Fetch Command calls the Compose commands to composes the response.When the Get command calls the Compose command, it uses the access profile of the request as the key to select the appropriate Compose implementation. Because the access profile is just a superset of another access profile, the Compose commands delegates to the parent access profile to first populate the logic model and add any required information.

For example , The InventoryAvailability noun uses the below Compose implementations and to debug , you must enable the trace depending on the Inventory system used :



DOMInventorySystem com.ibm.commerce.inventory.facade.server.commands.ComposeDOMInventoryAvailabilityForDKInBatchCmdImpl

NonATPInventorySystem
com.ibm.commerce.inventory.facade.server.commands.ComposeNonATPInventoryAvailabilityCmdImpl

ATPInventorySystem
com.ibm.commerce.inventory.facade.server.commands.ComposeATPInventoryAvailabilityForDKCmdImpl
 
ReadBusinessObjectMediators 

The read mediator constructs the logical object based on the values in the corresponding physical entity.The Read mediators can be found by looking at the below file:



/WC/xml/config/<component-name>/wc-business-object-mediator.xml


For example , The InventoryAvailability service debugging , enable the trace for the below :
com.ibm.commerce.inventory.facade.server.services.dataaccess.bom.mediator.ReadInventoryAvailabilityMediator  
If you do not wish to enable the trace on a granular level , you could also enable the trace for the entire component service.

For example , for Inventory services , enable the below trace :
com.ibm.commerce.inventory.facade.server.*

Debugging Query Template File


XPATH Syntax Validator (wcs_xpathkey utility):

The XPath key generator command-line utility takes an XPath expression as input and generates an XPath key. This key is used to locate the XPATH_TO_SQL_STATEMENT template in the query template file.This utility can help you validate the format of the XPATH Key as well such as missing closing brackets etc or misplaced tokens. Please note this would not however match the XPATH with the actual Noun definition.

wcs_xpathkey MyXPath
For example:
wcs_xpathkey /CatalogEntry[(@catalogEntryTypeCode='ProductBean' 
  or @catalogEntryTypeCode='ItemBean') and 
   ParentCatalogGroupIdentifier[ExternalIdentifier[GroupIdentifier='Coffee Table']]]

The output from this command , if sucessful, would be:
/CatalogEntry[(@catalogEntryTypeCode=) and 
   ParentCatalogGroupIdentifier[ExternalIdentifier[GroupIdentifier=]]]

In case of failures , would display certain error messages.

Query Template File Syntax Validator

Use this page to validate your query template file syntax.
http://localhost/webapp/wcs/admin/servlet/dsl.jsp

In case you are seeing NullPointer exceptions on querying even the OOB services, make the below changes in the dsl.jsp.

Search for the below line:
sc.setXPath(sbQuery.toString());

Add the following line of code below the above line:
sc.setComponentId(componentId); 

Reloading the configuration of a BOD service module

During development, you may want to modify and reload configuration, without having to restart the server. Follow the below Infocenter link  for more details:


http://pic.dhe.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.developer.soa.doc/tasks/tsdreloadconfig.htm

Wednesday, March 26, 2014

Quick Checkout : Database Decode

Ever wondered what does Order with status "Q" and type "QUK" implies? Where are the Quick Checkout profile information stored in the WCS Database?

Check out the below diagram for the details: