Tianlong Wu wrote:
hello,
I was trying to build a rss feed service using tuscany.
I implemented the interface org.apache.tuscany.sca.binding.rss.collection.Collection
like this:
public class FeedImpl implements Collection {

    public SyndEntry get(String id) throws NotFoundException {
        // TODO Auto-generated method stub
        SyndPerson author = new SyndPersonImpl(  );
        author.setEmail("[email protected] <mailto:[email protected]>");
        author.setName("Example Person");
SyndEntry entry = new SyndEntryImpl( );
        entry.setTitle("First Entry Title");
        entry.setLink("http://www.example.org/item1";);
        SyndContent description = new SyndContentImpl(  );
        description.setValue("News about the Example project");
        description.setType("text");
        entry.setDescription(description);
        entry.setAuthors(Collections.singletonList(author));
        return entry;
    }

    public SyndFeed getFeed() {
        // TODO Auto-generated method stub
        SyndPerson author = new SyndPersonImpl(  );
        author.setEmail("[email protected] <mailto:[email protected]>");
        author.setName("Example Person");
SyndFeed feed = new SyndFeedImpl( );
        feed.setTitle("Example Feed Output from ROME");
        feed.setDescription("The Example Organization web site");
        feed.setAuthors(Collections.singletonList(author));
        feed.setLink("http://www.example.org/";);
        feed.setPublishedDate(new Date(  ));

        List<SyndEntry> entries = new ArrayList<SyndEntry>();

        try {
            entries.add(this.get(""));
        } catch (Exception e) {
            // TODO: handle exception
        }
feed.setEntries(entries);
        return feed;
    }

    public SyndFeed query(String queryString) {
        // TODO Auto-generated method stub

        return getFeed();
    }
}
and in my composite file there is:
<component name="FeedComponent">
<implementation.java class="rocku.java.infoshare.services.FeedImpl" />
        <service name="Collection">
            <t:binding.rss />
        </service>
</component>

The application run successfully. But when I open the URL(http://localhost:8080/FeedComponent)
in my browser, it outputs the following error:
HTTP ERROR: 500

Invalid rss_2.0 feed, missing channel title
RequestURI=/FeedComponent

Caused by:

com.sun.syndication.io.FeedException: Invalid rss_2.0 feed, missing channel title
......

I found the JIRA page: https://issues.apache.org/jira/browse/TUSCANY-3111. It says that adding a description to the feed would fix the problem. But I explicitly set the title and
description in my code.

Thanks for your time.

The Tuscany travel sample contains an example of creating an RSS feed.
See the contributions/blog-feed and launchers/blog-feed directories
for details of how to do this successfully.  The travel sample isn't
part of the Tuscany binary distribution, so you'll need to download it
separately from this page:

http://tuscany.apache.org/sca-java-travel-sample-1x-releases.html

  Simon

--
*****************************************************
Tianlong Wu

Computer Science and Technology Dept.
Harbin Institute of Technology
NO.92 Xidazhi Street,150001
Harbin, Heilongjiang Province, P.R.China

Reply via email to