Radscheduler web service deserialization

1 posts, 0 answers
  1. host
    host avatar
    2 posts
    Member since:
    Apr 2011

    Posted 21 Oct 2012 Link to this post

    Hello

    I am considering the following scenario: I have working asp.net web site with radscheduler (option with webservice binding). Everything is working fine but I would like to add such scheduler to winforms application. I have been trying to consume SchedulerWebService (this is a part of asp.net page) but I have found it is json service so it is not such easy as I thought - there are deserialization problems..
    Do you have any advices? My webservice method is as follows
    public List<AppointmentData> GetJSONScheduler(SchedulerInfo schedulerInfo)

    I am succesfully receiving appointments but I can't deserialize List<AppointmentData> from json response.
    I have been trying
    but I am receiving e

    DataContractJsonSerializer dJSON =
    new DataContractJsonSerializer(typeof(List<AppointmentData>);
    List<AppointmentData> sr = (List<AppointmentData>)dJSON.ReadObject(str);
    //sbResponse is taken from the stream of webrequest response
    JavaScriptSerializer jscriptDeserializer = new JavaScriptSerializer();
    jscriptDeserializer.RecursionLimit = 100;
    List<AppointmentData> srResult = jscriptDeserializer.Deserialize<List<AppointmentData>>(sbResponse.ToString());
    xceptions about root element is missing or value __type cannot be null..
    I would like to avoid string manipulation with the response (replacing elements with proper types)
    Or do you have easier solution for such operations?
    Solution with direct access to db is unacceptable - I am performing few operations with appointments before I am returning it to the client and I would like to have such method in one place
    One web service, many clients (wpf, winforms, asp.net)..

    Thanks in advance
    Regards
Back to Top