Previous Topic

Next Topic

Book Contents

Book Index

Sample class

The following example describes a sample class:

import com.bmc.ctmem.emapi.*;

public class EMAPISample {

  public EMAPISample() {

}

  /** run once before submitting requests */

  public void do_init(String[] args) {

EMXMLInvoker.init(args);

}

  /** run once before exiting the program */

public void do_terminate() {

EMXMLInvoker.done();

}

  /** This submits the XMLRequest received as a parameter

* and returns the response */

  public String submit_request(String XMLRequest) {

  String XMLResponse="";

// Creates a   component

  ComponentType gsr_comp = new GSRComponent();

  // Creates a new   EMXMLInvoker instance 

  EMXMLInvoker my_invoker = new EMXMLInvoker(gsr_comp);

  try {

    // Submits the request given as a parameter

  XMLResponse = my_invoker.invoke(XMLRequest);

  }

  catch(InvokeException i) {

  // must handle InvokeException

  }

  return XMLResponse;

}

}

Parent Topic

Control-M/EM API configuration