Sunday, July 27, 2014

Rest service handlers Feature pack 6 vs 7

Representational State Transfer (REST) is a lightweight framework for designing applications that use HTTP to make calls. REST uses HTTP to perform the Create, Read, Update, and Delete (CRUD) operations between client and server. Applications interact with the services using HTTP, POST, PUT, GET, and DELETE operations.
WebSphere Commerce uses Representational State Transfer (REST) services to provide a framework that can be used to develop RESTful applications on several platforms. These platforms can include Web, mobile, kiosks, and social applications. This gives a lot of flexibility and allows commerce applications to create their own front end.

Rest handlers in feature pack 6 out of the box:

com.ibm.commerce.marketing.rest.resources.MarketingSpotData
com.ibm.commerce.giftcenter.rest.resources.GiftList
com.ibm.commerce.rest.inventory.handler.InventoryHandler
com.ibm.commerce.rest.marketing.handler.ESpotDataHandler
com.ibm.commerce.rest.marketing.handler.EventHandler
com.ibm.commerce.rest.member.handler.GuestIdentityHandler
com.ibm.commerce.rest.member.handler.LoginIdentityHandler
com.ibm.commerce.rest.member.handler.LTPAIdentityHandler
com.ibm.commerce.rest.member.handler.PersonContactHandler
com.ibm.commerce.rest.member.handler.UserContextHandler
com.ibm.commerce.rest.member.handler.PersonHandler
com.ibm.commerce.rest.member.handler.PreviewTokenHandler
com.ibm.commerce.rest.member.handler.PersonCheckoutProfileHandler
com.ibm.commerce.rest.order.handler.CartHandler
com.ibm.commerce.rest.order.handler.OrderHandler
com.ibm.commerce.rest.order.handler.PaymentInstructionHandler
com.ibm.commerce.rest.order.handler.ShippingInfoHandler
com.ibm.commerce.rest.store.handler.GeoNodeHandler
com.ibm.commerce.rest.store.handler.StoreHandler
com.ibm.commerce.rest.store.handler.StoreLocatorHandler
com.ibm.commerce.rest.search.handler.CategoryViewHandler
com.ibm.commerce.rest.search.handler.ProductViewHandler
com.ibm.commerce.rest.wishlist.handler.WishlistHandler

Rest handlers in feature pack 7 out of the box: In feature pack 7:
 REST services help facilitate the invocation of classic controller commands and the activation of data beans. They aim to provide a framework that is easy to learn and customize. The framework lets you create custom REST resource handlers that invoke controller commands to perform add, update and delete operations, or activate data beans to retrieve data

com.ibm.commerce.marketing.rest.resources.MarketingSpotData
com.ibm.commerce.giftcenter.rest.resources.GiftList
com.ibm.commerce.rest.inventory.handler.InventoryHandler
com.ibm.commerce.rest.marketing.handler.ESpotDataHandler
com.ibm.commerce.rest.marketing.handler.EventHandler
com.ibm.commerce.rest.marketing.handler.PromotionHandler
com.ibm.commerce.rest.marketing.handler.AssociatedPromotionHandler
com.ibm.commerce.rest.member.handler.GuestIdentityHandler
com.ibm.commerce.rest.member.handler.LoginIdentityHandler
com.ibm.commerce.rest.member.handler.LTPAIdentityHandler
com.ibm.commerce.rest.member.handler.PersonContactHandler
com.ibm.commerce.rest.member.handler.UserContextHandler
com.ibm.commerce.rest.member.handler.PersonHandler
com.ibm.commerce.rest.member.handler.PreviewTokenHandler
com.ibm.commerce.rest.member.handler.PersonCheckoutProfileHandler
com.ibm.commerce.rest.order.handler.CartHandler
com.ibm.commerce.rest.order.handler.OrderHandler
com.ibm.commerce.rest.order.handler.PaymentInstructionHandler
com.ibm.commerce.rest.order.handler.AssignedCouponHandler
com.ibm.commerce.rest.order.handler.AssignedPromotionCodeHandler
com.ibm.commerce.rest.order.handler.ShippingInfoHandler
com.ibm.commerce.rest.store.handler.GeoNodeHandler
com.ibm.commerce.rest.store.handler.StoreHandler
com.ibm.commerce.rest.store.handler.StoreLocatorHandler
com.ibm.commerce.rest.search.handler.CategoryViewHandler
com.ibm.commerce.rest.search.handler.ProductViewHandler
com.ibm.commerce.rest.wishlist.handler.WishlistHandler
com.ibm.commerce.rest.coupon.handler.CouponHandler
com.ibm.commerce.rest.marketing.handler.SegmentHandler
com.ibm.commerce.rest.marketing.handler.SpotHandler
com.ibm.commerce.rest.price.handler.PriceHandler


Reference: http://www-01.ibm.com/support/knowledgecenter/SSZLC2_7.0.0/com.ibm.commerce.webservices.doc/concepts/cwvrest.htm?lang=en

Attachments | Out of the box are not crawled | enable searching

Once attachments are created in CMC and assigned to respective products, schedule job ScheduledContentManagedFileEARUpdate picks them up and moves them into Stores\\attachments folder. By default this job could be configured to run for 30 minutes so on dev, you will need to configure to run quicker to test.

Out of the box attachments are not picked and hence you pick up the static file below StaticContentSitemap.jsp and add the block below to read all attachments to be crawled

-----------------------------------------------------------------------------------------------------------
<wcbase:useBean id="attachmentBean" classname="com.ibm.commerce.catalog.beans.AttachmentDataBean" scope="page">
<c:set value="${langId}" target="${attachmentBean}" property="languageId"/>
</wcbase:useBean>
<c:forEach var="attachmentAssetDataBean" items="${attachmentBean.attachmentAssets}">
<c:set var="tempURL" value="/${attachmentAssetDataBean.directory}/${attachmentAssetDataBean.attachmentAssetPath}"/>
<c:set var="attachmentURL" value="${fn:replace(tempURL, ' ', '%20')}"/>
<url crawlurl="${attachmentURL}" indexurl="${attachmentURL}">
</c:forEach>
-----------------------------------------------------------------------------------------------------------

You can run the build index and Crawler by running this command: from \bin

di-buildindex.bat -masterCatalogId 10001 -webcontentDelete true

crawler.bat -cfg C:\WCDE_ENT70\search\solr\home\droidConfig.xml



Configure the crawler file for the store : droidConfig.xml
-----------------------------------------------------------------------------------------------------------
<variables> 
<var name="hostname">localhost</var> 
<var name="storePathDirecttory">/WCDE_ENT70/wasprofile/temp/localhost/server1/WC/EliteStorefrontAssetStore</var> 
<var name="langId">-1</var> 
<var name="storeId">10151</var> 
<var name="catalogId">10001</var> 
<var name="language">en</var> 
<var name="localename">en_US</var>
<var name="filterDir">/WCDE_ENT70/search/solr/home</var> 
<var name="port">80</var> 
</variables>
-----------------------------------------------------------------------------------------------------------

Attribute Sequencing | Storefront pages for attribute name and value

Dataloader process should update CATENTRYATTR.SEQUENCE for sequencing attribute names in store front pages and ATTRVALDESC.SEQUENCE for descriptive attribute values.

Attribute name ordering:

ATTR.SEQUENCE is only used for organizing attributes in CMC



Storefront pages use CATENTRYATTR.SEQUENCE for attribute name sequencing

The sequence which you see in storefront are with respect to CATENTRYATTR.SEQUENCE because attributes are associated with specific product


Attribute value Ordering:

For both defining and descriptive value ordering, ATTRVALDESC.SEQUENCE is used.

Friday, July 18, 2014

Error 404: SRVE0190E: File not found: /stores/servlet/home

This could happen due to multiple reasons but a couple of reasons that I have seen prominently and please free to add in your comments.

Debugging 1st approach: WebServer configuration
1.Goto access.log in C:\IBM\HTTPServer\logs  and you will see 127.0.0.1 - -"GET /shop/home HTTP/1.1" 404 60
2. Goto C:\IBM\HTTPServer\conf and make sure the httpd.conf and make sure toolkit is pointing to correct directory.
3. Before you make any modifications, do take a backup of httpd.conf

Debugging 2nd approach:

1. Make sure the WC->properties->Java EE Module dependencies has Stores.war checked.


Tuesday, July 15, 2014

Deploying WebsphereCommerceServerExtensionsData --EJBDeployer had Errors


This happens due to a bug in RAD and RAD goes into an inconsistent state. I would try clean build and close data project but even if this does not work. If you have a working data project copy , try to replace that with the data project from workspace and try doing java EE->prepare deployment.




Wednesday, June 25, 2014

CMN8413E: The messaging system cannot find an appropriate profile | Enable transports in V7

If you see an error similar to the one below, most likely your transport is inactive.

[6/25/14 14:05:41:279 PDT] 00000047 CommerceSrvr  A com.ibm.commerce.messaging.outboundservice.Messaging loadAdminData(Integer,Integer,Integer) CMN8413E: The messaging system cannot find an appropriate profile for MSGTYPE_ID "101" to match an active transport of the STORE_ID "10051" in table PROFILE. Ensure that the MSGTYPE has been assigned to an active transport under the store or site.

Login into Admin console and activate Websphere MQ by changing status as show in the image on the right.

If the transports are not visible enable them from wc-server.xml. In V7 by default they are not enabled so 

Search for the string below in wc-server.xml and make enable true and similarly you can do it for other transports: A couple of enabled transport xml snippets from wc-server.xml below.
<OutboundConnector
        default="true"
        enabled="true" id="3"
        name="JMS" retries="3">
...
  <OutboundConnector
        default="true"
        enabled="true" id="1"
        name="JavaMail" retries="3">
        <JNDI
          JndiName="eis/JCAEmail" display="false"/>
...



Thursday, June 12, 2014

Data Loader Override FullImage, Thumbnail scenario fix or any other columns exclusion

This blog explain a scenario where  FULLIMAGE and THUMBNAIL are overridden in table CATGRPDESC even when the CSV files is not passing the values for these fields.
This can be used to apply column level exclusions for any other component similarly so these fields are not overridden.


C:\IBM\WCDE_ENT70\workspace\WC\xml\config\com.ibm.commerce.catalog\dataload\wc-loader-catalog-group.xml

Pasting a block where the change is required..this XML has much more business object configurations:
 <_config:DataLoader className="com.ibm.commerce.foundation.dataload.BusinessObjectLoader">
  <_config:ColumnExclusionList>   
    <_config:table name="CATGRPDESC" columns="FULLIMAGE,THUMBNAIL" />
  </_config:ColumnExclusionList>  
    <_config:DataReader className="com.ibm.commerce.foundation.dataload.datareader.CSVReader" firstLineIsHeader="true" useHeaderAsColumnName="true" />
......
......
.....

Sample RunProductLoad.bat for testing, make sure the path for wc-dataload-catalog-group.xml is correctly done as it is pointing to relative below:

@echo off
setlocal
cd "C:\IBM\WCDE_ENT70\bin"
call dataload ..\workspace\DataLoad\dataload\CustomDataLoad\MasterCatalog\wc-dataload-catalog-group.xml -DXmlValidation="false" -DComponent=CustomDataLoad\MasterCatalog -DFeedHome=C:\IBM\WCDE_ENT70\workspace\DataLoad\dataload -DWCConfigHome=C:\IBM\WCDE_ENT70\workspace\WC\xml\config -DCVConfigHome=C:\IBM\WCDE_ENT70\workspace\DataLoad\dataload\Config
endlocal


Sample CSV file: CatalogGroup.csv, GroupIdentifier points to CATGROUP.IDENTIFIER and ParentGroupIdentifier is the parent from CATGRPREL

Start date 2013-01-28 16:40:42 
GroupIdentifier,ParentGroupIdentifier,TopGroup,Sequence,Name,ShortDescription,Published
36010,310010,FALSE,0,Sample & Decors,Sample & Decors,1

If you have spaces before of GroupIdentifier or ParentGroupIdentifier: It causes this issue below:

Exception message:
The ID was not resolved for the table CATGROUP with the unique index data [  310010, 7000000000000000051].
Stack trace:
com.ibm.commerce.foundation.dataload.exception.DataLoadApplicationException: The ID was not resolved for the table CATGROUP with the unique index data [  310010, 7000000000000000051].
at com.ibm.commerce.foundation.dataload.idresolve.IDResolverForOneTable.resolveId(IDResolverForOneTable.java:339)
at com.ibm.commerce.foundation.dataload.idresolve.IDResolverImpl.resolveId(IDResolverImpl.java:369)
at com.ibm.commerce.foundation.dataload.util.DataLoadHelper.resolveIds(DataLoadHelper.java:2818)

Success or failure: logs folder in toolkit: Sample success log

Load summary for load item: CatalogGroup.
----------------------------------------------------------------------------------
Business Object Configuration: C:\IBM\WCDE_ENT70\workspace\WC\xml\config/com.ibm.commerce.catalog/dataload/wc-loader-catalog-group.xml
Data loader mode: Replace.
Batch size: 1.
Commit count: 100.
Error Tolerance Level: 1.
Error Count: 0.
Amount of data processed: 3.
Amount of business objects processed: 1.
Amount of business objects committed: 1.
Data loader initialization time: 1 seconds.
Data loader completed in 4.236 seconds.
Total flush time: 0 seconds.
Total commit time: 0.002 seconds.
CSV file location: C:\IBM\WCDE_ENT70\bin\..\workspace\DataLoad\dataload\CustomDataLoad\MasterCatalog\CatalogGroup.csv.
Affected tables (6):
Table name: CATGROUP, Affected number of rows: 1.
Table name: STORECGRP, Affected number of rows: 1.
Table name: CATGRPDESC, Affected number of rows: 1.
Table name: CATTOGRP, Affected number of rows: 0.
Table name: CATGRPREL, Affected number of rows: 1.
Table name: TI_DELTA_CATGROUP, Affected number of rows: 1.