I am new to WCF, I have created a WCF service that will to be consumed by a JSP page. The WSDL file has been generated and added to the JSP client but I have just got to a point where I feel I could benefit from some consultations after having spent days trying to get it to work. I am hoping to just display a set of records from an access database that is accessed through WCF service. Could you please help me to achieve this functionality. I have provided my code for the WCF service.
My WCF Code is as follows:
System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace WCFCarService
{
[ServiceContract]
public interface ICarService
{
[OperationContract]
List<Car> GetCars();
}
[DataContract]
public class Car
{
private int carID;
private string carMake;
private string carModel;
private string carTransmission;
private string carBodyType;
private int yearManufactured;
[DataMember(Order = 1)]
public int CarID { get { return carID; } set { carID = value; } }
[DataMember(Order = 2)]
public string CarMake { get { return carMake; } set { carMake = value; } }
[DataMember(Order = 3)]
public string CarModel { get { return carModel; } set { carModel = value; } }
[DataMember(Order = 4)]
public int Year { get { return yearManufactured; } set { yearManufactured = value; } }
[DataMember(Order = 5)]
public string CarTransmission { get { return carTransmission; } set { carTransmission = value; } }
[DataMember(Order = 6)]
public string CarBodyType { get { return carBodyType; } set { carBodyType = value; } }
}
}
And my Implementation is as follows:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace WCFCarService
{
public class CarService : ICarService
{
#region ICarService Members
public List<Car> GetCars()
{
List<Car> carList = new List<Car>();
return carList;
}
#endregion
}
}