New Webinterface (1 Viewer)

thechad

Portal Pro
February 5, 2005
187
0
Geelong, Australia
Home Country
Hi All,

I have made some progress with the web server and have begun developing some web services to access the MyTV Database using TVDatabase.dll.

I have tested some simple web services from python on the Xbox like Echo(), Add(int a, int b) and Split(string SplitString) and all work fine. My next test was to grab a channel list from Mediaportal and this is where I hit a snag. It appears that the Channel class is not serializable as it does not have a parameterless constructor.

System.InvalidOperationException: TvDatabase.Channel cannot be serialized because it does not have a parameterless constructor.

I have not worked with web services before some I am a bit lost, Is the solution to this to get the MP devs to add a parameterless constructor to MP's classes or can I somehow inherit from Channel my own class like WebChannel and give it a parameterless constructor. I have tried to inherit but am hitting problems with:

No overload for method 'Channel' takes '0' arguments

Would really appreciate some help on this one.

Thanks
 

gemx

Retired Team Member
  • Premium Supporter
  • October 31, 2006
    1,972
    539
    Home Country
    Germany Germany
    Well since the Channel class inherits from "Persistent" you need to have a constructor.
    It's not that easy to just add an overloaded parameterless constructor.
    By the way - why do you need a webservice?
    Just use the remoting interfaces directly in the ASP.NET app.
     

    thechad

    Portal Pro
    February 5, 2005
    187
    0
    Geelong, Australia
    Home Country
    Hi gemx,

    I require a webservice as only python is supported in XBMC on the xbox and it has no support for the remoting binary format so I have chosen to use a web service to proxy the requests to the TVServer with the WebService using the remoting interface to communicate with the TVServer.

    Is there any work around that can be used or would I have to get my IList of type Channel and iterate through them changing them to a IList of my type WebChannel which ASP.Net would then be able to serialize into xml?

    Thanks

    Chad
     

    gemx

    Retired Team Member
  • Premium Supporter
  • October 31, 2006
    1,972
    539
    Home Country
    Germany Germany
    Well, in this case i can't think of any work around but you can perhaps flatten the classes and put them together in your webservice because e.g. you don't need all info that is in the channel class.
    So it would be sufficient to have a proxy class in your webservice that looks like:
    ProxyChannel:
    - idChannel
    - name
    - idGroup
    - GroupName
    - Now EPG info
    - Next EPG info
    If you use this class you don't even need the Groups class seperately.
    Just an idea
     

    misterd

    Retired Team Member
  • Premium Supporter
  • April 4, 2006
    1,597
    314
    Home Country
    Germany Germany
    Hi Chad,
    I have expected a problem like the one you recognized. This is one of the reasons why I suggested an additional layer between MP/TVserver and the web application and the web service for the new web interface.
    Other advantages of such a layer could be:
    - More flexibility
    - Better interface
    - No need to program those things twice (web application, web service etc.)

    But at the moment I'm still testing and optimizing the web server.

    Regards,
    MisterD
     

    samuel337

    Portal Pro
    August 25, 2004
    772
    0
    Melbourne, Australia
    The thing with MisterD's proposal is that you'll have to update the interface every time something in MP changes that affects it. Granted that's not going to be often, but its something to consider.

    I could also see if I can get a parameterless constructor put in for the necessary classes if you want.

    Which way do people think is better?

    Sam
     

    thechad

    Portal Pro
    February 5, 2005
    187
    0
    Geelong, Australia
    Home Country
    I have no problem with flattening out the classes as it is not too much work and it also gives me the flexibility of what data is actually serialized to xml. My only concern is if it will effect performance but from the small tests done so far it does not seem to be a real problem.

    We could include our own layer as a shared binary so multiple pages could share it. However would separate web applications be able to share a single binary or can they only access what is in their local bin directory. Also as I am only working off the VS Express web server I have not really tested the MP web server from SVN, is the MP web server likely to support code behind and other bells and whistles?

    Sorry this is my first time using ASP.Net for anything that may actually be used so I have a lots of unanswered questions.
     

    samuel337

    Portal Pro
    August 25, 2004
    772
    0
    Melbourne, Australia
    IIRC, the web server in VS Express and VS2005 is actually based on Cassini which is what the MP web server is based on, so it should support everything that you can do now.

    Cassini was developed by the ASP.NET team as a demo of how to use the new classes in .NET originally, so it would make sense.

    Sam
     

    Users who are viewing this thread

    Top Bottom