The ArcGIS JavaScript API supports tiled and dynamic services from ArcGIS Server 9.3. This support comes from two base classes: TiledMapServiceLayer and DynamicMapServiceLayer. You can extend these base classes to support other layer types such as Open Geospatial Consortium Web Map Services (OGC WMS), and any tiled map service including ArcGIS Server 9.2 cached map services.
Before creating custom layer types, you should have some familiarity with the ArcGIS JavaScript API, especially the DynamicMapServiceLayer and TiledMapServiceLayer classes. It's also helpful to be familiar with creating and extending classes using the dojo.declare methodology. To learn about this see http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/object-orientation
To create a custom layer, you must extend either the DynamicMapServiceLayer or TiledMapServiceLayer class. Extending the GraphicsLayer or creating a custom layer from scratch is not supported. No matter which of the two classes you extend, the workflow is the same:
The following samples demonstrate how to create custom layer types using the above pattern: