View ArcXML when interacting with an ArcIMS service


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.


Use the following code as a guide for creating a custom MessageListener.

A member variable is referencing the MessageListener to persist the listener in memory, otherwise it will be garbage collected.

See the link in the Related Information section below for more information on
why reference to any of the listeners in MapObjects—Java API create strong references to them.

public class MyMOJClass{

MyMessageListener mymessage = null;

public MyMOJClass(){

public static void main(String[] args){
new MyMOJClass();

public void enableMessaging() {
mymessage = new MyMessageListener();

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

  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic