我有一些使用Omniorb连接到corba服务器的Python代码,一切正常.
现在,我希望能够通过创建ssh隧道连接到防火墙后面的服务器,但它无法正常工作.
据我所知,从wireshark跟踪,服务器将我重定向到它的IP地址 - 这当然是我无法达到的本地网络地址.
有没有办法处理这个并告诉服务器不要重定向我的客户端?我无法修改服务器,也无法更改其IP等.或者我可以修改我的客户端以伪造它的连接,以便服务器接受它吗?
我有这样的事:
User.idl:
#ifndef __USER_IDL__
#define __USER_IDL__
interface Group;
interface User
{
typedef sequence<Group> Groups;
Groups getGroups();
void setGroups(in Groups g);
};
#endif
Run Code Online (Sandbox Code Playgroud)
UserImpl.h和UserImpl.cpp:
class UserImpl : public POA_User
{
private :
User::Groups groups;
public :
User::Groups* getGroups();
void setGroups(const ::User::Groups& g);
};
#endif
#include "UserImpl.h"
User::Groups* UserImpl::getGroups()
{
return &(this->groups);
}
void UserImpl::setGroups(const ::User::Groups& g)
{
this->groups.length(g.length());
for(int i=0; i<g.length(); i++)
{
this->groups[i] = this->groups[i];
}
}
Run Code Online (Sandbox Code Playgroud)
和Group.idl:
#ifndef __GROUP_IDL__
#define __GROUP_IDL__
#include "User.idl"
interface Group
{
typedef sequence<User> Users; …Run Code Online (Sandbox Code Playgroud) 我正在使用omniORB和C++.
在我的应用程序中,我得到了几个不同模块的小CORBA序列,然后我需要将它们组合成一个大序列以进行进一步处理.有这么简单的方法吗?像seq2.append(seq1)或的东西seq2.push_back(seq1).还是一些运营商?(我真的是STL-things的新手).
我发现的唯一方法是手动遍历小序列的每个元素并将其添加到大序列中.
//idl
struct Device;
typedef sequence<Device> DevicesList;
//c++
icore::DevicesList full_list;
foreach (const DStatusList &stlist, states_) {
icore::DevicesList list = convertList(stlist);
int newlength = full_list.length() + list.length();
int last_index = full_list.length();
full_list.length(newlength);
int j=0;
for(int i=last_index; i< last_index+list.length(); i++,j++) {
full_list[i] = list[j];
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
我有一个C++ CORBA服务器,它实现了抛出用户定义的异常的接口.
当客户端和服务器都在C++中实现时(使用TAO orb和omniORB进行测试),我很容易捕获到特定的异常.
但是当我从Erlang(使用orber)调用相同的方法时,异常显示为一般异常,而不是特定的用户定义异常.
为了测试这个,我只使用了一个简单的IDL -
interface Messenger {
exception cirrus_error{
short error_code;
string error_desc;
};
boolean send_message(in string user_name,
in string subject,
inout string message) raises (cirrus_error);
};
Run Code Online (Sandbox Code Playgroud)
如果服务器和客户端都在C++中 - 我得到的异常是(对于测试我将其编码为始终抛出用户异常)
CORBA exception: cirrus_error (IDL:Messenger/cirrus_error:1.0)
Run Code Online (Sandbox Code Playgroud)
但是当通过Erlang调用时 - 我得到了 -
** exception throw: {'EXCEPTION',{'UNKNOWN',[],1330446337,'COMPLETED_MAYBE'}}
in function corba:raise/1
Run Code Online (Sandbox Code Playgroud)
在说明Orber应用程序以启用正确行为时,是否需要执行一些特殊操作?
编辑 - 这是我从erlang调用服务器的方式 -
在Erlang提示符下,这就是我所做的 -
1> orber:jump_start().
2> O = corba:string_to_object(IORStr).
3> 'Messenger':send_message(O, "s", "t", "f").
** exception throw: {'EXCEPTION',{'UNKNOWN',[],1330446337,'COMPLETED_MAYBE'}}
in function corba:raise/1
Run Code Online (Sandbox Code Playgroud) 我有这样的代码:
interface Employee
{
string getLastname();
};
#include "Employee.idl"
interface Work
{
Employee getEmployee(in short id);
};
Run Code Online (Sandbox Code Playgroud)
服务器文件:
#include "Employee.hh"
class EmployeeImpl : public POA_Employee
{
private:
char* lastname;
int id;
public:
EmployeeImpl(const char* lastname, int id);
char* getLastname();
};
#include "EmployeeImpl.h"
EmployeeImpl::EmployeeImpl(const char* lastname, int id)
{
this->lastname = const_cast<char*>(lastname);
this->id = id;
}
char* EmployeeImpl::getLastname()
{
return this->lastname;
}
#include "Work.hh"
#include <vector>
#include "EmployeeImpl.h"
using namespace std;
class WorkImpl : public POA_Work
{
private:
vector<EmployeeImpl> employees;
public: …Run Code Online (Sandbox Code Playgroud)