Java PrimerRMI Over IIOPWhen the Java and CORBA Worlds Collide

Java Primer
RMI Over IIOP
When the Java and CORBA Worlds Collide

Salih Ergül
Listing 4. Client faxes a document.

package fax.iiop;

import javax.rmi.PortableRemoteObject;
import javax.naming.*;
import fax.*;

public class InternetFaxClient {
  public static void main(String[] args) {
    try {
    // Get the root naming context
    Context context = new InitialContext();

    // Lookup the CanonInternetFaxServer
    InternetFax fax = (InternetFax)
    PortableRemoteObject.narrow(
    context.lookup("CanonInternetFaxServer"),
    InternetFax.class);

    // Fax a document
    PDFDocument PDFDoc = 
    new PDFDocument("source.file");

    fax.sendDocument(PDFDoc, "0 800 900 800");

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}