How to access the service

Since the GMAWebservice is based on wcf it supports a variety of programming languages(basically all with JSON & http support).

The current implementation has a JSON and a SOAP endpoint.

To access it with .net technologies you need to add a service reference in Visual Studio and browse to "http://<servername>:44321/GmaWebService/MediaAccessService"

Then you have to instantiate your service object (this is silverlight code, in other .net applications you would have sync instead of async methods)
            service = new <ProjectName>.MediaAccessService.MediaAccessServiceClient("BasicHttpBinding_IMediaAccessService", "http://localhost:44321/GmaWebService/MediaAccessService");
            service.ClientCredentials.UserName.UserName = "admin";
            service.ClientCredentials.UserName.Password = "admin";
            service.OpenCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(service_OpenCompleted);
            service.OpenAsync();


To use the JSON endpoint you can use basic http handlers with whom you access the service's urls.
The typical url looks like this
http://localhost:44321/GmaWebService/MediaAccessService/json/GetAllSeries?sort=0&order=0
or
http://localhost:44321/GmaWebService/MediaAccessService/json/GetAllMovies?sort=0&order=0

As you can see each parameter is added with ?<name>=<value>.
Furthermore it's obvious that each list has sort and order parameters which are mandatory!

Here's a description of existing mechanisms. If you have a suggestion which sort mechanism is needed feel free to add a issue tracker entry!
    public enum OrderBy
    {       
        Asc = 0,      
        Desc = 1

    }    
    public enum SortBy
    {
      
        Name = 0,   
        Date = 1,
        TrackNumber = 2,
        Year = 3,       
        Genre = 4,    
        Composer = 5,        
        EpisodeNumber = 6,   
        Rating = 7, 
        SeasonNumber_EpisodeNumber = 8

    }


Obviously not all sorting mechanisms fit to each kind of media file. If you try to access a list with an unimplemented sorting mechanism the service will automatically fall back to the "Name" mechanism!

Last edited Jun 19, 2011 at 8:16 PM by MikeLowrey, version 1

Comments

KoenZomers Dec 17, 2011 at 1:01 PM 
I noticed the samples here mention port number 44321, but the actual default config file runs the services on port 4321, so getting the WSDL file of the webservice can be done using: http://localhost:4321/GmaWebService/MediaAccessService?wsdl