Search code examples
ruby-on-railspingxml-rpc

Rails: Verify if a Wordpress-type of blog ping service is working


I have made a blog for my Ruby on Rails-application and for this I have created a ping service to ping blog portals like Technorati so that my blog will appear in them. The simplified code for this:

    blog_name = "My blog"
blog_url = "http://www.myblog.com"
list_of_pings = [
  'http://rpc.twingly.com',
  'http://rpc.technorati.com/rpc/ping',
  'http://ping.feedburner.com/',
  'http://blogpeople.net/ping'
]
list_of_pings.each do |target_url|
  server = XMLRPC::Client.new2(URI.parse(target_url).to_s)
  begin
    result = server.call("weblogUpdates.ping", blog_name, blog_url)
    logger.info "OK"
  rescue XMLRPC::FaultException => e
    logger.error(e)
    logger.info "Fail"
  rescue 
    logger.info "Other fail"
  end      
end

As far as I know, this is working fine but I can't verify it so I don't know. When I check the "recently updated" parts on the sites I ping (which are some 20+ more than in my example above) I never find my blog so I expect that it might actually not work.

Is there a way to test and verify how this ping is received on the receiver end? Is there a web service to test pings like these or at any other clever way where I can test my blog ping?


Solution

  • There is a specification for the weblogUpdates.ping RCP request. Twingly has the documentation on their site (https://developer.twingly.com/resources/rpc-ping/), a success response looks like this:

    <?xml version="1.0" ?>
    <methodResponse>
        <params>
            <param>
                <value>
                    <struct>
                        <member>
                            <name>flerror</name>
                            <value>
                                <boolean>0</boolean>
                            </value>
                        </member>
                        <member>
                            <name>message</name>
                            <value>
                                <string>Thanks for the ping.</string>
                            </value>
                        </member>
                    </struct>
                </value>
            </param>
        </params>
    </methodResponse>
    

    The message can vary for each service, but in general they all have a flerror member that indicates the success.