XML-RPC experience detailed explanation

黄舟
Release: 2017-03-16 16:53:40
Original
2214 people have browsed it

I went to Yuanzi today and found that Yuanzi already supports the WebBlog function of Office2007, so I took a look and used XML-RPC technology. Open dudu XML-RPCPRC#API It feels like WebService, but after a closer look, it turns out it's not. That's when I noticed that XML-PRC is working. What is XML-RPC (don’t laugh at me for being ignorant), fortunately I only know googleXML-RPCIt turned out to be like this:

What’s XML-RPC?
It's a spec and a set of implementations that allow software running on disparate operating systems, 
running in different environments to make procedure calls over the Internet.
It's remote procedure calling using HTTP as the transport and XML as the encoding. XML-RPC is designed to be as simple as possible, 
while allowing complex data structures to be transmitted, processed and returned.
Copy after login


Simply put, it uses HTTP as the transmission protocol and XML as the data content to implement a standard for remote method invocation. (Very similar to WebService). For details, please refer to the standards of XML-PRC http://www.xmlrpc.com/ I won’t say more here .

Since it is a standard, someone will definitely implement it. Go to http://sourceforge.net/ I searched and it turned out to be the case, but unfortunately there is no implementation of .Net. Let’s take a look at the implementation of dudu. Found thisCookComputing.XmlRpc indudu#API , haha, it should be him. GoogleI love you so much, you helped me find it http://www.cookcomputing.com/blog/index.html , haha, it turns out that cookcomuting implemented XML-PRC under .Net . , let me experience itXML-PRC.

下载源代码后,运行里面的Math这个SampleVery Cool使用这个Liberry非常简单,感觉比Remoting还要简单,遗憾的是现在的版本由于.Net Framework的原因现在只支持Framework 1.1不支持Framework 2.0,在说明中会在以后版本支持 Framework 2.0

哈哈,大家赶快去体验吧。

体验之后发现XML-PRC.Net客户端实现代理模式挺有意思,决定研究一下。打开源代码发现使用的是动态创建Assembly的技术,也就是该技术导致了不支持Framework2.0的原故。


从上面的图(画的不好请见谅)看出客户端通过
XmlRpcProxyGenCreate方法创建了一个实现YourInterface的类,同时继承XmlRpcClientProtocol,在这里使用了AssemblyBuilder具体可以查看MSDN。然后把YourInterface的方法全部由XmlRpcClientProtocol的一个Invoke的方法代理,该函数的签名如下:

public object Invoke(string MethodName,params object[]Parameters)
Copy after login

哈哈,这回终于找到关键所在了,在Invoke方法里面就可以按照XML-RPC的标准通过WebRequest对象调用远程的方法了。

The above is the detailed content of XML-RPC experience detailed explanation. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template