[omniORB]---pass CORBA::wstring parameter in function defined in IDL

Haipeng haipeng.jiang at combuilder.com.sg
Mon Jun 26 17:09:28 BST 2006


Could you tell me which way can solve this problem, if I replace the
"corbaloc: URL" strategy? 

 

Here is the orginal code:

 

Server side; ProcessManager is the servant class

ProcessManager::ProcessManager()

{

    // Build up the set of runtime parameters that will be passed to
registering

    // processes

    RunParams::getInstance().getAll(m_defaultParams);

    tcout << _T("\nRunParams:\n");

    for (unsigned int i = 0; i < m_defaultParams.size(); i++)

    {

        RunParams::getInstance().registerRunParamUser(this,
m_defaultParams[i].name.c_str());

        tcout << _T("   ") << m_defaultParams[i].name << _T("=") 

            << m_defaultParams[i].value << _T("\n");

    }

    tcout << _T("\n\n");

    // Give this object a user-friendly key, so that the managed process can

    // access it using a URL-style IOR

    // (eg _T("corbaloc::localhost:6666/ProcessManager"))

    // See section 6.4.1 _T("corbaloc: URLs") in the ORBacus manual

    CorbaUtil::getInstance().setServantKey(this, _T("ProcessManager"));

    activateServant();

 

}

 

Client side:

 

 tostringstream ior;

 ior << _T("corbaloc::localhost:") << port << _T("/ProcessManager");

 RunParams::getInstance().set(_T("ProcessManagerIor"), ior.str().c_str());

 CORBA::Object_var obj;

 obj = CorbaUtil::getInstance().stringToObject(ior.str());

 if (!CORBA::is_nil(obj))

 {

     m_ProcessManager = IProcessManagerCorbaDef::_narrow(obj);

 }

 if (CORBA::is_nil(m_ProcessManager))

 {

     TA_THROW( ManagedProcessException(_T("Failed to narrow to the Process
Manager")) );

 }

 

Thanks.

 

Haipeng

 

-----Original Message-----
From: Luke Deller [mailto:ldeller at xplantechnology.com] 
Sent: Monday, June 26, 2006 2:47 PM
To: Haipeng
Cc: omniorb-list at omniorb-support.com
Subject: RE: [omniORB]---pass CORBA::wstring parameter in function defined
in IDL

 

Hi Haipeng,

 

> In our real application, I defined an interface which has a

> function to pass the wstring, but the client throws an exception

> "BAD_PARAM_WCharTCSNotKnown" when it called the server.

 

There are different ways that a wstring can be encoded for communication

between ORBs.  This exception is raised by the client ORB when it cannot

determine what encoding is expected by the server ORB.  Usually this

happens when your object reference did not come from the server ORB (eg

if you used a corbaloc: URL).

 

So if you want to pass a wstring to an object, then get your object

reference from a factory object or name service.

 

Regards,

Luke.

 

****************************************************************************
******************

 

Important Note

This email (including any attachments) contains information which is

confidential and may be subject to legal privilege.  If you are not

the intended recipient you must not use, distribute or copy this

email.  If you have received this email in error please notify the

sender immediately and delete this email. Any views expressed in this

email are not necessarily the views of XPlan Technology.

 

It is the duty of the recipient to virus scan and otherwise test the

information provided before loading onto any computer system.

Xplan Technology does not warrant that the

information is free of a virus or any other defect or error.

****************************************************************************
******************

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20060626/0286aa55/attachment-0001.htm


More information about the omniORB-list mailing list