Skip to main content

Problem

  • Product Name: VisiBroker for Java
  • Product Version: 7.0
  • Product Component: idl2wsj, idl2java
  • Platform/OS Version: ALL

When generating Java bridge from IDL using "idl2wsj" in VisiBroker7.0, the generated java bridge code can not be compiled if the IDL is using struct as a parameter of method of an interface and the struct is defined in the global namespace of the IDL.

To reproduce scenario, please do the following:

  1. Generate web service bridge code by : idl2wsj -gen_java_bridge -encoding_soap_only simple.idl
  2. Compile java code generated under simple dir by: vbjc simple/*.java

In step2, Java compiler will generate the following error messages:

simple\\ErrorMsgHelper.java:58: Undefined Symbol
Symbol: class extract(org.omg.CORBA.Any)
place: package simple.ErrorMsgHelper
ErrorMsg _vis_input_value = ErrorMsgHelper.extract(any);

Resolution

There is currently a limitation in the idl2java and idl2wsj compilers if the struct is specified in the global namespace on the IDL. The way to work around this issue is to specify a module on your IDL, for example, base_class.idl and also modify your simple.idl to resolve this issue.
 
base_class.idl:

Before modification of IDL:


#ifndef __BASE_CLASS_IDL__
#define __BASE_CLASS_IDL__
struct ErrorMsg
{
...
#endif



After modification of IDL:


#ifndef __BASE_CLASS_IDL__
#define __BASE_CLASS_IDL__

module test{
struct ErrorMsg

{
...
};
#endif


 
simple.idl:

Before modification of IDL:


...
long misc (
out ErrorMsg sErrorMsg
);
...


After modification of IDL:


...
long misc (
out ::test::ErrorMsg sErrorMsg
);

...



To compile it, please do the following steps:

  1. idl2java base_class.idl - generate base_class helpers and holders and also the IIOP serialization stubs
  2. idl2java simple.idl - generate simple helpers and holders and also the IIOP serialization stubs
  3. idl2wsj -gen_java_bridge -encoding_soap_only base_class.idl - generate the soap bridge to communicate to axis to accept incoming soap messages
  4. idl2wsj -gen_java_bridge -encoding_soap_only simple.idl - generate the soap bridge to communicate to axis to accept incoming soap messages
  5. vbjc simple/*.java - compile generated code


#module
#VisiBroker
#struct
#webservice
#idl2wsj
#Security