4 #include "tao/DynamicInterface/Request.h" /* This must come first for
6 #include "DII_ReplyHandler.h"
7 #include "tao/AnyTypeCode/Any.h"
8 #include "tao/AnyTypeCode/Any_Impl.h"
10 DII_ReplyHandler::DII_ReplyHandler (bool &reply_notifier
)
11 :got_reply_(reply_notifier
)
15 DII_ReplyHandler::~DII_ReplyHandler ()
21 DII_ReplyHandler::handle_response (TAO_InputCDR
&incoming
)
23 this->got_reply_
= true;
24 CORBA::String_var result
;
27 if (incoming
>> result
.inout())
28 ACE_DEBUG ((LM_DEBUG
,"Got response: %C\n",result
.in()));
30 ACE_ERROR ((LM_ERROR
,"ERROR: Response is not a string!\n"));
32 catch (const CORBA::SystemException
&ex
)
35 "ERROR: DII_ReplyHandler::handle_response caught %C\n",
41 "DII_Reply_Handler::handle_response Unknown Exception\n"));
47 DII_ReplyHandler::handle_excep (TAO_InputCDR
&incoming
,
48 CORBA::ULong reply_status
)
50 TAO_InputCDR
for_reading (incoming
);
52 if ((for_reading
>> id
.inout()) == 0)
55 "DII_ReplyHandler::handle_excep could not extract id\n"));
59 if (reply_status
== TAO_AMI_REPLY_USER_EXCEPTION
)
62 "DII_ReplyHandler::handle_excep got user ex = %C\n",
65 else if (reply_status
== TAO_AMI_REPLY_SYSTEM_EXCEPTION
)
67 CORBA::ULong minor
= 0;
68 CORBA::ULong completion
= 0;
70 if ((for_reading
>> minor
) == 0
71 || (for_reading
>> completion
) == 0)
74 "DII_ReplyHandler::handle_excep could not "
75 "extract system ex minor code or completion\n"));
80 "Got system exception: %C, minor = %d, completed = %d\n",
81 id
.in(), minor
, completion
));
88 "Got an exception that is neither user nor system. "
89 "reply_status = %d\n",reply_status
));
94 DII_ReplyHandler::handle_location_forward (TAO_InputCDR
&incoming
,
95 CORBA::ULong reply_status
)
97 TAO_InputCDR
for_reading (incoming
);
98 CORBA::Object_var fwd
;
99 if ((for_reading
>> fwd
) == 0)
105 ACE_TCHAR
**argv
= 0;
106 CORBA::ORB_var orb
= CORBA::ORB_init(argc
,argv
);
108 CORBA::String_var iorstr
= orb
->object_to_string(fwd
.in ());
110 bool is_perm
= reply_status
== TAO_AMI_REPLY_LOCATION_FORWARD_PERM
;
111 ACE_DEBUG ((LM_DEBUG
,
112 "DII_ReplyHandler::handle_location_forward"
113 " got %C, is_perm = %b\n",
114 iorstr
.in() ,is_perm
));
116 CORBA::Request_var req
= fwd
->_request ("do_forward");
117 CORBA::String_var test_string
= CORBA::string_dup ("123 look at me");
118 req
->add_in_arg ("text") <<= CORBA::Any::from_string(test_string
.in(),30);