(同发www.tiray.net ,文章地址:http://www.tiray.net/post/e5afb9e69c89e98193%28-wwwyoudaocom-%29e58d9ae5aea2Ping-Servicee68ea5e58fa3e79a84e8b4a8e79691.aspx)
在开发Tiray Blog Ping的过程中,总是发现有道( http://www.youdao.com/ )的博客Ping Service( http://blog.yodao.com/ping/RPC2 )返回错误,开始认为是自己的程序有错,后来用Windows Live Writer 测试后,发现结果也是一样!也许有道的程序员应该检查一下Ping Service接口了!有道的Ping Service说明地址:http://www.yodao.com/help/blogsearch/description/006/
以下数据都是用Fiddler截获的!
下面是Windows Live Writer向有道发送的Ping命令数据包:
POST /ping/RPC2 HTTP/1.0
Accept: */*
Accept-Language: zh-CN, en-US, en, *
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Windows Live Writer 1.0)
Content-Type: text/xml
Host: blog.yodao.com
Content-Length: 319
<?xml version="1.0" encoding="utf-8"?>
<methodCall>
<methodName>weblogUpdates.ping</methodName>
<params>
<param>
<value>
<string>Tiray.Net</string>
</value>
</param>
<param>
<value>
<string>http://tiraynet.spaces.live.com/</string>
</value>
</param>
</params>
</methodCall>
下面是有道返回的数据包(居然是“No such handler: weblogUpdates.ping”):
HTTP/1.1 200 OK
Date: Tue, 03 Jun 2008 17:32:12 GMT
Server: Apache
Content-Length: 334
Vary: Accept-Encoding,User-Agent
Connection: close
Content-Type: text/xml
<methodResponse xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions">
<fault>
<value>
<struct>
<member><name>faultString</name><value>No such handler:weblogUpdates.ping</value></member>
<member><name>faultCode</name><value><i4>0</i4></value></member>
</struct>
</value>
</fault>
</methodResponse>
下面是使用Tiray Blog Ping 发送扩展Ping命令时的数据包:
POST /ping/RPC2 HTTP/1.1
Content-Type: text/xml
User-Agent: Tiray Blog Ping
Host: blog.yodao.com
Content-Length: 585
Expect: 100-continue
Connection: Keep-Alive
<?xml version="1.0"?>
<methodCall>
<methodName>weblogUpdates.extendedPing</methodName>
<params>
<param>
<value>
<string>Tiray软件博客--关注软件开发技术及资讯</string>
</value>
</param>
<param>
<value>
<string>http://www.tiray.net</string>
</value>
</param>
<param>
<value>
<string>http://www.tiray.net/default.aspx</string>
</value>
</param>
<param>
<value>
<string>http://www.tiray.net/syndication.axd</string>
</value>
</param>
<param>
<value>
<string>软件开发|Software development</string>
</value>
</param>
</params>
</methodCall>
下面是有道返回的数据包(表明调用方法的参数不正确):
HTTP/1.1 200 OK
Date: Tue, 03 Jun 2008 17:49:34 GMT
Server: Apache
Vary: Accept-Encoding,User-Agent
Keep-Alive: timeout=5, max=300
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/plain; charset=UTF-8
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions">
<fault>
<value>
<struct>
<member><name>faultString</name><value>No method matching arguments: java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String</value></member>
<member><name>faultCode</name><value><i4>0</i4></value></member>
</struct>
</value>
</fault>
</methodResponse>
为了检验是否是因为字符编码引起的问题,移除了所有中文字符,再次用Tiray Blog Ping 发送Ping命令,结果也是一样!
下面是向有道发送的Ping命令:
POST /ping/RPC2 HTTP/1.1
Content-Type: text/xml
User-Agent: Tiray Blog Ping
Host: blog.yodao.com
Content-Length: 532
Expect: 100-continue
Connection: Keep-Alive
<?xml version="1.0"?>
<methodCall>
<methodName>weblogUpdates.extendedPing</methodName>
<params>
<param>
<value>
<string>Tiray's blog</string>
</value>
</param>
<param>
<value>
<string>http://www.tiray.net</string>
</value>
</param>
<param>
<value>
<string>http://www.tiray.net/default.aspx</string>
</value>
</param>
<param>
<value>
<string>http://www.tiray.net/syndication.axd</string>
</value>
</param>
<param>
<value>
<string>Software development</string>
</value>
</param>
</params>
</methodCall>
下面是有道返回的数据:
HTTP/1.1 200 OK
Date: Tue, 03 Jun 2008 17:54:12 GMT
Server: Apache
Vary: Accept-Encoding,User-Agent
Keep-Alive: timeout=5, max=300
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/plain; charset=UTF-8
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions">
<fault>
<value>
<struct>
<member><name>faultString</name><value>No method matching arguments: java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String</value></member>
<member><name>faultCode</name><value><i4>0</i4></value></member>
</struct>
</value>
</fault>
</methodResponse>