Pages

Friday, July 20, 2012

Registering a Websphere Application Server instance as a windows service.

By default, the default profile of the WAS is registered as windows service during installation. Any new app server profiles that you create can be registered using the following command
 WASService.exe -add <<serviceName>> -serverName <<serverName>> -profilePath <<profilePath>> -startType automatic 

where <<serviceName>> is the name of the service that appears in the component service prepended with "IBM Websphere Application Server V7.0"  
<<serverName>> is the name of the server to start (e.g. server1)<<profilePath>> is the path to the websphere application server profile
startType can be either automatic, manual or disabled
     
Following is the usage for the command

Usage: WASService.exe (with no arguments displays this help)
                    || -add <service name>
                       -serverName <Server>
                       -profilePath <Server's Profile Directory>
                           [-wasHome <Websphere Install Directory>]
                           [-configRoot <Config Repository Directory>]
                           [-startArgs <additional start arguments>]
                           [-stopArgs <additional stop arguments>]
                           [-userid <execution id> -password <password>]
                           [-logFile <service log file>]
                           [-logRoot <server's log directory>]
                           [-encodeParams]
                           [-restart <true | false>]
                           [-startType <automatic | manual | disabled>]
                    || -remove <service name>
                    || -start <service name> [optional startServer.bat parameters]
                    || -stop <service name> [optional stopServer.bat parameters]
                    || -status <service name>
                    || -encodeParams <service name>


                   
To remove a service, use the following command
                   
WASService.exe -remove SOLRSL02Node01
Remove Service: SOLRSL02Node01
Successfully removed service

Thursday, June 14, 2012

Implementing SEO on IBM WCS 7 Feature pack 3 or greater

Enabling SEO for a store

Ensure that the store is > FEP3, i.e., FEP3 sar is published and Search based navigation is enabled in management centre. SEO is not enabled by default after publishing the store. We need to enable SEO for a store by inserting a row in the database table SEOURL as below


insert into SEOURL values
(-100001,'StoreToken:CatalogToken','10352:10021',null,null,null,null,0)

We are inserting a token for storeId and catalog id where store id is 10352 and catalogId is 10021.

This will enable the SEO URLs for the store. Also we need to ensure that in our JSP’s all the URL formation has a patternName defined and this patternName should also be defined in a SEO URL Pattern xml file which will be discussed below.  

Getting rid of the /webapp/wcs/stores/servlet context path

Open wc-server.xml and find the element <SEOConfiguration>. Add the following property to the element.

<SEOConfiguration defaultUrl="" dynamicUrl="true" enable="true" >
 <context-root-rewrite value="/shop" />
</SEOConfiguration>

After restarting the server, all URL’s will be rewritten as www.domain.com/shop/..We also need to configure the webserver to pass through all the requests with /shop to /webapp/wcs/stores/servlet (remember we are not actually changing the context root but we are pretending to)

On a IBM HTTP server, the following redirect rule will suffice (usually done in httpd.conf)

## shop url Pass through
RewriteRule /shop/(.*)$ /webapp/wcs/store/servlet/$1  [PT,L,NE]

Generating SEO content for all dynamic categories and products

This is done by using the batch file provided in commerce v7.0 as shown below (assuming db2 database)

From C:\WCDE_ENT70\bin (Commerce installation path)

seourlkeywordgen.bat <<storeId>> <<catalogId>> <<languageId>> <<path to wc-server.xml>> <<path to wc-admin-component of infrastructure-fep component>> <<db2user>> <<dbpassword>>

where
- storeId is the store which owns the catalog
- catalogId is the sales catalog Id for the store
- languageId is -1 for en_US or all for all languages
- path to wc-server.xml in the EAR
- path to infrastructure-fep wc-admin-component.xml  e.g. C:\WCDE_ENT70\workspace\WC\xml\config\com.ibm.commerce.infrastructure-fep\wc-admin-component.xml
db2 user Id
- db2 password 
This will generate the keywords for the products and categories based on the names.

Now every link in the JSPs that are being formed for the categories and products should have a patternName defined. This patternName maps to the one of SEOURLPatterns*.xml which can be found under Stores/WebContent/WEB-INF/xml/seo/stores/<<storename>>

Thursday, February 16, 2012

IBM WCS Indexing Product attributes and Enabling Facets

IBM WCS Indexing Product attributes(Classic Attributes)

  1. Product attributes can be either defining (SKUs) or descriptive.
  2. There are 30 String fields and 10 Integer and Float fields each that can be used for attribute indexing.
  3. To index an attribute, enter the attribute name in “ATTRNAME” field of “CLSATTRSRCHCONF” table. For e.g., enter “Colour” if you have colour as the defining/descriptive attribute for items
  4. Update the separator to the relevant separator character. For me it is a semicolon ;
  5. Once this is done, run the pre-processing and then build index.
  6. This will index the catalog attributes in Solr

IBM WCS Enabling Facets on Product attributes

Indexing will not enable the facets display on the store. To enable facet display, follow the steps below:

We need to add a search attribute for Colour in SRCHATTR table (Assuming colour is my product attribute)
-10001    0    CatalogEntry    _cat.Colour    0

Also add the search attribute properties in SRCHATTRPROPS as below
-10001    rank    cas_f1    0
-10001    search    cas_f1    0
-10001    display    cas_f1    0
-10001    filter    cas_f1_ntk_cs    0
-10001    catalogFilter    cas_f1_ntk_cs    0
-10001    facet    cas_f1_ntk_cs    0

Where cas_f1 and cas_f1_ntk_cs are the fields defined in solr core. Restart the websphere commerce server once done and you have the attribute facets appearing on the page.