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
Procedure
- In the Enterprise Explorer view , expand Stores/WebContent/WEB-INF.
- Right-click the struts-config-ext.xml file; select Open With > Struts Configuration File Editor.
- Click the Action Mappings tab.
- In the Action Mappings section of the Action Mappings tab, click Add.
- Rename the action from /action1 to /ConfirmSyncCustomerSuccessBOD. No other configuration is required for the action.
- Click the Global Forwards tab.
- In the Global Forwards section of the Global Forwards tab, click Add.
- 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.
- 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.
- In the Forward Mapping Extensions section of the Global
Forwards tab, add the attributes for the global forward:
- Click Add.
- In the Attribute column, select property.
- In the Key/Propert column, enter properties.
- In the Value column, enter storeDir=no for the value of the attribute.
- 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
- 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.
- 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
- 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>