Dynamically built exceptions in DSI requests

Dynamically built exceptions in DSI requests

Post by paul.rosin » Sat, 15 Nov 2003 21:19:33


Hi,

I am trying to re-create dynamically an exception to be returned from
a DSI request. I am using a DynStruct to construct the exception. The
client gets a marshalling exception instead of the appropriate
UserException. I have pasted below the relevant code. I can't figure
out what am I doing wrong. Any suggestions are appreciated.

Thanks,

Paul Rosinger

IDL:

interface DynImplTest{

exception TestException{
long msgID;
string msg;
};
}


public void invoke(org.omg.CORBA.ServerRequest request){

...

org.omg.CORBA.TypeCode tcp =
org.omg.CORBA.ORB.init()
.create_exception_tc(
"IDL:DynImplTest/TestException:1.0",
"TestException",
new org.omg.CORBA.StructMember[]{
new org.omg.CORBA.StructMember(
"msgID",
org.omg.CORBA.ORB.init()
.get_primitive_tc(org.omg.CORBA.TCKind.from_int(3)),
null),
new org.omg.CORBA.StructMember(
"msg",
org.omg.CORBA.ORB.init()
.create_string_tc(0),
null)});



org.omg.DynamicAny.DynAny m_dyn = null;
try{
m_dyn = dynFact.create_dyn_any_from_type_code (tcp);
}
catch (org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode
e){
System.out.println("Inconsistent TypeCode!");
}

org.omg.CORBA.Any a1 = orb.create_any();
a1.insert_long (1);
org.omg.CORBA.Any a2 = orb.create_any();
a2.insert_string ("kjsdbfkdjbfkjsa");

org.omg.DynamicAny.NameValuePair[] value = new
org.omg.DynamicAny.NameValuePair[]{new
org.omg.DynamicAny.NameValuePair ("msgID",a1), new
org.omg.DynamicAny.NameValuePair ("msg",a2)};

org.omg.DynamicAny.DynStruct ds = (org.omg.DynamicAny.DynStruct)
m_dyn;
ds.set_members(value);

request.set_exception( ds.to_any() );


} // invoke end


(3108|2580) EXCEPTION, Exception:
system exception, ID 'IDL:omg.org/CORBA/MARSHAL:1.0'
TAO exception, minor code = 0 (unknown location; unspecified errno),
completed
NO
 
 
 

1. Dynamically built exceptions in DSI requests

2. Trying to build the Formula String Dynamically Raises Exception in

Environment:
WinXP SP2
Office 2003 + PIA
VS.Net 2003
.Net 1.1 + SP

Background:
This works perfectly fine in VBA
Range("A9").Select

Dim aa As String
Dim bb As String
bb = "Magic"
aa = "=COUNTIF(R[-7]C:R[-1]C,""" + bb + """)"
ActiveCell.FormulaR1C1 = aa


Output:=COUNTIF(A2:A8,"Magic")


Problem:
In C# this raises exception:
Range r1 =
((Worksheet)m_OfficeExApp.Sheets["Results"]).get_Range("A1000","A1000");
r1.Select();

//Make String
StringBuilder szSearch = new
StringBuilder("=COUNTIF(RangeName,\"=Criteria\")");
szSearch.Replace("RangeName","Nero");
szSearch.Replace("Criteria","Passed");

Exception:
Unhandled Exception: System.Runtime.InteropServices.COMException
(0x800A03EC): M
issing parameter does not have a default value.
Parameter name: parameters
at System.RuntimeType.ForwardCallToInvokeMember(String memberName,
BindingFla
gs flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Microsoft.Office.Interop.Excel.Range.set_FormulaR1C1(Object )

Am I missing anything?


---------------------
Thanks
Rajiv Das

3. Dynamically build request (error)

4. 16 R4i Dsi, Drivers Firmware, R4 Dsi nintendo Dsi 81052

5. 14 R4i Dsi, Drivers Firmware, R4 Dsi nintendo Dsi 15411

6. 36 R4i Dsi, Drivers Firmware, R4 Dsi nintendo Dsi 95877

7. 01 R4i Dsi, Drivers Firmware, R4 Dsi nintendo Dsi 60739

8. 24 R4i Dsi, Drivers Firmware, R4 Dsi nintendo Dsi 09736

9. 60 R4i Dsi, Drivers Firmware, R4 Dsi nintendo Dsi 41848

10. 83 R4i Dsi, Drivers Firmware, R4 Dsi nintendo Dsi 65402

11. 32 R4i Dsi, Drivers Firmware, R4 Dsi nintendo Dsi 52818

12. 10 R4i Dsi, Drivers Firmware, R4 Dsi nintendo Dsi 38895

13. 68 R4i Dsi, Drivers Firmware, R4 Dsi nintendo Dsi 17150

14. 50 R4i Dsi, Drivers Firmware, R4 Dsi nintendo Dsi 52281

15. 91 R4i Dsi, Drivers Firmware, R4 Dsi nintendo Dsi 43599