Apache RPC クライアント ライブラリを使用して、Java でブログ ping サービスの実装を開始しました。しかし、私は少し混乱しており、ブログの ping 応答が成功したかどうかを確認するための明確な仕様を見つけることができないようです。
これは、pingback の (公式の?) 仕様のようです。
http://www.hixie.ch/specs/pingback/pingback-1.0
ただし、これはフォルトコードが返されることに言及しています。
http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
Google ブログ検索などの多くの RPC サーバーは、XML 応答で 'flerror' および 'message' 要素を返すようです。これは、次のように思われます。
http://xmlrpc.scripting.com/weblogsCom.html
何が起きてる?私はpingbackがウェブの一種のハッキングであり、それが標準になったことを理解しています-しかし、何に対してコーディングするか、または実際に応答を信頼するかについて混乱しています. 以下は信頼できますか?また、すべてのブログの ping サーバーで機能しますか?
public boolean ping( String urlToPing, String title, String url, String urlChanges, String urlRSS ) throws MalformedURLException, XmlRpcException
{
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL( new URL( urlToPing ) );
XmlRpcClient client = new XmlRpcClient();
client.setConfig( config );
Object[] params = new Object[] { title, url, urlChanges, urlRSS };
HashMap result = ( HashMap )client.execute( "weblogUpdates.extendedPing", params );
try
{
errors.put( url, Boolean.parseBoolean( result.get( "flerror" ).toString() ) );
}
catch( Exception e )
{
log.error( "RPC Problem Parsing response to Boolean trying: " + result.get( "flerror" ) );
}
return Boolean.parseBoolean( result.get( "flerror").toString()) ;
}