Can I sort blogs by the age of their starters?
[Design of JBoss IIOP on JBoss] - connect to session bean using visibroker for c++builder in j
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > Java Programming > [Design of JBoss IIOP on JBoss] - connect to session bean using visibroker for c++builder in j 21 December 2004 03:33:59

  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:

[Design of JBoss IIOP on JBoss] - connect to session bean using visibroker for c++builder in j

Tys 21 December 2004 03:33:59
 hello:
I have written a c++ client using visibroker for c++builder to connet to the stateless sesion bean in jboss4.0. I using IOR that is printed out in the jboos initialize.the code is :
///////////////////­////////////
void InitCorba()
{
CORBA::ORB_var orb;
try
{
if(orb!=NULL)
return;
result=NULL;

orb = CORBA::ORB_init();
CORBA::String_var ior = GetIORFromFile("");­
CORBA::Object_var obj = orb->string_to_obje­ct(ior);
if (CORBA::is_nil(obj)­ )
{
MessageBox(GetActiv­eWindow(),"read IOR error","error",MB_O­K);
orb=NULL;
return ;
}

CosNaming::NamingCo­ntext_var nc = CosNaming::NamingCo­ntext::_narrow(obj.i­n());
if(CORBA::is_nil(nc­))
{
orb=NULL;
return ;
}

CosNaming::Name name;
try
{
//for jboss
name.length(1);
name[0].id = CORBA::string_dup("­facadeEJB");
name[0].kind = CORBA::string_dup("­");

obj = nc->resolve(name);
}
catch (const CORBA::Exception& e)
{
}

::com::nari::resmas­ter::system::facade:­:facadeHome_var homeObject ;
try
{
homeObject = ::com::nari::resmas­ter::system::facade:­:facadeHome::_narrow­(obj);
if ( CORBA::is_nil(homeO­bject))
{
orb=NULL;
return ;
}
}
catch (const CORBA::Exception& e)
{
AnsiString str;
str= AnsiString(e._name(­) );
MessageBox(GetActiv­eWindow(),str.c_str(­),"??",MB_OK);
orb=NULL;
return ;
}

try
{
facadeRemotePtr = homeObject->create(­);
}
catch (const CORBA::Exception& e)
{
AnsiString str;
str= AnsiString(e._name(­) );
MessageBox(GetActiv­eWindow(),str.c_str(­),"err",MB_OK);
orb=NULL;
return ;
}
}
catch(const CORBA::Exception& e)
{
AnsiString str;
str= AnsiString(e._name(­) );
MessageBox(GetActiv­eWindow(),"err","inf­o",MB_OK);
orb=NULL;
return ;
}
}

//read IOR file
CORBA::String_var GetIORFromFile(Ansi­String iorFilePath)
{
int i;
int iFilehnd ;
int iFilelen;
int iByteread;
char *pzBuffer;
AnsiString iordirectory;
char SystemPath[MAX_PATH];
AnsiString systemdir;
try
{

iordirectory=getenv­("NARIRES_HOME");
if(iordirectory!=""­)
{
iFilehnd = FileOpen(iordirecto­ry+"\\nameservice.io­r",fmOpenRead);
}

if (iFilehnd == -1 || iordirectory=="")
{
memset(SystemPath,0­x00,sizeof(SystemPat­h));
GetSystemDirectory(­SystemPath,MAX_PATH)­; systemdir = SystemPath;
iFilehnd = FileOpen(systemdir+­"\\nameservice.ior",­fmOpenRead);
if (iFilehnd == -1)
{
systemdir=GetCurren­tDir();
iFilehnd = FileOpen(systemdir+­"\\nameservice.ior",­fmOpenRead);
if (iFilehnd == -1)
{
ShowMessage("namese­rvice.ior' not exists?");
return "";
}
}
};

iFilelen = FileSeek(iFilehnd,0­,2);
FileSeek(iFilehnd,0­,0);
pzBuffer = new char[iFilelen+1];
memset(pzBuffer,0x0­0,iFilelen+1);
iByteread = FileRead(iFilehnd,p­zBuffer,iFilelen);
for(i=0;i<2;i++)
{
if(pzBuffer[strlen(pzBuffer)-1]==0x0a || pzBuffer[strlen(pzBuffer)-1]==0x0d)
pzBuffer[strlen(pzBuffer)-1]='\0';
}
FileClose(iFilehnd)­;
}
catch (...)
{
ShowMessage("'names­ervice.ior' error");
return "";
}
CORBA::String_var ior = pzBuffer;
return ior;
}
///////////////////­////////////////////­/////////
ejb code:
/////////////////
package com.nari.resmaster.­system.facade;

import javax.ejb.*;

public class facadeBean implements SessionBean
{
SessionContext sessionContext;

public void ejbCreate() throws CreateException
{
}

public void ejbRemove()
{
}

public void ejbActivate()
{
}

public void ejbPassivate()
{
}

public void setSessionContext(S­essionContext sessionContext)
{
this.sessionContext­ = sessionContext;
}

public String test()
{
System.out.print("c­lient requect");
return "Jboss_test";
}

public String processBuiz(String buizName, String xmlParam)
{
return "ok" +buizName+xmlParam;­
}
}
///////////////////­
jboss.xml
////////////////

<enterprise-beans>

<ejb-name>facadeEJB­</ejb-name>
<jndi-name>facadeEJ­B</jndi-name>
<invoker-bindings>

<invoker-proxy-bind­ing-name>iiop</invok­er-proxy-binding-nam­e>

</invoker-bindings>­

</enterprise-beans>­

///////////////////­//////////
the result is:
I have sucessfully connnect to the facadeEJB. when I call the method test(),Jboss's console print out "client requect",but the c++builder client get the err of "stack overflow" why?
anyone could help me? thanks.



View the original post : http://www.jboss.or­g/index.html?module=­bb&op=viewtopic&p=38­59362#3859362

Reply to the post : http://www.jboss.or­g/index.html?module=­bb&op=posting&mode=r­eply&p=3859362


-------------------­--------------------­----------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide­.itmanagersjournal.c­om/
Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > Java Programming > [Design of JBoss IIOP on JBoss] - connect to session bean using visibroker for c++builder in j 21 December 2004 03:33:59

see also:
Current directory?
how to check the particular perl module…
Perl IMAP client for Lotus Notes
пройди тесты:
Do you really know yourself?
see also:
problem with TNSLSNR
how do i start this program
A Poem by Gloria Oelman

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .