You can request data from a WMS server in two ways: either you use a tiled approach, or you request a single image.

This tutorial describes how to use the tiled approach. See Differences between WMSImageModel and WMSTileSetModel for more information about the different approaches.

Visualizing WMS data on a map requires two steps:

  1. Create a WMSTileSetModel by connecting to the WMS server.

  2. Use a RasterTileSetLayer to visualize the model.

WMSTileSetModel.createFromURL("", [{layer: "rivers"}])
    .then(function(model) {
      //Create a layer for the WMS model
      const layer = new WMSTileSetLayer(model);
      //Add the layer to the map

Use a WMSTileSetLayer instead of a RasterTileSetLayer if you need to support getFeatureInfo requests.