Tutorials > Web services > Define an inbound Web service
Register a Web service response JSP page with WebSphere Commerce
This section describes the second activity in creating response JSP pages. Now that you have created JSP template to generate the Web service response, you are ready to register the JSP page in the Struts configuration so that it can be used by the WebSphere Commerce Web services framework.
Since WebSphere Commerce is Struts-enabled, you register JSP pages by adding the appropriate Struts configuration to associate the view with a physical JSP page.
To register a Web service response JSP page using the WebSphere Commerce Struts framework:
Procedure
- In the Enterprise Explorer view, expand Stores > Struts > " <default module>".
- Right-click struts-config-ext.xml and select Open With > Struts Configuration File Editor.
- In the Action Mapping panel of the editor, add a new action mapping called /ShowProductInformationView. 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 ShowProductInformationView/0/-10. By convention, the name of a global forward consists of the registered view, the store the view belongs to, and the device format for Web services, separated by slashes (/). The device format of all Web service response JSP pages is always -10.
- In the Path field for the global forward, specify /webservices/MyCompany/ShowProductInformation.jsp to match the JSP page that you created in the previous section.
- 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 default class for global forwards, based on the additional properties required by the WebSphere Commerce Struts framework.
- Save the Struts configuration and close the Struts Configuration File Editor.
- Restart the WebSphere Commerce Test Server. This is required for the new Struts configuration to take effect.
The following is an example of the global forward and action definitions in the Struts configuration file.
... <forward name="ShowProductInformationView/0/-10" path="/webservices/MyCompany/ShowProductInformation.jsp" className="com.ibm.commerce.struts.ECActionForward"> <set-property property="resourceClassName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl"/> <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 path="/ShowProductInformationView"/>