Friday, August 28, 2015

WSO2 ESB Feed Connector

Atom is the name of an XML-based Web content and metadata syndication format, and an application-level protocol for publishing and editing Web resources belonging to periodically updated websites. All Atom feeds must be well-formed XML documents, and are identified with the application/atom+xml media type.

To use the Feed Connector first we need to configure the Server on Backend to receive the requests from connector. (sample sever implementation Here ). for more Details.

Create New Feed

create new Feed Entry will handle by CreateFeed Operation


<feed.CreateFeed>
   <HostAddress>{$ctx:HostAddress}</HostAddress>
   <Title>{$ctx:Title}</Title>
   <Content>{$ctx:Content}</Content>
   <Author>{$ctx:Author}</Author>
   <FeedID>{$ctx:FeedID}</FeedID>
</feed.CreateFeed>

Properties

  • HostAddress: URL of the Service (eg: http://localhost:9002/FeedConnector)
  • Title: Title of the feed we are creating.(eg: This is the title )
  • Content:Feed content or summery (eg: Hello World)
  • Author:owner of the feed (eg: Rajjaz)
  • FeedID:unique ID of the Feed (optional in most feed services server will handle this eg: WSO2Inc:Rajjaz,Feed)


Edit Feed

Editing the Existing Feeds by ID handle by EditFeed Operation

<feed.EditFeed>
   <HostAddress>{$ctx:HostAddress}</HostAddress>
   <Title>{$ctx:NewTitle}</Title>
   <EntryID>{$ctx:EntryID}</EntryID>
   <Content>{$ctx:Content}</Content>
    <Author>{$ctx:Author}</Author>
   <FeedID>{$ctx:FeedID}</FeedID>
</feed.EditFeed> 

Properties

  • HostAddress: URL of the Service (eg: http://localhost:9002/FeedConnector)
  • EntryID:Unique ID of Feed by the Feed Server
  • Title:Title of the feed we are creating.(eg: This is the New title )
  • Content:  Feed content or summery (eg: New Hello World)
  • Author: owner of the feed (eg: Rajjaz)
  • FeedID: unique ID of the Feed server (optional in most feed services server will handle this eg: WSO2Inc:Rajjaz,Feed)

Delete Feed

Delete the existing feed by id handle by DeleteFeed Operation


<feed.DeleteFeed>
   <HostAddress>{$ctx:HostAddress}</HostAddress>
   <EntryID>{$ctx:EntryID}</EntryID>
</feed.DeleteFeed>

Properties

  • HostAddress: URL of the Service (eg: http://localhost:9002/FeedConnector).
  • EntryID: Unique ID of Feed by the Feed Server.

Sample configuration

Following is a sample proxy service that illustrates how to connect to feed conector with the CreateFeedoperation.


<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="Feed_CreateEnttry" transports="https"
   statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence onError="faultHandlerSeq">
          <property name="HostAddress" expression="//HostAddress/text()" />
          <property name="Title" expression="//Title/text()" />
          <property name="Content" expression="//Content/text()" />
          <property name="Author" expression="//Author/text()" />        
          <property name="FeedID" expression="//FeedID/text()"/>
         <feed.CreateFeed>
            <HostAddress>{$ctx:HostAddress}</HostAddress>
            <Title>{$ctx:Title}</Title>
            <Content>{$ctx:Content}</Content>
            <Author>{$ctx:Author}</Author>
            <FeedID>{$ctx:FeedID}</FeedID>
         </feed.CreateFeed>
         <respond />
      </inSequence>
      <outSequence>
         <send />
      </outSequence>
   </target>
   <description />
</proxy>

No comments:

Post a Comment