Problem:
- Product: VisiBroker for Java & C
 - Product Version: 4.5 & 6.5
 - Product Component: Code Set Support
 - Platform/OS Version: All
 
The following code snippet is an illustration on how to retrieve an IOR from the Naming Service. It works in VBC version 4.5 but fails in 6.5.
std::string sNShost; // NS host int iNSport; // NS port char ior_str[MAXBUF] ior_str //contains valid ior string checked with the printIOR utility .... .... IOP::IORValue_var iorv = VISUtil::to_ior((const char*)ior_str); IIOP::ProfileBodyValue_ptr body = VISUtil::get_iiop_body(iorv); //get the NS host sNShost = body->host(); //get the NS port iNSport = body->port();
iorv gives -1 in the debugger watch and the code starts failing thereafter. Using the printIOR command on the IOR of a VB 4.5 CORBA Server object, you would notice that the key_string part is missing. The key_string is the object key Id that is part of a standard CORBA IOR. From VisiBroker version 6.5 and later, Object key id is used by the client to contact Server object successfully.
The printIOR content of a version 4.5 IOR
Interoperable Object Reference:
 Type ID: IDL:
 Contains 1 profile.
 Profile 0-IIOP Profile:
 version: 1.2
 host: 192.168.4.37
 port: 45403
 Object Key: ServiceId[service=/CONTEXT_POAMaster,id={1 bytes: [2]
 VB Capability component:
 ORB_TYPE Component: VBJ 4.x
 Code Sets Component: native char codeset:ISO 8859_1
 conversion_code_sets: ISO UTF-8, native wchar codeset:ISO UTF-16
 conversion_code_sets:
The printIOR content of a version 6.5 IOR
Interoperable Object Reference:
 Type ID: IDL:
 Contains 1 profile.
 Profile 0-IIOP Profile:
 version: 1.2
 host: 192.168.4.37
 port: 48603
 Object Key: ServiceId[service=/CONTEXT_POAMaster,id={1 bytes:[2,key_string=PMC/CONTEXT_POAMaster 2]
 VB Capability component:
 ORB_TYPE Component: VBJ 4.x
 Code Sets Component: native char codeset:ISO 8859_1
 conversion_code_sets: ISO UTF-8, native wchar codeset:ISO UTF-16
 conversion_code_sets: 
Root Cause
1. Difference in code set negotiation support between VBC 6.5 and VBJ 4.5.
Earlier versions including VBJ 4.5 were not CORBA compatible with respect to code set support. From version 6.0 onwards, code set support was made CORBA compliant. (please refer to the following article that gives more information on code sets: Information about Unicode).
2. Limitations of VisiBroker 4.5.
- The wide strings in VBC 4.5 are UTF-16 but encoding of wstring is incorrect (i.e. is not GIOP1.2 compliant).
 - Though CORBA 2.3 Code Set Negotiation is supported in VBJ 4.5 but wchar and wstring types are not marshaled according to CORBA 2.3 spec and might not be interoperable with other CORBA implementations. The marshaling of CORBA wchar and wstring types assumes wchar_t to be 2-byte in length (Please refer to the printIOR ouputs).
 
3. There is a difference in conversion code sets supported in VBC and VBJ IOR.
The VBJ (from versions 4.5) supports UTF-8 conversion code set, whereas VBC do not. Please refer to the latest release notes in VisiBroker 8.5 for further details.
Resolution:
The following two properties needs to be set at the client side as a workaround for above.
 
 a. vbroker.orb.embedCodeset=false
 
 When an IOR is created, the ORB embeds the codeset components into the IOR. This may produce problems with some non-compliant ORBs. By turning off the embedCodeset property, one can instruct the Visibroker ORB not to embed codesets in IORs. When set to false, it specifies that character and wide character conversions between the client and the server are not to be negotiated.
 
 b. vbroker.orb.enableVB4backcompat=true
 This property enables workarounds to deal with behavior that is not GIOP 1.2- compliant in VisiBroker 4.x. In a multi-vendor environment with GIOP 1.2- compliant ORBs when wchar/wstring data types are transmitted, this flag needs to be set to false.
Related Information: Borland VisiBroker 8.5 Release Notes.
 
#Security
#VisiBroker