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 you begin
- Have access to a web server that is accessible from your HCL Commerce Developer system.
Procedure
- Copy the image file under webserver_home/webapp/docs
-
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.
- Restart the web server.
- Verify that published atom feed is accessible from the HCL Commerce Server. http://host_name:8080/docs/atom.xml
Configuring HCL Commerce toolkit
Procedure
- Create a directory, for example: C:\WebSphere\WCToolkit\WC-CMS.
-
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>
-
Open the
WCDE_installdir\samples\DataLoad\Catalog\wc-dataload-env.xml
file. Comment or uncomment sections depending on the database that you are using.
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>
-
Upload content from the Atom feed:
-
Verify the content in Management Center.
- Start the HCL Commerce test server.
- Open the Management Center.
- Open the Assets Tool.
- Select the Madisons store. Note that the directory structure you uploaded, /test/images, is displayed. The image file is also displayed.
-
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. - Associate the image with a product.
- Use store preview to see the product in the storefront.