Run the CarTrackerClientApp Client

Guides you through the process of using a Web browser and the generated console client to access the CarTracker Web service, and how to make use of output filtering.
Restriction: This topic applies only when the Enterprise Server feature is enabled.

Access the GetCars operation from a Web browser

  1. Start a Web browser and enter the following address:
    http://localhost:9003/temppath/CarTracker/1.0/cars

    Notice that the Web address includes the server name, port number, base URI, and path for the GetCars operation.

    The browser should display the full records of six cars. Leave the browser open.

Access the AddCar operation from the COBOL client

  1. From the Solution Explorer in Visual Studio, right-click CarTrackerClientApp, and then click Set as StartUp Project.
  2. From the main menu, click Debug > Start Without Debugging.

    This starts the console.

  3. Press Enter four times to progress to the Operation field.
  4. Enter 2 to select AddCar.
  5. Complete the remaining fields as indicated:
    StockNumber 0
    make Honda
    model Civic
    year 2005
    price 9000
    mileage 110000
    color blue
    doors 2
    bodyStyle hatchback
    transmission manual
    driveType 2WD
    cylinders 4
    fuelType gasoline
    fuelMPG 24
    feature number of occurrences (10 max) 2
    featureID 1
    description cassette player
    featureID 2
    description air conditioning
  6. Press any key to close the console.
  7. Refresh the Web browser.

    The car you just added should now appear on the list, with the stockNumber assigned as 7.

Access the AddCarFeature operation from COBOL client

  1. From the main menu in Visual Studio, click Debug > Start Without Debugging.
  2. Press Enter four times to progress to the Operation field.
  3. Enter 3 to select AddCarFeature.
  4. Complete the remaining fields as indicated:
    featureID 0
    description cruise control
    stockNumber 7
  5. Press any key to close the console.
  6. Refresh the Web browser.

    The car you added in the previous section should now appear on the list with the additional feature.

Access the Web service using output filtering

Here you use query parameters in the path to filter the fields in the response.

Note: For complete details on output filtering, see Output Filtering.
  1. In your Web browser, enter the following address:
    http://localhost:9003/temppath/CarTracker/1.0/cars?doors=2&fuelType=gasoline

    The JSON response lists all 2-door cars that run on gasoline:

    {
      "car" : 
      [
        {
          "stockNumber" : 2,
          "make" : "Ford",
          "model" : "Mustang",
          "year" : 2015,
          "price" : 22000,
          "mileage" : 6000,
          "color" : "yellow",
          "doors" : 2,
          "bodyStyle" : "convertible",
          "transmission" : "manual",
          "driveType" : "2WD",
          "cylinders" : 8,
          "fuelType" : "gasoline",
          "fuelMPG" : 15,
          "feature" : 
          [
            {
              "featureID" : 1,
              "description" : "heated seats"
            },
            {
              "featureID" : 2,
              "description" : "CD player"
            },
            {
              "featureID" : 3,
              "description" : "air conditioning"
            },
            {
              "featureID" : 4,
              "description" : "power windows"
            },
            {
              "featureID" : 5,
              "description" : "premium sound"
            },
            {
              "featureID" : 6,
              "description" : "mag wheels"
            }
          ]
        },
        {
          "stockNumber" : 7,
          "make" : "Honda",
          "model" : "Civic",
          "year" : 2005,
          "price" : 9000,
          "mileage" : 110000,
          "color" : "blue",
          "doors" : 2,
          "bodyStyle" : "hatchback",
          "transmission" : "manual",
          "driveType" : "2WD",
          "cylinders" : 4,
          "fuelType" : "gasoline",
          "fuelMPG" : 24,
          "feature" : 
          [
            {
              "featureID" : 1,
              "description" : "cassette player"
            },
            {
              "featureID" : 2,
              "description" : "air conditioning"
            },
            {
              "featureID" : 3,
              "description" : "cruise control"
            }
          ]
        }
      ]
    }
  2. In your Web browser, enter the following address:
    http://localhost:9003/temppath/CarTracker/1.0/cars?doors=2&fuelType=gasoline&$fields=make,model,price,fuelType

    The JSON response shows the same filtered list, but includes only the fields specified by the special $fields query parameter:

    {
      "car" : 
      [
        {
          "make" : "Ford",
          "model" : "Mustang",
          "price" : 22000,
          "fuelType" : "gasoline"
        },
        {
          "make" : "Honda",
          "model" : "Civic",
          "price" : 9000,
          "fuelType" : "gasoline"
        }
      ]
    }

This concludes the tutorial.