Task flow: Using the web feed utility

In this example, you explore the content management integration feature by uploading an image file published through Atom feed.

For simplicity, this tutorial uses a web server to host the Atom feed. Typically, the feed would originate from the CMS system.


Before beginning


Procedure

  1. Copy the image file under webserver_home/webapp/docs

  2. Create a new atom feed called atom.xml in the same folder. Example: atom.xml file

      <?xml version="1.0" encoding="utf-8"?>
      <feed xmlns="http://www.w3.org/2005/Atom">
      
        <title>Example Atom Feed</title>
        <link href="http://ibm-ab91a9a6ad:8080"/>
        <updated>2010-02-13T18:30:02Z</updated>
        <author>
          <name>John Doe</name>
        </author>
        <id>60a76c80-d399-11d9-b93C-003939e0af6</id>
      
        <entry>
          <title>Test Atom Image Content</title>
          <link href="http://ibm-ab91a9a6dad:8080/docs/hand.png"/>
          <id>1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
          <updated>2010-01-13T18:30:02Z</updated>
          <summary>Some image</summary>
          <content type="image/jpeg" src="http://hostname:8080/docs/image_name_with_extension"/>
         <category term=""/>
        </entry>
      
      </feed>

    Where:

      host_name
      The fully qualified host name of the machine.

      image_name_with_extension
      The name of the image with extension.

  3. Restart the web server.

  4. Verify that published atom feed is accessible from the WebSphere Commerce Server. http://host_name:8080/docs/atom.xml


Related concepts
Overview of the web feed utility


Configure WebSphere Commerce toolkit


Procedure

  1. Create a directory, for example: C:\WebSphere\WCToolkit\WC-CMS.

  2. In the directory you created, create a file called Web-feed-config.xml. This file specifies the feed URL and the type of file to upload. Example: Web-feed-config.xml file

      <?xml version="1.0" encoding="UTF-8"?>
      <config:CMSConfiguration
          xmlns:config="http://www.ibm.com/xmlns/prod/commerce/foundation/CMS/config"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/CMS/config CMSIntegration_config.xsd ">
      <config:feedEndPoint>
              <config:content>
               <config:managedAsset>
                      <config:name>ProductImage1</config:name>
                      <config:feedURL><![CDATA[http://ibm-ab91a9a6dad:8080/docs/atom.xml]]></config:feedURL>
                      <config:managedDirectory>/test/images</config:managedDirectory>
                      <config:allowedTypes>*.png</config:allowedTypes>
                      <config:tempFileLocation>C:\WebSphere\WCToolkit\WC-CMS\temp</config:tempFileLocation>
           </config:managedAsset>
         </config:content>
      </config:feedEndPoint>	
      <config:dataLoadConfigFile 
            generate="true" 
            envFileLocation="C:\WebSphere\WCToolkit\samples\DataLoad\Catalog\wc-dataload-env.xml">
            C:\WebSphere\WCToolkit\WC-CMS\wc-dataload-config.xml</config:dataLoadConfigFile>
      </config:CMSConfiguration>

  3. Open the
    WCDE_installdir\samples\DataLoad\Catalog\wc-dataload-env.xml file. Comment or uncomment sections depending on the database that we are using. (DB2) (Oracle)

    Note: Encrypt the database user password using the wcs_encrypt.bat utility before adding the password to the XML file.

      <?xml version="1.0" encoding="UTF-8"?>
      <_config:DataLoadEnvConfiguration
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config xsd/wc-dataload-env.xsd" 
      	xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">
      	
      <_config:BusinessContext storeIdentifier="Madisons" catalogIdentifier="Madisons"  />
      <_config:Database name="..\db\mall" type="derby" />	
      
      <!--for db2,following is a sample for db2,you need to specify the parameters based your env-->
      <!--
      	<_config:Database type="db2" name="mall" user="build" password="xK36ck80s6GCL9+YsULolg==" 
               server="localhost" port="50000" schema="build" /> 
      -->
      
      <!--for oracle,following is a sample for oracle,you need to specify the parameters based your env-->
      <!--	
      	<_config:Database type="Oracle" port="1521" schema="comusr" name="comdb" user="comusr" password="h2Vcc0xwMNpi8Hs0rI1O/w==" 
                server="localhost" driverType="thin" />
      -->	
      
      	<_config:DataWriter className="com.ibm.commerce.foundation.dataload.datawriter.JDBCDataWriter" />
      </_config:DataLoadEnvConfiguration>

  4. Upload content from the Atom feed:

    1. Run the webFeedLoad utility:

        WCDE_installdir/bin/webFeedLoad.bat C:\WebSphere\WCToolkit\WC-CMS\Web-feed-config.xml 
                        -DFileHandler.level=FINEST -DconsoleHandler.level=FINEST

      If the utility runs successfully, you will see a result similar to the following example:

      Note: If you run the webFeedLoad command consecutively without changing the feed content, database tables are not updated every time.

  5. Verify the content in Management Center.

    1. Start the WebSphere Commerce test server.

    2. Open the Management Center.

    3. Open the Assets Tool.

    4. Select the Madisons store. Note that the directory structure you uploaded, /test/images, is displayed. The image file is also displayed.

    5. From the x list select Attachment. Go to the last entry in the list, 1225c695-cfb8-4ebb-aaaa-80da344efa6a. This entry has the same ID as the element value in the feed.

    6. Associate the image with a product.

    7. Use store preview to see the product in the storefront.


Results

You uploaded an image published from an Atom feed. You associated the image with a product using the Management Center and verified the results in the Madisons store.