WebService provider model design flawed?

6 posts, 0 answers
  1. MikeWiese
    MikeWiese avatar
    43 posts
    Member since:
    Apr 2007

    Posted 22 May 2009 Link to this post

    I would love to be able to use the Web Service binding for my RadScheduler. But like many, I need to display user-specific information in the RadScheduler and the provider model appears to offer no "hooks" to allow this

    Consider the GetAppointments method. The examples given mandate the following:
    [WebMethod]  
    public IEnumerable<AppointmentData> GetAppointments(SchedulerInfo schedulerInfo)  
    {  
     return Controller.GetAppointments(schedulerInfo);  
    where the Controller is a facade for my custom SchedulerProvider.

    In my application, the appointments returned vary according to who is making the call. I'm using ASP.NET forms authentication and I can discover who is calling the webservice by specifying the EnableSession attribute, e.g.
    [WebMethod(EnableSession = true)]  
    public IEnumerable<AppointmentData> GetAppointments(SchedulerInfo schedulerInfo)  
    {  
     string callerName = Context.User.Identity.Name;  // I can obtain the caller, but how can I make use of it?  
     return Controller.GetAppointments(schedulerInfo);  

    But there appears to be no way I can pass the callerName identifier in the web service to the GetAppointments(RadScheduler radScheduler) method of my provider. But my custom provider needs this information in order to retrieve the correct appointments for the given caller.

    Have I missed something simple (highly likely)? Or is the provider model broken here?
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2815 posts

    Posted 25 May 2009 Link to this post

    Hello,

    I can confirm that the current provider model doesn't support passing additional information to its methods. We're aware of this issue and we're planning to upgrade it to solve this issue and a number of others, such as the dependency to RadScheduler. For the moment there are two workarounds:
    • Use the Session object
    • Instantiate the provider class once per request and pass it additional information through properties or the constructor

    They're by no means perfect, but I hope that they will do for the moment.
    Kind regards,
    Tsvetomir Tsonev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. MikeWiese
    MikeWiese avatar
    43 posts
    Member since:
    Apr 2007

    Posted 28 May 2009 Link to this post

    Hi Tsvetomir, thanks for the reply.

    I can't see how I would use the Session object (my custom SchedulerProvider class won't build because "the name 'Session' does not exist in the current context")

    I also tried your suggestion of modifying the custom SchedulerProvider to take the username in the constructor, but some important things don't work. For example, the GetAppointments() method of the controller seems to be called instead of the Update() method when an appointment is resized. And the web service receives and end time 30 min (one timeslot) after the user's selected endtime.
  4. T. Tsonev
    Admin
    T. Tsonev avatar
    2815 posts

    Posted 29 May 2009 Link to this post

    Hi,

    You can access the current session by using HttpContext.Current.Session.

    The GetAppointment call is actually expected in this case. As the appointments are not persisted on the server, RadScheduler needs to retrieve them first, so it can operate on them.

    The 30 minute offset is really strange though, please let us know if the problem persists and how we can reproduce it.

    Regards,
    Tsvetomir Tsonev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  5. MikeWiese
    MikeWiese avatar
    43 posts
    Member since:
    Apr 2007

    Posted 02 Jun 2009 Link to this post

    Thanks for the tip about HttpContext.Current - that gets me the User.Identity.Name that I need.

     

    I upgraded today to the 2009 Q1 SP2 release (2009.1.527.35) which fixed the issue whereby the Update method was not being called.

     

    After some further digging, the 30-min offset seems to have been caused by a missing DOCTYPE declaration in my aspx page,  Once I reinstated it, copying the DOCTYPE declaration from your examples, it all worked fine.

  6. Khi
    Khi avatar
    2 posts
    Member since:
    Jan 2011

    Posted 08 Feb 2011 Link to this post

    I also use webservice scheduler and use HttpContext.Current.Session, but HttpContext.Current.Session is null in event update. please help me!
Back to Top