Calling the CORBA Server
After configuring the client application, you can use a button to create an instance of the CORBA DiarySrv object and call the Meeting method as shown in the following button1_Click method.
private void button1_Click(object sender,
DiarySrv.DateTime MyDateTime = new
MessageBox.Show(ex.Reason, "CORBA Exception");
catch (Exception ex)
See Listing 1 for the full Windows Form class code.
First, you have to call the Bind method, passing the exact name that was specified by the CORBA Server application to create the CORBA Diary Server object (in this case, that code was generated by C++Builder, and is "ICorbaDiaryServerObject"—see the downloadable C++ source files for details).
After binding the CORBA Server object, you can call the Meeting method. But not without retrieving the date and time and construction the special DiarySrv.DateTime object (the custom type defined in the IDL file and implemented by the CORBA server).
Listing 1 also contains the definitions for the four Labels and TextBox controls used to allow the enduser to enter the required information for the meeting like the names, date, time, and duration. At runtime, the application looks like Figure 9—complete with sample meeting:
Note that the Duration value is set to 61 minutes in the running sample in Figure 9 only to ensure that the sample throws a CORBA exception on the server side. As soon as you click on the "Make Appointment" button, you'll get a CORBA exception (see Figure 10):
As long as you limit the value for Duration to 60 minutes or less, you can safely add meetings to the agenda (although the simple CORBA server doesn't actually do anything with them, but that's left as an exercise for the reader).
What you're seeing here is Janeva acting as the so-called Enterprise Application Integration (EAI) layer between the CORBA Server object and the C# Client application. The major benefit of this technology is that you do not have to rewrite or modify your existing CORBA server applications to connect them to .NET applications.
So, now you've seen how to connect a CORBA server application to a C#Builder .NET Client, using Janeva to generate C# code from the IDL files and provide the runtime connectivity between the CORBA server and the .NET client. To add a bit of sauce, although this article doesn't contain an example, Janeva offers the same ease of connectivity to J2EE Enterprise JavaBeans as it does to CORBA Server objects.