Search This Blog

Tuesday, February 26, 2013

Tracing queries and query parameters


You can use the WebSphere Application Server administrative console to trace queries serviced by the data service layer. You can also enable tracing for query parameters.
Procedure
  1. To trace the data service layer SELECT queries:
    1. Set the log level setting to 'all' for the com.ibm.commerce.foundation.server.services.dataaccess component in the WebSphere Application Server Administrative console
      Note: To trace the UPDATE and INSERT queries, set the log level setting to 'all' for all classes under component com.ibm.ws.sdo.mediator.jdbc(com.ibm.ws.sdo.mediator.jdbc*=all). You must restart the server after enabling this trace.
    2. The query name, SQL statement and the template file where the query is defined is displayed in the trace. An example of a trace entry is shown in the following sample:
      getGraph(DMSQueryData) Query name: 
      
      /CatalogEntry[CatalogEntryDisplayPageName[(UniqueId=)]]+IBM_CatalogEntryDisplayPage_Get
      [1/31/08 15:08:11:234 EST] 00000034 jdbc 1 com.ibm.commerce.foundation.internal.server.services.dataaccess.graphbuilderservice.jdbc.JDBCMediatorSupplyQuery 
      
      getGraph(DMSQueryData) SQL query: SELECT DISPENTREL.CATENTRY_ID, DISPENTREL.DISPENTREL_ID, DISPENTREL.LANGUAGE_ID, DISPENTREL.DEVICEFMT_ID, DISPENTREL.STOREENT_ID, DISPENTREL.PAGENAME, DISPENTREL.CATENTTYPE_ID, DISPENTREL.AUCTIONSTATE, DISPENTREL.MBRGRP_ID, DISPENTREL.DESCRIPTION, DISPENTREL.FIELD1, DISPENTREL.RANK, DISPENTREL.FIELD2, DISPENTREL.OID, DISPENTREL.OPTCOUNTER FROM DISPENTREL WHERE DISPENTREL.CATENTRY_ID in (?, ?, ?, ?, ?, ?) OR DISPENTREL.CATENTRY_ID =0 AND DISPENTREL.STOREENT_ID IN ( ? ) [ '10651' '10655' '10660' '10665' '10670' '10675' '10702' ]
      [1/31/08 15:08:11:234 EST] 00000034 jdbc 1 
      com.ibm.commerce.foundation.internal.server.services.dataaccess.graphbuilderservice.jdbc.JDBCMediatorSupplyQuery getGraph(DMSQueryData) Template file: D:\WCToolkitEE60\xml\config\com.ibm.commerce.catalog\wc-query-CatalogEntry-admin-get.tpl 
  2. To trace query parameters:
    1. Open the wc-attribute-masking.xml file:
    2. Find the following line:
      <wc:MaskedAttribute name="extendedDataValue" compareType="starts" />
    3. Replace it with the following line, which simply comments the line out by adding <!-- and --> blocks around it:
      <!-- <wc:MaskedAttribute name="extendedDataValue" compareType="starts" /> -->
    4. Open the wc-server.xml file:
    5. Remove the following line:
      <Parameter display="false" name="extendedDataValue"/>
    6. Restart the server.

Wednesday, February 20, 2013

Cross domain redirect fails on Websphere commerce

If cross domain redirect fails in websphere commerce and you see following error in trace log

isRedirectAllowed(String) CMN1245E: Server fails to redirect to the view URL.

This is because the fact that redirect filtering is enabled but neither AllowedHost nor AllowedDomain is specified.

You may either disable URL redirect filtering or specify the proper setting for AllowedHost or AllowedDomain in order for the redirect filtering to work properly.


Correct allowed host in wc-server.xml


  1. Locate the web module where you want to enable this feature. For example, if you want to enable this feature for the Stores web module, this is the section you want to modify:
               <Module contextPath="/webapp/wcs/stores"
           fileServletEnabled="false" name="Stores"
           urlMappingPath="/servlet" webAlias="/wcsstore">
                   <InitParameters adapters="XML/HTTP, BrowserAdapter" 
           contextSetName="Store" handleDoubleClick="true"/>
               </Module>
  2. Add a URLRedirectFilter element in the Module element as shown in the following example:
               <Module contextPath="/webapp/wcs/stores" 
           fileServletEnabled="false" name="Stores"
           urlMappingPath="/servlet" webAlias="/wcsstore">
                   <InitParameters adapters="XML/HTTP, BrowserAdapter" 
           contextSetName="Store" handleDoubleClick="true"/>
                    <URLRedirectFilter enable="true">
                        <AllowedHost name="www.mycompany1.com"/>
                        <AllowedHost name="www.mycompany2.com"/>
                        <AllowedDomain name="mycompany3.com"/>
                     </URLRedirectFilter>
               </Module>
    The usage of these elements is described in the following list:
    URLRedirectFilter enable="true"
    Specifies whether cross-site scripting protection is enabled. Possible values are true or false.
    AllowedHost hostname="www.mycompany1.com"
    Specifies a hostname that WebSphere Commerce will allow redirection to. By default, if this feature is enabled, the Web server hostname that is configured for the WebSphere Commerce instance will be added to the allowed host list.
    AllowedDomain name="mycompany3.com"
    Specifies an entire domain that WebSphere Commerce will allow redirection to. Use this element if you want to allow redirection to all hosts in a domain.

    For details please refer 

    http://www-01.ibm.com/support/docview.wss?uid=swg21458241