Tutorial: Defining a User Registration Web Service >
Registering a Web service response JSP page with WebSphere Commerce
This section is related to registering a Web service response JSP page with WebSphere Commerce.
Registering the JSP page 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 using the WebSphere Commerce struts framework. To register a Web service response JSP page using the WebSphere Commerce Struts framework:
- In the Project Explorer window, expand Stores > Struts > "<default module>".
- Right-click struts-config-ext.xml and select Open With > Struts Configuration File Editor.
- In the Action Mappings panel of the Struts Configuration File Editor, add a new action called /ConfirmSyncCustomerSuccessBOD. No other configuration is required for the action.
- Switch to the Global Forwards panel of the Struts Configuration File Editor.
- Add a new global forward called 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 Path field for the global forward, specify /webservices/MyCompany/ConfirmSyncCustomerSuccessBOD.jsp to match the JSP created previously.
- In the properties section for the global forward, add these properties:
Property Name Property Value properties storeDir=no interfaceName com.ibm.commerce.messaging.viewcommands.MessagingViewCommand implClassName com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl direct true - In the Class Name field, specify com.ibm.commerce.struts.ECActionForward. This is the WebSphere Commerce default class for global-forwards based on the additional properties required by the WebSphere Commerce struts framework.
- Repeat steps 1 to 8 to register the /ConfirmSyncCustomerErrorBOD to the ConfirmSyncCustomerErrorBOD.jsp created previously.
In step 5, the new global forward is called ConfirmSyncCustomerErrorBOD/0/-10. In step 6, the path for the new global forward is /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" className="com.ibm.commerce.struts.ECActionForward" path="webservices/MyCompany/ConfirmSyncCustomerSuccessBOD.jsp"> <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" className="com.ibm.commerce.struts.ECActionForward" path="webservices/MyCompany/ConfirmSyncCustomerErrorBOD.jsp"> <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 path="/ConfirmSyncCustomerErrorBOD"/>