RE: Problem when converting IOR to object reference



Hi Frank,

Here you got the IOR and the output from ior-decode-2:

[johan@batman johan]$ ior-decode-2
IOR:000000000000003e49444c3a73652f666f692f666c65782f6170706c2f6164617074
6572696e746572666163652f70726f78792f416461707465725365727665723a312e3000
000000000001000000000000006c000102000000000e3139322e3136382e302e31303000
0d4400000021afabcb0000000020ec62913d000000010000000000000000000000040000
00000a000000000000010000000100000020000000000001000100000002050100010001
0020000101090000000100010100

** (process:9720): WARNING **: Ignoring incoming code_sets component
Object ID: IDL:se/foi/flex/appl/adapterinterface/proxy/AdapterServer:1.0
IOP_TAG_INTERNET_IOP: GIOP 1.2 192.168.0.100:3396
    object_key (33)
'afabcb0000000020ec62913d00000001000000000000000000000004000000000a'
    Unknown component 0x1


Many thanks

/Johan


> -----Original Message-----
> From: Frank.Rehberger@web.de [mailto:Frank.Rehberger@web.de]
> Sent: Tuesday, January 06, 2004 11:04
> To: Johan Antonsson
> Cc: orbit
> Subject: Re: Problem when converting IOR to object reference
> 
> 
> please attach IOR returned by
> 
> getReference(host, &objref) != 0) {
> 
> Did you try to decode IOR with tool "ior-decode-2"?
> Please attach output.
> 
> Regards, Frank
> 
> 
> Johan Antonsson wrote:
> 
> >Hi all,
> >
> >Hope someone can help me with this newbie question/problem.
> >
> >I'm using Orbit2 when implementing an API that misc applications can
use
> to invoke operations on a server application running on another
machine in
> a LAN. Client platform is Linux RedHat 8. Server platform is Windows
2000
> and Suns Java ORB JDK1.4.2. I'm getting an IOR via a normal socket
> connection with the server and then I try to convert it to an object
> reference by using CORBA_ORB_string_to_object() but end up with the
> exception IDL:omg.org/CORBA/MARSHAL:1.0 instead. I'm having problem
> figuring out the cause of this problem. My IOR is retrieved
successfully.
> The ORB seem to initialize ok. I know I have to enable remote
invocations
> since they are disabled by default so I placed the following lines in
> /etc/orbitrc as suggested in the beginners documentation:
> >
> >ORBIIOPUSOCK=1
> >ORBIIOPIPv4=1
> >ORBIIOPIPv6=0
> >
> >Here some code that shows what I'm doing:
> >
> >adapter.h
> >=========
> >
> >// Return value constants
> >#define SUCCESS 0
> >#define SYSTEM_EXCEPTION 1
> >#define SERVER_EXCEPTION 2
> >#define LOGON_EXCEPTION 3
> >#define SEARCH_EXCEPTION 4
> >#define FLEX_EXCEPTION 5
> >#define TIMEOUT_EXCEPTION 6
> >
> >/**
> > * Function used to initialize the adapter and logon to the server
> > * On success the return value is SUCCESS.
> > * On failure the return value is one of the following values:
> > * SERVER_EXCEPTION = failed to get a reference to the adapterserver
> > * LOGON_EXCEPTION = the logon failed.
> > */
> >int adapter_init(char *host, char *username, char *password);
> >
> >
> >
> >adapter.c
> >=========
> >
> >#include <assert.h>
> >#include <signal.h>
> >#include <string.h>
> >#include <stdio.h>
> >#include <stdlib.h>
> >#include <orbit/orbit.h>
> >
> >#include "adapter.h"
> >#include "AdapterServer.h"
> >#include "referenceutil.h"
> >
> >static CORBA_ORB orb = CORBA_OBJECT_NIL;
> >static CORBA_Environment env;
> >static CORBA_char *session_key;
> >static appl_adapterinterface_proxy_AdapterServer adapterserver =
> CORBA_OBJECT_NIL;
> >
> >int adapter_init(char *host, char *username, char *password) {
> >  // Declare the std arguments
> >  int argc = 1;
> >  char *argv[1];
> >  CORBA_char *objref = NULL;
> >  CORBA_Object obj = CORBA_OBJECT_NIL;
> >
> >  // Initialize exception handling
> >  CORBA_exception_init(&env);
> >
> >  // Initialize ORB
> >  orb = CORBA_ORB_init(&argc, argv, "orbit-local-orb", &env);
> >  if (env._major != CORBA_NO_EXCEPTION) {
> >    g_error(CORBA_exception_id (&env));
> >    CORBA_exception_free (&env);
> >    return SYSTEM_EXCEPTION;
> >  }
> >
> >  // Getting IOR
> >  #ifdef _DEBUG
> >  g_print ("Reading service reference from socket\n");
> >  #endif
> >
> >  if (getReference(host, &objref) != 0) {
> >    g_print("Failed to get object reference\n");
> >    return SYSTEM_EXCEPTION;
> >  }
> >
> >  // Convert IOR to object reference
> >  #ifdef _DEBUG
> >  g_print ("Convert IOR to object. IOR is %s\n", objref);
> >  #endif
> >
> >  // This is where I run into problem and get exception
> IDL:omg.org/CORBA/MARSHAL:1.0
> >  obj = (CORBA_Object)CORBA_ORB_string_to_object (orb, objref, &env);
> >  if (env._major != CORBA_NO_EXCEPTION) {
> >    g_error(CORBA_exception_id (&env));
> >    CORBA_exception_free (&env);
> >    return SYSTEM_EXCEPTION;
> >  }
> >
> >  free(objref);
> >
> >  #ifdef _DEBUG
> >  g_print("Cast object to adapterserver\n");
> >  #endif
> >
> >  adapterserver = (appl_adapterinterface_proxy_AdapterServer)obj;
> >
> >  // Logon to adapter server
> >  #ifdef _DEBUG
> >  g_print ("Logon on to FLEX\n");
> >  #endif
> >
> >  session_key =
> appl_adapterinterface_proxy_AdapterServer_logon(adapterserver,
username,
> password, &env);
> >  if (env._major == CORBA_SYSTEM_EXCEPTION) {
> >    g_error(CORBA_exception_id (&env));
> >    CORBA_exception_free (&env);
> >    return SYSTEM_EXCEPTION;
> >
> >  } else if (env._major == CORBA_USER_EXCEPTION && \
> >	     !strncmp (ex_appl_adapterinterface_except_C_LogonException,
\
> >		       CORBA_exception_id (&env), strlen
> (ex_appl_adapterinterface_except_C_LogonException))) {
> >    g_error(CORBA_exception_id (&env));
> >    CORBA_exception_free (&env);
> >    return LOGON_EXCEPTION;
> >  }
> >
> >  #ifdef _DEBUG
> >  g_print ("Session key is %s \n", session_key);
> >  #endif
> >
> >  return SUCCESS;
> >}
> >
> >
> >
> >I build my lib (shared object) using the following makefile:
> >
> >PREFIX ?= /usr
> >CC = gcc
> >TARGETS=lib
> >ORBIT_IDL=$(PREFIX)/bin/orbit-idl-2
> >CFLAGS=-O -Wall -fpic -DORBIT2=1 -D_REENTRANT
-I$(PREFIX)/include/orbit-
> 2.0 \
> >       -I$(PREFIX)/include/linc-1.0 -I$(PREFIX)/include/glib-2.0 \
> >       -I$(PREFIX)/lib/glib-2.0/include -g -D_DEBUG
> >LDFLAGS= -Wl,--export-dynamic -L$(PREFIX)/lib -lORBit-2 -llinc
-lgmodule-
> 2.0 \
> >             -ldl -lgobject-2.0 -lgthread-2.0 -lpthread -lglib-2.0
-lm
> \
> >             -lORBitCosNaming-2
> >
> >IDLOUT=AdapterServer-common.c AdapterServer-stubs.c AdapterServer.h
> >
> >all: $(IDLOUT) api lib
> >
> >api: adapter.o referenceutil.o AdapterServer-stubs.o AdapterServer-
> common.o
> >
> >$(IDLOUT): AdapterServer.idl
> >	$(ORBIT_IDL) --noskels  AdapterServer.idl
> >
> >lib: api
> >	$(CC) -o libadapter.so -shared flexadapter.o referenceutil.o
> AdapterServer-common.o \
> >                 AdapterServer-stubs.o $(LDFLAGS)
> >
> >clean:
> >	rm -rf *.o *~ $(IDLOUT)
> >
> >distclean: clean
> >	rm -rf libadapter.so
> >
> >
> >
> >What am I doing wrong? Any suggestions on how I should approach this
> problem?
> >
> >Thanks in advance
> >
> >Regards
> >
> >/Johan
> >
> >-------------------------------------------------
> >Johan Antonsson        johan.antonsson@ibitec.se
> >-------------------------------------------------
> >
> >
> >_______________________________________________
> >orbit-list mailing list
> >orbit-list@gnome.org
> >http://mail.gnome.org/mailman/listinfo/orbit-list
> >
> >
> 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]