HOW TO
This article provides example code as a guide for implementing a custom MessageListener to view the complete content of the ArcXML requests generated and sent to ArcIMS by a MapObjects-Java application, as well as view the ArcXML responses from an ArcIMS server.
Note:
A member variable is referencing the MessageListener to persist the listener in memory, otherwise it will be garbage collected.
Code:
public class MyMOJClass{
MyMessageListener mymessage = null;
public MyMOJClass(){
this.enableMessaging();
}
public static void main(String[] args){
new MyMOJClass();
}
public void enableMessaging() {
mymessage = new MyMessageListener();
com.esri.mo2.util.MessageCentre.get().addMessageListener(mymessage);
}
class MyMessageListener
implements com.esri.mo2.util.MessageListener {
public void exception(com.esri.mo2.util.MessageEvent event) {
System.out.println(Exception: " + event.getMessage());
}
public void message(com.esri.mo2.util.MessageEvent event) {
System.out.println("Message: " + event.getMessage());
}
}
}
Article ID:000008018
Get help from ArcGIS experts
Download the Esri Support App