title: How to call methods on an ASMX service client
body: <p>I wrote a web service with a WebMethod called <code>GetLastVehicle()</code> and deployed it on IIS. When I go to the address in browser I can see and work with the method.</p>
  
  <p>When I add the web service as service reference to my project and want to use it, I can't see my method. Instead there are <code>GetLastVehicleRequest</code>, <code>GetLastVehicleRequestBody</code>, <code>GetLastVehicleResponse</code> and <code>GetLastVehicleResponseBody</code>.</p>
  
  <p>This is the service method:</p>
  
  <pre><code>[WebMethod]
  public Vehicle GetLastVehicle()
  {
      Random rnd = new Random();
      Vehicle lastVehicle = new Vehicle();
      lastVehicle.ID = rnd.Next();
      lastVehicle.StartTimeStr = DateTime.Now.ToString();
      lastVehicle.Direction = Convert.ToBoolean(rnd.Next(0, 1));
      lastVehicle.VehicleLength = float.Parse(rnd.Next(2, 6).ToString());
      lastVehicle.GrossWeight = float.Parse(rnd.Next(1200,12000).ToString());
      lastVehicle.Velocity = float.Parse(rnd.Next(50, 140).ToString());
      lastVehicle.WheelBase = float.Parse(rnd.Next().ToString());
      lastVehicle.AxlesCount = rnd.Next(2, 9);
      List&lt;Axle&gt; lastVehicleAxles = new List&lt;Axle&gt;();
      for (int i = 0; i &lt; lastVehicle.AxlesCount; i++)
      {
          Axle axle = new Axle();
          axle.Weight = rnd.Next(500, Convert.ToInt32(lastVehicle.GrossWeight / lastVehicle.AxlesCount));
          if (i == 0)
              axle.Distance = 0;
          else
              axle.Distance = rnd.Next(1, Convert.ToInt32(lastVehicle.VehicleLength / lastVehicle.AxlesCount) &gt; 1 ? Convert.ToInt32(lastVehicle.VehicleLength / lastVehicle.AxlesCount) : 1);
          lastVehicleAxles.Add(axle);
      }
      lastVehicle.Axles = lastVehicleAxles;
      return lastVehicle;
  }
  </code></pre>
  
  <p>How can I call it from my client?</p>