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:
- Generate web service bridge code by : idl2wsj -gen_java_bridge -encoding_soap_only simple.idl
- 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:
- idl2java base_class.idl - generate base_class helpers and holders and also the IIOP serialization stubs
- idl2java simple.idl - generate simple helpers and holders and also the IIOP serialization stubs
- idl2wsj -gen_java_bridge -encoding_soap_only base_class.idl - generate the soap bridge to communicate to axis to accept incoming soap messages
- idl2wsj -gen_java_bridge -encoding_soap_only simple.idl - generate the soap bridge to communicate to axis to accept incoming soap messages
- vbjc simple/*.java - compile generated code
#module
#VisiBroker
#struct
#webservice
#idl2wsj
#Security