如何在 Java 客户端代码中解码、更改然后重新编码 CORBA IOR 文件 (Visibroker)?
我正在编写代码来获取负责服务器的团队生成的 IOR 文件,并使用它将我的客户端绑定到他们的对象。听起来很容易,对吧?
由于某种超出我理解的原因(与防火墙、DMZ 等有关),IOR 文件内服务器的值不是我们可以使用的。我们必须修改它。但是,IOR 字符串是经过编码的。
Visibroker 提供了什么功能,可以让我解码 IOR 字符串、更改一个或多个值,然后重新编码并继续正常操作?
我已经研究过 IORInterceptors 和 URL Naming,但我认为它们都不起作用。
提前致谢!
I am writing code to ingest the IOR file generated by the team responsible for the server and use it to bind my client to their object. Sounds easy, right?
For some reason a bit beyond my grasp (having to do with firewalls, DMZs, etc.), the value for the server inside the IOR file is not something we can use. We have to modify it. However, the IOR string is encoded.
What does Visibroker provide that will let me decode the IOR string, change one or more values, then re-encode it and continue on as normal?
I've already looked into IORInterceptors and URL Naming but I don't think either will do the trick.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
当您觉得需要破解 IOR 时,请通过编写代码或其他方式按照您的喜好来修改它,从而抵制这样做的冲动。 IOR 是由包含引用对象的服务器创建和指示的,因此当您开始在那里乱搞时,您就有点“使您的保修失效”。
相反,您应该花时间寻找正确的方法,让服务器在生成 IOR 时使用备用主机名,从而使 IOR 在您的环境中可用。大多数 ORB 都提供这样的功能。我根本不知道 Visibroker 的特定配置选项,但快速 Google 搜索显示 此页面显示出有希望的价值:
希望有所帮助。
When you feel like you need to hack an IOR, resist the urge to do so by writing code and whatnot to mangle it to your liking. IORs are meant to be created and dictated by the server that contains the referenced objects, so the moment you start mucking around in there, you're kinda "voiding your warranty".
Instead, spend your time finding the right way to make the IOR usable in your environment by having the server use an alternative hostname when it generates them. Most ORBs offer such a feature. I don't know Visibroker's particular configuration options at all, but a quick Google search revealed this page that shows a promising value:
Hope that helps.
很久以前我写过 IorParser for GNU Classpath,代码可用。我认为这是一个了解格式的正常解析器,不应该“使保修无效”。 IOR 包含多个标记的配置文件,这些配置文件的封装方式与 XML 非常相似,因此我们可以解析/修改我们需要并理解的配置文件,而其余部分保持不变。
我们需要解析的配置文件是 TAG_INTERNET_IOP 。它包含版本号、主机、端口和对象密钥。读取和写入此配置文件的代码可以在 gnu.IOR 类。很抱歉,这是系统库的一部分,不是一段很好的代码,可以在此处复制粘贴,但用几个依赖类将其删除应该不是很困难。
这个问题已被多次提出CORBA :: 使用 IIOP 获取客户端 ORB 地址和端口
Long time ago I wrote IorParser for GNU Classpath, the code is available. It is a normal parser written being aware about the format, should not "void a warranty" I think. IOR contains multiple tagged profiles that are encapsulated very much like XML so we could parse/modify profiles that we need and understand and leave the rest untouched.
The profile we need to parse is TAG_INTERNET_IOP. It contains version number, host, port and object key. Code that reads and writes this profile can be found in gnu.IOR class. I am sorry this is part of the system library and not a nice piece of code to copy paste here but it should not be very difficult to rip it out with a couple of dependent classes.
This question has been repeatedly asked as CORBA :: Get the client ORB address and port with use of IIOP
使用 jacORB 中的 FixIOR 工具(二进制)来修补 IOR 的地址和端口。 下载二进制文件(解压缩)并运行:
该工具将覆盖 IOR 文件的内容使用“修补”的 IOR
您可以使用 IOR 解析器 来检查结果IOR 并将其与原始 IOR 进行比较
Use the FixIOR tool (binary) from jacORB to patch the address and port of an IOR. Download the binary (unzip it) and run:
The tool will override the content of the IOR file with the 'patched' IOR
You can use IOR Parser to check the resulting IOR and compare it to your original IOR
使用此功能可以更改 IOR。传递字符串化 IOR 作为第一个参数。
希望这对你有用。
Use this function to change the IOR. pass stringified IOR as first argument.
Hope this works for you.