Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Guys

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:
C#
using 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; } }
    }
}

My implementation is as follows:
C#
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
    }

}

Your assistance is greatly appreciated.
THANKS,
TB
Posted
Updated 31-May-10 6:43am
v2
Comments
Nagy Vilmos 3-Nov-10 11:43am    
Where have you got to now?

One point. If you're going to consume this in Java, it is safe to define the binding as "basicHttpBinding" instead of "wsHttpBinding".
 
Share this answer
 
well, i have got one way to do so.

And that is to call wcf in JQuery and then that JQuery code can be activated from JSP when required.

i have done this. and i am searching to directly call from JSP code itself
 
Share this answer
 
Comments
Member 10080434 31-May-13 8:17am    
Sir please share Connectivity with jquery and wcf by which i can do. i am trying but yet not done.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900