Click here to Skip to main content
11,637,662 members (70,010 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Java WCF WebService
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:
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:
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 30-May-10 16:46pm
Techbee501
Edited 31-May-10 6:43am
v2
Comments
Nagy Vilmos at 3-Nov-10 11:43am
   
Where have you got to now?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

One point. If you're going to consume this in Java, it is safe to define the binding as "basicHttpBinding" instead of "wsHttpBinding".
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
Comments
Member 10080434 at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 344
1 OriginalGriff 295
2 stibee 288
3 jyo.net 270
4 himanshu agarwal 189
0 OriginalGriff 9,031
1 Sergey Alexandrovich Kryukov 8,763
2 Mika Wendelius 6,999
3 F-ES Sitecore 2,388
4 Suvendu Shekhar Giri 2,320


Advertise | Privacy | Mobile
Web03 | 2.8.150728.1 | Last Updated 12 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100