HOW TO

View ArcXML when interacting with an ArcIMS service

Summary

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.

Procedure

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

Note:
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.


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

Software:
  • 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