[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mico-support
Subject:    Any Type problem between MICO & JacORB
From:       Lina Droukman <lina.droukman () str ! com ! au>
Date:       2000-07-10 8:11:32
[Download RAW message or body]


Hi all!

I am having a problem with Any type. It does not work properly between
JacORB & MICO.

I have Java with Jacorb1_1 on the client side and Visual C++ with MICO 2.3.3
on the server side. I am transfering an Any object (it's a string) to the
Server. Then try to convert it into C++ char*. That does not work. I am not
sure if it's a problem with MICO  or JacORB. Exactly the same thing works OK
when I replace JacORB with JDK 1.2.2 ORB.

Anyone had a similar problem?? 
Thanks!

Here is a some of my code:

IDL:

#ifndef AnyTest_IDL
#define AnyTest_IDL


interface IAnyTest
{
    void TransferAnyToServer(in any AnyValue);
   any GetAnyFromServer();	
}; 

#endif

Implementation of _skel:

#include "anytest_impl.h"
#include "anytest.h"

CAnyTest_impl::CAnyTest_impl()
{
}

void CAnyTest_impl::TransferAnyToServer( const CORBA::Any& AnyValue )
{
    char* StringValue;
    bool success = AnyValue >>= StringValue;				//
success is false, it does not work with Jacorb!  but it does work with JDK's
ORB 
    stl::cout << "success:" << success << "String Value:" << StringValue <<
stl::endl;
}

CORBA::Any* CAnyTest_impl::GetAnyFromServer()
{
    stl::tstring ServerString = "aaa";
    CORBA::Any* corbaAny = new CORBA::Any();
    *corbaAny <<= CORBA::string_dup(ServerString.c_str());
    return corbaAny;
}

Client code

	IAnyTest AnyTestObject =
                IAnyTestHelper.narrow((org.omg.CORBA.Object) ServerObj);
            	Any ServerAny = AnyTestObject.GetAnyFromServer();
// get's "aaa" string in a form of any;

            	String StringAny = new String(ServerAny.extract_string());
// extracts string out of it - look's fine

            	AnyTestObject.TransferAnyToServer(ServerAny);
// transfers that same any back to the server, it will not come out right
            	System.out.println(StringAny);

Lina Droukman
Software Engineer
Space-Time Research Pty Ltd
Ph:    +61 3 9805 3400 Dir: +61 3 9805 3433
Fax:   +61 3 9889 9420
Email:  lina.droukman@str.com.au 
http://www.str.com.au

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic