原创 IOR互通的讨

2009-9-22 19:29 2332 6 6 分类: 软件与OS
很多人使用visibroker。在局域网中它避开了ior文件的问题,不过,也给理解ior带来了一定的困难。那么:





Q:什么是IOR?


A:IOR是interoperable object reference。即具有互操作能力的对象引用。只要你愿意,它和int&没有区别。





Q:为什么需要IOR?


A:IOR的引入对于CORBA的目标:跨平台、跨语言和跨网络协议是至关重要的。我们知道,要标识网络上的一个对象,我们首先要找到对象所处的机器--
如果是internet,那么我们需要的就是host和port。既然那个对象就在那台机器上,然后要做的就是在那台机器定位盖对象了。CORBA引入了
Objectkey来标识。对于客户端来说,它并不理解objectkey代表的意义,但是没有关系,它只要把objectkey带到请求报文中,服务器
就知道这个请求是发给哪个对象的了。通常,objectkey标识的POA的路径--从rootPOA到对象所在的POA,还有objectid等。注
意,一个ior在服务器重新启动后可能会失效--这和poa的策略有关。





Q:如何查看IOR?


A:许多ORB自带了查看IOR的工具,网上也有一些免费的。Orbacus(from OOC)就有一个工具iordump。它能分析串行化了的ior即ior文件的内容,一查看该ior是否有问题。






1.一个对象引用(IOR)字符串:


IOR:010000001c00000049444c3a53696d706c652f53696d706c654f626a6563743a312e300001000000000000006e00000001010200100000003231312e3136312e3235342e313532003f0900001b0000003a3e0231310c00000000100400006a0d0000080000000000000000000200000001000000180000000100000001000100000000000001010001000000090101000600000006000000010000001100





2.IORDUMP使用例解:




命令:iordump
IOR:010000001c00000049444c3a53696d706c652f53696d706c654f626a6563743a312e300001000000000000006e00000001010200100000003231312e3136312e3235342e313532003f0900001b0000003a3e0231310c00000000100400006a0d0000080000000000000000000200000001000000180000000100000001000100000000000001010001000000090101000600000006000000010000001100





显示:


Stringified IOR is: ([string/coded data] length: 320 / 158 bytes)




>>
IOR:010000001c00000049444c3a53696d706c652f53696d706c654f626a6563743a312e300001000000000000006e00000001010200100000003231312e3136312e3235342e313532003f0900001b0000003a3e0231310c00000000100400006a0d0000080000000000000000000200000001000000180000000100000001000100000000000001010001000000090101000600000006000000010000001100


----------------------------------------------------------


>> +0 [01]


Byte order of IOR: (1) Little Endian


>> +1 [00][00][00]


(padding)


>> +4 [1c][00][00][00]


TypeId length: 28 bytes (including null)


>> +8 [49][44][4c][3a][53][69][6d][70][6c][65][2f][53][69][6d][70][6c][65][4f][62][6a][65][63][74][3a][31][2e][30][00]


TypeId value: 'IDL:Simple/SimpleObject:1.0.'


>> +36 [01][00][00][00]


Number of tagged profiles: 1





Profile 1:


>> +40 [00][00][00][00]


Tag: (0) TAG_INTERNET_IOP


>> +44 [6e][00][00][00]


Profile length: 110 bytes


>> +48 [01]


Byte Order: (1) Little Endian


>> +49 [01][02]


Version: 1.2


>> +52 [10][00][00][00]


Host length: 16 bytes (including null)


>> +56 [32][31][31][2e][31][36][31][2e][32][35][34][2e][31][35][32][00]


Host string: '211.161.254.152.'


* host IP address lookup succeeded, but failed to find a hostname (warning)


>> +72 [3f][09]


Port: 2367


>> +74 [00][00]


(padding)


>> +76 [1b][00][00][00]


Object Key length: 27 bytes (including any trailing null)


>> +80 [3a][3e][02][31][31][0c][00][00][00][00][10][04][00][00][6a][0d][00][00][08][00][00][00][00][00][00][00][00]


Object key data: ':>.11.........j............'


(looks like an Orbix ART Transient key)


>> +107 [00]


(padding)


>> +108 [02][00][00][00]


Number of tagged components: 2





Component 1:


>> +112 [01][00][00][00]


Tag: (1) CODE_SETS


>> +116 [18][00][00][00]


Component length: 24 bytes


>> +120 [01]


Component Byte Order: (1) Little Endian


>> +121 [00][00][00]


(padding)


>> +124 [01][00][01][00]


Native CodeSet id (for char): 65537


(ISO 8859-1:1987; Latin Alphabet No. 1)


>> +128 [00][00][00][00]


Number of conversion code sets (CCS): 0


>> +132 [00][01][01][00]


Native CodeSet id (for wchar): 65792


(ISO/IEC 10646-1:1993; UCS-2, Level 1)


>> +136 [01][00][00][00]


Number of conversion code sets (CCS): 1


>> +140 [09][01][01][00]


CCS(1) CodeSet Id 65801


(ISO/IEC 10646-1:1993; UTF-16, UCS Transformation Format 16-bit form)








Component 2:


>> +144 [06][00][00][00]


Tag: (6) ENDPOINT_ID_POSITION


>> +148 [06][00][00][00]


Component length: 6 bytes


>> +152 [01]


Component Byte Order: (1) Little Endian


>> +153 [00]


(padding)


>> +154 [00][00]


EndpointId begin (index): 0


>> +156 [11][00]


EndpointId end (index): 17








上面不同字节表示IOR不同的元素,特别需要注意:


>> +56 [32][31][31][2e][31][36][31][2e][32][35][34][2e][31][35][32][00]


Host string: '211.161.254.152.'


* host IP address lookup succeeded, but failed to find a hostname (warning)


>> +72 [3f][09]


Port: 2367





看懂了吗?+56表示该IOR指向的CORBA对象所在的机器IP,而+72则表示所在的端口号。可以从这里看出CORBA IIOP调用最根本还是由TCP/IP来执行的

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
6
关闭 站长推荐上一条 /3 下一条