Can I trust below? and will it work on all ping server servers?
The short answer is no. Various server implementations will have errors or incorrectly interpret the specification, so you cannot write code that will work on all ping server servers. The best you can do is be liberal in what you accept and try to deal with non-standard / buggy servers as much as you can.
pingback link says
If the pingback request is successful, then the return value MUST be the only string containing as much information as the server finds useful. This line is supposed to be used for debugging purposes.
If the result is unsuccessful, the server MUST respond with an RPC error value. The fault code must be either one of the codes listed above, or a common zero error code if the server cannot determine the correct fault code.
Thus, a client expecting the server to conform to the specification will do something like
try { client.execute( "weblogUpdates.extendedPing", params ); } catch(XmlRpcException e) { //check the code of the rpc exception as shown below, //log the error, or perhaps rethrow it? return false; }
If the server complies with the pingback specification, it must return one of the following trouble codes,
0 A generic fault code. Servers MAY use this error code instead of any of the others if they do not have a way of determining the correct fault code. 0×0010 (16) The source URI does not exist. 0×0011 (17) The source URI does not contain a link to the target URI, and so cannot be used as a source. 0×0020 (32) The specified target URI does not exist. This MUST only be used when the target definitely does not exist, rather than when the target may exist but is not recognised. See the next error. 0×0021 (33) The specified target URI cannot be used as a target. It either doesn't exist, or it is not a pingback-enabled resource. For example, on a blog, typically only permalinks are pingback-enabled, and trying to pingback the home page, or a set of posts, will fail with this error. 0×0030 (48) The pingback has already been registered. 0×0031 (49) Access denied. 0×0032 (50)
As you already mentioned, several pingback servers return an error code, so you should check this also with code, for example
try { Object rpcRVal = client.execute( "weblogUpdates.extendedPing", params ); if(rpcRVal instanceof Map) { Object flError = ((Map) rpcRVal ).get("flerror"); if(flError != null && flError instanceof Boolean) { return ((Boolean) flError).booleanValue()); } } return true; } catch(XmlRpcException e) ...