Develop > Presentation layer > Work with Web service feeds > Create a custom feed from a Web service


Create the Atom feed representation of the service

You must create a custom JSP file to format the content of the Atom feed. Each noun must have an associated feed formatting JSP file. The RESTful framework uses this JSP file when converting the SDO to an Atom feed. Register the custom feed formatting JSP file in a Struts configuration file so that the JAX-RS provider Java class uses the correct JSP file to create the feed.


Before you begin

Review the following topics to understand the purpose and function of feed formatting JSP files and the Struts configuration file:


Procedure

  1. Open WebSphere Commerce Developer and switch to the Enterprise Explorer view.

  2. Create the feed formatting JSP files for the Atom feed. You can create one JSP file that performs all the required configuration and formatting functions, or split the functions between a series of JSP files.

    1. Create a directory in which to store the custom JSP file. The directory must be at the following path:

      WCDE_INSTALL/workspace/Rest/WebContent/


      Tip: The Atom feed formatting JSP files shipped with WebSphere Commerce are stored in the Atom directory at the previous path (that is, WCDE_INSTALL/workspace/Rest/WebContent/Atom). To keep all Atom feed formatting JSP files together, consider storing the custom files in a subdirectory within the Atom directory.

    2. Create a JSP file with a name like Serializenoun_nameAtom.jsp, for example, SerializeCatalogGroupAtom.jsp. If you are splitting the functions between a series of JSP files, add a suffix to each file name to identify its function.

    3. Define the contents of the feed formatting JSP file so that it gets the SDO and produces a valid output according to the Atom Syndication Format 1.0 specification. See the guidelines and examples in Feed formatting JSP files for Atom feeds.

    4. Save and close the JSP file.

  3. Open the Struts configuration file for the RESTful framework at the following path:

    WCDE_INSTALL/workspace/Rest/WebContent/WEB-INF/struts-extension.xml

  4. Add a new action mapping to register the JSP file. If you have created a series of JSP files, register only the top-level JSP file. See the guidelines and examples in Struts configuration for specifying Atom feed formatting JSP files.

  5. Save and close the file.

  6. Restart the WebSphere Commerce test server to make the new configuration available.


Previous topic: Define the URL and creating the Java class for the feed


Next topic: Test, exposing, and deploying the Atom feed


Related concepts

WebSphere Commerce Struts framework

Struts configuration for specifying Atom feed formatting JSP files


+

Search Tips   |   Advanced Search