Results 1 to 7 of 7

Thread: Feed Adapter not reading atom content element

  1. #1
    Join Date
    Jun 2011
    Posts
    17

    Default Feed Adapter not reading atom content element

    I'm running an atomserver RSS/ATOM feed server instance and have published the following valid entry element:
    Code:
      <?xml version="1.0" encoding="UTF-8" ?> 
     <entry xmlns="http://www.w3.org/2005/Atom" xmlns:as="http://atomserver.org/namespaces/1.0/">
      <id>/atomserver/v1/pets/dogs/fido.xml</id> 
      <title type="text">Entry: dogs fido</title> 
      <author>
      <name>AtomServer APP Service</name> 
      </author>
      <link href="/atomserver/v1/pets/dogs/fido.xml" rel="self" /> 
      <link href="/atomserver/v1/pets/dogs/fido.xml/1" rel="edit" /> 
      <as:entryId>fido</as:entryId> 
      <as:updateIndex>5</as:updateIndex> 
      <as:revision>0</as:revision> 
      <updated>2011-06-02T17:41:03.837Z</updated> 
      <published>2011-06-02T17:41:03.837Z</published> 
      <category scheme="urn:pets.breeds" term="Mixed" /> 
      <content type="application/xml">
      <pet xmlns="http://schemas.atomserver.org/pets/v1/rev0" type="dog">
      <breed>Mixed</breed> 
      <name>Fido</name> 
      <owner>Chris Berry</owner> 
      </pet>
      </content>
      </entry>
    The feed adapter is correctly configured and is able to access the entry just fine. The problem is that is doesn't seem to be able to read the "content" element into a SyndEntryImpl. Here's a dump of the SyndEntry that returned:

    Code:
    Could not find fetcher.properties on classpath
    Thu Jun 02 10:41:03 PDT 2011 -  Entry: dogs fido
    SyndEntryImpl.contributors=[]
    SyndEntryImpl.contents=[]
    SyndEntryImpl.updatedDate=Thu Jun 02 10:41:03 PDT 2011
    SyndEntryImpl.link=/atomserver/v1/pets/dogs/fido.xml
    SyndEntryImpl.foreignMarkup[0]=[Element: <as:entryId [Namespace: http://atomserver.org/namespaces/1.0/]/>]
    SyndEntryImpl.foreignMarkup[1]=[Element: <as:updateIndex [Namespace: http://atomserver.org/namespaces/1.0/]/>]
    SyndEntryImpl.foreignMarkup[2]=[Element: <as:revision [Namespace: http://atomserver.org/namespaces/1.0/]/>]
    SyndEntryImpl.links[0].hreflang=null
    SyndEntryImpl.links[0].title=null
    SyndEntryImpl.links[0].length=0
    SyndEntryImpl.links[0].rel=alternate
    SyndEntryImpl.links[0].type=null
    SyndEntryImpl.links[0].href=/atomserver/v1/pets/dogs/fido.xml
    SyndEntryImpl.links[1].hreflang=null
    SyndEntryImpl.links[1].title=null
    SyndEntryImpl.links[1].length=0
    SyndEntryImpl.links[1].rel=self
    SyndEntryImpl.links[1].type=null
    SyndEntryImpl.links[1].href=/atomserver/v1/pets/dogs/fido.xml
    SyndEntryImpl.links[2].hreflang=null
    SyndEntryImpl.links[2].title=null
    SyndEntryImpl.links[2].length=0
    SyndEntryImpl.links[2].rel=edit
    SyndEntryImpl.links[2].type=null
    SyndEntryImpl.links[2].href=/atomserver/v1/pets/dogs/fido.xml/1
    SyndEntryImpl.interface=interface com.sun.syndication.feed.synd.SyndEntry
    SyndEntryImpl.uri=/atomserver/v1/pets/dogs/fido.xml
    SyndEntryImpl.enclosures=[]
    SyndEntryImpl.titleEx.value= Entry: dogs fido
    SyndEntryImpl.titleEx.interface=interface com.sun.syndication.feed.synd.SyndContent
    SyndEntryImpl.titleEx.type=text
    SyndEntryImpl.titleEx.mode=null
    SyndEntryImpl.authors[0].email=null
    SyndEntryImpl.authors[0].name=AtomServer APP Service
    SyndEntryImpl.authors[0].modules=[]
    SyndEntryImpl.authors[0].uri=null
    SyndEntryImpl.author=AtomServer APP Service
    SyndEntryImpl.title= Entry: dogs fido
    SyndEntryImpl.source=null
    SyndEntryImpl.description=null
    SyndEntryImpl.categories[0].taxonomyUri=urn:pets.breeds
    SyndEntryImpl.categories[0].name=Mixed
    SyndEntryImpl.publishedDate=Thu Jun 02 10:41:03 PDT 2011
    SyndEntryImpl.wireEntry=null
    SyndEntryImpl.modules[0].publishers=[]
    SyndEntryImpl.modules[0].subjects=[]
    SyndEntryImpl.modules[0].identifiers=[]
    SyndEntryImpl.modules[0].subject=null
    SyndEntryImpl.modules[0].coverages=[]
    SyndEntryImpl.modules[0].rights=null
    SyndEntryImpl.modules[0].type=null
    SyndEntryImpl.modules[0].date=Thu Jun 02 10:41:03 PDT 2011
    SyndEntryImpl.modules[0].sources=[]
    SyndEntryImpl.modules[0].descriptions=[]
    SyndEntryImpl.modules[0].formats=[]
    SyndEntryImpl.modules[0].publisher=null
    SyndEntryImpl.modules[0].creator=AtomServer APP Service
    SyndEntryImpl.modules[0].languages=[]
    SyndEntryImpl.modules[0].title=null
    SyndEntryImpl.modules[0].dates[0]=Thu Jun 02 10:41:03 PDT 2011
    SyndEntryImpl.modules[0].description=null
    SyndEntryImpl.modules[0].contributor=null
    SyndEntryImpl.modules[0].types=[]
    SyndEntryImpl.modules[0].contributors=[]
    SyndEntryImpl.modules[0].relation=null
    SyndEntryImpl.modules[0].format=null
    SyndEntryImpl.modules[0].interface=interface com.sun.syndication.feed.module.DCModule
    SyndEntryImpl.modules[0].uri=http://purl.org/dc/elements/1.1/
    SyndEntryImpl.modules[0].creators[0]=AtomServer APP Service
    SyndEntryImpl.modules[0].source=null
    SyndEntryImpl.modules[0].relations=[]
    SyndEntryImpl.modules[0].coverage=null
    SyndEntryImpl.modules[0].titles=[]
    SyndEntryImpl.modules[0].rightsList=[]
    SyndEntryImpl.modules[0].language=null
    SyndEntryImpl.modules[0].identifier=null
    I should see the "pets" xml string returned in the contents but it is empty. Is there a limitation on the content types that the SyndEntry parses or am I missing something? If I check the entry.getContents().size parameter it is 0 and the list is clearly empty. Any insight into this would be appreciated.

  2. #2
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    You seem to have an improperly formated ATOM feed. It should start with <feed> element etc. See more here http://en.wikipedia.org/wiki/Atom_(standard)
    Here sis the example what would work:
    Code:
    <?xml version="1.0" encoding="UTF-8" ?> 
    <feed xmlns="http://www.w3.org/2005/Atom">
     
        <title>Example Feed</title>
        <subtitle>A subtitle.</subtitle>
        <updated>2003-12-13T18:30:02Z</updated>
        <author>
                <name>John Doe</name>
                <email>johndoe@example.com</email>
        </author>
    	 <entry xmlns="http://www.w3.org/2005/Atom" xmlns:as="http://atomserver.org/namespaces/1.0/">
    	  <id>/atomserver/v1/pets/dogs/fido.xml</id> 
    	  <title type="text">Entry: dogs fido</title> 
    	  <author>
    	  <name>AtomServer APP Service</name> 
    	  </author>
    	  <link href="/atomserver/v1/pets/dogs/fido.xml" rel="self" /> 
    	  <link href="/atomserver/v1/pets/dogs/fido.xml/1" rel="edit" /> 
    	  <as:entryId>fido</as:entryId> 
    	  <as:updateIndex>5</as:updateIndex> 
    	  <as:revision>0</as:revision> 
    	  <updated>2011-06-02T17:41:03.837Z</updated> 
    	  <published>2011-06-02T17:41:03.837Z</published> 
    	  <category scheme="urn:pets.breeds" term="Mixed" /> 
    	  <content type="application/xml">
    	  <pet xmlns="http://schemas.atomserver.org/pets/v1/rev0" type="dog">
    	  <breed>Mixed</breed> 
    	  <name>Fido</name> 
    	  <owner>Chris Berry</owner> 
    	  </pet>
    	  </content>
    	  </entry>
     </feed>

  3. #3
    Join Date
    Jun 2011
    Posts
    17

    Default

    Oleg - Thanks for the quick reply. I think I see my misunderstanding but I still have a problem. The initial URL I'm reading is the feed "collection" :

    http://<myserver>:<port>/atomserver/v1/pets/dogs

    This is returning the feed response:
    Code:
    <?xml version='1.0' encoding='UTF-8'?>
    <feed xmlns="http://www.w3.org/2005/Atom" xmlns:as="http://atomserver.org/namespaces/1.0/">
    	<as:endIndex>7</as:endIndex>
    	<link href="/atomserver/v1/pets/dogs?max-results=100" rel="self" />
    	<author>
    		<name>AtomServer APP Service</name>
    	</author>
    	<title type="text">dogs entries</title>
    	<updated>2011-06-02T17:41:03.841Z</updated>
    	<id>tag:atomserver.org,2008:v1:dogs</id>
    	<entry>
    		<id>/atomserver/v1/pets/dogs/fido.xml</id>
    		<title type="text"> Entry: dogs fido</title>
    		<author>
    			<name>AtomServer APP Service</name>
    		</author>
    		<link href="/atomserver/v1/pets/dogs/fido.xml" rel="self" />
    		<link href="/atomserver/v1/pets/dogs/fido.xml/1" rel="edit" />
    		<as:entryId>fido</as:entryId>
    		<as:updateIndex>5</as:updateIndex>
    		<as:revision>0</as:revision>
    		<updated>2011-06-02T17:41:03.837Z</updated>
    		<published>2011-06-02T17:41:03.837Z</published>
    		<category scheme="urn:pets.breeds" term="Mixed" />
    		<link href="/atomserver/v1/pets/dogs/fido.xml" rel="alternate" />
    	</entry>
    	<entry>
    		<id>/atomserver/v1/pets/dogs/sparky.xml</id>
    		<title type="text"> Entry: dogs sparky</title>
    		<author>
    			<name>AtomServer APP Service</name>
    		</author>
    		<link href="/atomserver/v1/pets/dogs/sparky.xml" rel="self" />
    		<link href="/atomserver/v1/pets/dogs/sparky.xml/1" rel="edit" />
    		<as:entryId>sparky</as:entryId>
    		<as:updateIndex>6</as:updateIndex>
    		<as:revision>0</as:revision>
    		<updated>2011-06-02T17:41:03.839Z</updated>
    		<published>2011-06-02T17:41:03.839Z</published>
    		<category scheme="urn:pets.breeds" term="Collie" />
    		<link href="/atomserver/v1/pets/dogs/sparky.xml" rel="alternate" />
    	</entry>
    	<entry>
    		<id>/atomserver/v1/pets/dogs/spike.xml</id>
    		<title type="text"> Entry: dogs spike</title>
    		<author>
    			<name>AtomServer APP Service</name>
    		</author>
    		<link href="/atomserver/v1/pets/dogs/spike.xml" rel="self" />
    		<link href="/atomserver/v1/pets/dogs/spike.xml/1" rel="edit" />
    		<as:entryId>spike</as:entryId>
    		<as:updateIndex>7</as:updateIndex>
    		<as:revision>0</as:revision>
    		<updated>2011-06-02T17:41:03.841Z</updated>
    		<published>2011-06-02T17:41:03.841Z</published>
    		<category scheme="urn:pets.breeds" term="Mixed" />
    		<link href="/atomserver/v1/pets/dogs/spike.xml" rel="alternate" />
    	</entry>
    </feed>
    These are the entries that I was parsing which obviously don't contain any content elements. The problem now is when I read a particular entry:

    http://<myserver>:<port>/atomserver/v1/pets/dogs/fido.xml

    using the code below:
    Code:
    	public static void main(String[] args) {
    		ApplicationContext ac = 
    			new ClassPathXmlApplicationContext(configFiles);
    		PollableChannel feedChannel = ac.getBean("feedChannel", PollableChannel.class);
    		for (int i = 0; i < 10; i++) {
    			Message<SyndEntry> message = (Message<SyndEntry>) feedChannel.receive(1000);
    			if (message != null){
    				SyndEntry entry = message.getPayload();
    				System.out.println(entry.getPublishedDate() + " - " + entry.getTitle());
    				System.out.println(entry.toString());
    			}
    			else {
    				break;
    			}
    		}
    	}
    the message is null and nothing is read. The entry in my initial post is what is returned for the fido.xml document. Is the adapter just to get a listing of the entries and not to actually parse the individual entry? Maybe I don't understand what the feed adapter is intended for.

  4. #4
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    Feed adapter is a polling adapter that polls the feed and sends each feed entry to a channel as a Message payload.
    I think it would help you to look at our feed sample: http://git.springsource.org/spring-i...ter/basic/feed
    Let me know if you need more help

  5. #5
    Join Date
    Jun 2011
    Posts
    17

    Default

    Oleg - As I suspected from the sample it is a "feed" adapter not an "entry" adapter. It must require the <feed> root element to parse the server response. This suggests that I need a 2-step process, one using the feed adapter to get all the possible entry links and another to GET the actual entry document from the atomserver using a separate http-outbound-gateway request. There may be some way to configure atomserver to include the entry content in the feed entry listing which would simplify things a bit but for now I at least see what's going on.

  6. #6
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    I don't understand. You should be getting individual entries coming out of the adapter. Do you see something else?

  7. #7
    Join Date
    Jun 2011
    Posts
    17

    Default

    Yes, I'm receiving the entry data shown in #3. The entry content element (shown in #1) is not included with the feed response. It contains the detailed metadata that I need to retrieve. I may be able to use the category element at the feed level to get at what I need.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •