Registering a Web service response JSP page with WebSphere Commerce

In this tutorial lesson, you are registering your Web service response JSP page with WebSphere Commerce. To register your JSP page you must add struts configurations to associate the view to a physical JSP page.

About this task

Since WebSphere Commerce is Struts-enabled, registration of JSP pages is performed by adding the appropriate struts configuration to associate the view to a physical JSP. The following steps show how a web service response JSP is registered with the WebSphere Commerce struts framework.

Procedure

  1. In the Enterprise Explorer view , expand Stores/WebContent/WEB-INF.
  2. Right-click the struts-config-ext.xml file; select Open With > Struts Configuration File Editor.
  3. Click the Action Mappings tab.
  4. In the Action Mappings section of the Action Mappings tab, click Add.
  5. Rename the action from /action1 to /ConfirmSyncCustomerSuccessBOD. No other configuration is required for the action.
  6. Click the Global Forwards tab.
  7. In the Global Forwards section of the Global Forwards tab, click Add.
  8. Rename the global forward from success to ConfirmSyncCustomerSuccessBOD/0/-10. The naming convention of global forward is the registered view, the store the view belongs to, and the device format for Web services. The device format of all web service response JSP is always -10.
  9. In the Forward Attributes section, edit the Path field for the global forward. Specify /webservices/MyCompany/ConfirmSyncCustomerSuccessBOD.jsp as the Path to match the JSP for the Web service successful execution message.
  10. In the Forward Mapping Extensions section of the Global Forwards tab, add the attributes for the global forward:
    1. Click Add.
    2. In the Attribute column, select property.
    3. In the Key/Propert column, enter properties.
    4. In the Value column, enter storeDir=no for the value of the attribute.
    5. Repeat steps 10.a. to 10.d to create the following attributes:
      Attribute Key/Property Value
      property interfaceName com.ibm.commerce.messaging.viewcommands.MessagingViewCommand
      property implClassName com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl
      property direct true
  11. In the Forward Mapping Extensions section, edit the Class Name field for the global forward; specify com.ibm.commerce.struts.ECActionForward as the Class Name. This class is the WebSphere Commerce default class for global-forwards based on the additional properties required by the WebSphere Commerce struts framework.
  12. Repeat steps 3 - 11 with the following changes to register /ConfirmSyncCustomerErrorBOD action to the ConfirmSyncCustomerErrorBOD.jsp:
    • In step 5, name the new action /ConfirmSyncCustomerErrorBOD
    • In step 8, name the new global forward ConfirmSyncCustomerErrorBOD/0/-10
    • In step 9, specify the path for the new global forward as /webservices/MyCompany/ConfirmSyncCustomerErrorBOD.jsp
  13. Save the struts configuration and close the Struts Configuration File Editor.

    The following is an example of the global forward and action definition in the Struts configuration file.

    
    ...
    <forward name="ConfirmSyncCustomerSuccessBOD/0/-10" path="/webservices/MyCompany/ConfirmSyncCustomerSuccessBOD.jsp" className="com.ibm.commerce.struts.ECActionForward">
    		<set-property property="properties" value="storeDir=no"/>
    		<set-property property="interfaceName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommand"/>
    		<set-property property="implClassName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl"/>
    		<set-property property="direct" value="true"/>
    	</forward>
    	<forward name="ConfirmSyncCustomerErrorBOD/0/-10" path="/webservices/MyCompany/ConfirmSyncCustomerErrorBOD.jsp" className="com.ibm.commerce.struts.ECActionForward">
    		<set-property property="properties" value="storeDir=no"/>
    		<set-property property="interfaceName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommand"/>
    		<set-property property="implClassName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl"/>
    		<set-property property="direct" value="true"/>
    	</forward>
     ...
     
     <!-- Action Mappings -->
       <action-mappings type="com.ibm.commerce.struts.ECActionMapping">
       ...
     <action path="/ConfirmSyncCustomerSuccessBOD">
    </action>
    <action path="/ConfirmSyncCustomerErrorBOD">
    </action>