Burlap中hessian协议研究(一)

  最近,闲的无聊,研究一些开源组件的源代码提高的自己的水平!!

  以下时你必须知道的原理知识??

  仅供参考使用,如有问题请联系我??

Burlap也是有caucho提供,它和hessian的不同在于,它是基于XML-RPC协议的。

是基于什么协议实现的?

基于XML-RPC协议实现。

怎么发起请求?

根据Burlap提供的API

怎么将请求转化为符合协议的格式的?

将请求信息转化为符合协议的XML格式,转化为流进行传输。

使用什么传输协议传输?

Http协议。

响应端基于什么机制来接收请求?

监听Http请求。

怎么将流还原为传输格式的?

根据XML-RPC协议进行还原。

处理完毕后怎么回应?

返回结果写入XML中,由Burlap返回至调用端。

 

 

关于Burlap的请求信息的DTD文件如下:

 

DTD文件描述:

burlap协议定义格式

SML grammar

tag-list ::= (S tag)* S

tag      ::= <name> tag-list </name>
         ::= <name> cdata </name>

S        ::= (' ' | '\t' | '\r' | '\n')*

cdata    ::= ([^<&] | &# [0-9]+ ; | &lt; | &gt; | &amp;)*
name     ::= [a-zA-Z:_] [a-zA-Z0-9.-_:]*

burlap:call

        
<!DOCTYPE burlap:call>

<!ENTITY % object "null | boolean | int | double | string | xml |
                 base64 | date | ref | map | list | remote">
                        
<!ENTITY % header "(header, (%object;))*">

<!ELEMENT burlap:call - - ((%header;), method, (%object;)*)>

<!ELEMENT header - - #CDATA>

<!ELEMENT method - - #CDATA>

<!ELEMENT null - - EMPTY>
<!ELEMENT boolean - - #CDATA>
<!ELEMENT int - - #CDATA>
<!ELEMENT double - - #CDATA>
<!ELEMENT string - - #CDATA>
<!ELEMENT xml - - #CDATA>
<!ELEMENT base64 - - #CDATA>
<!ELEMENT date - - #CDATA>

<!ELEMENT ref - - #CDATA>
<!ELEMENT map - - (type, ((%object;), (%object;))*)>
<!ELEMENT list - - (type, length, (%object;)*)>
<!ELEMENT type - - #CDATA>

<!ELEMENT remote - - (type, string)>

burlap:reply

        
<!DOCTYPE burlap:reply>

<!ENTITY % object "(null | boolean | int | double | string | xml |
                 base64 | date | ref | map | list | remote)">
                        
<!ENTITY % header "(header, (%object;))*">

<!ELEMENT burlap:reply - - ((%header;), (%object; | fault))>

<!ELEMENT header - - #CDATA>

<!ELEMENT fault - - (string, (%object;))*>

<!ELEMENT null - - EMPTY>
<!ELEMENT boolean - - #CDATA>
<!ELEMENT int - - #CDATA>
<!ELEMENT double - - #CDATA>
<!ELEMENT string - - #CDATA>
<!ELEMENT xml - - #CDATA>
<!ELEMENT base64 - - #CDATA>
<!ELEMENT date - - #CDATA>

<!ELEMENT ref - - #CDATA>
<!ELEMENT map - - (type, ((%object;), (%object;))*)>
<!ELEMENT list - - (type, length, (%object;)*)>
<!ELEMENT type - - #CDATA>

<!ELEMENT remote - - (type, string)>

 

 

关于Burlap请求的信息格式

如下:

 

 

Burlap的格式类似如下:

burlap内容如下:
<burlap:call>
<method>setAdDetail</method>
<map>
<type>com.netease.bid.client.model.Ad</type>
<string>id</string><long>-888</long>
<string>title</string><string>888</string>
<string>desc1</string><string>888</string>
<string>desc2</string><string>888</string>
<string>url</string><string>
http://www.888.com</string>
<string>dispUrl</string><string>http://www.888.com</string>
<string>area</string><string>1</string>
<string>areas</string><list><length>2</length><int>16</int><int>27</int></list>
<string>appearTime</string><int>1</int>
<string>disappTime</string><int>12</int>
<string>dayBudget</string><string>16</string>
<string>keywords</string><map><type></type>
<long>-58810201</long>
<map>
<type>com.netease.bid.client.model.Keyword</type>
<string>id</string><long>-58810201</long>
<string>name</string><string>
原始关键词8</string>
<string>status</string><int>0</int>
<string>mode</string><int>0</int>
<string>clickCost</string>
<map>
<type>java.math.BigDecimal</type><string>value</string><string>10</string>
</map>
<string>topPrice</string><string>0.3</string>
</map>
<long>-52610072</long>
<map>
<type>com.netease.bid.client.model.Keyword</type>
<string>id</string><long>-52610072</long>
<string>name</string><string>
原始关键词
88</string>
<string>status</string><int>0</int>
<string>mode</string><int>0</int>
<string>clickCost</string>
<map>
<type>java.math.BigDecimal</type><string>value</string><string>11</string>
</map>
<string>topPrice</string><string>0.3</string>
</map>
<long>-79731473</long>
<map>
<type>com.netease.bid.client.model.Keyword</type>
<string>id</string><long>-79731473</long>
<string>name</string><string>
原始关键词
888</string><string>status</string><int>0</int>
<string>mode</string><int>0</int>
<string>clickCost</string>
<map>
<type>java.math.BigDecimal</type><string>value</string><string>12</string>
</map><string>topPrice</string><string>0.3</string>
</map></map>
<string>status</string><int>1</int>
</map>
</burlap:call>

 

 

生成此xml的类为MicroBurlapInputStream类

 

 

请看源代码如下:

 

请看下一节??

  \(^o^)/\(^o^)/

 

 

 

你可能感兴趣的:(xml,框架,远程访问技术的研究)