Microsoft.Net / WCF

From MythTV Official Wiki
Revision as of 17:17, 10 April 2012 by Dblain (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Using the Service API with Microsoft Visual Studio

Service Reference Dialog

Using the Services API is really simple when using .Net and WCF (Windows Communication Framework).


  • Start with a project that uses .Net Framework 3.0 or greater.
  • Right click on the "Service Reference" node in the solution tree and pick "Add Service Reference..." The image to the right shows an example using the "Myth" service. Others can be substituted.
  • Enter in the URL to the service WSDL and give it a Namespace then click Ok.


This will download the WSDL and any XSD files from Mythbackend (needs to be running!) and generate a client proxy for the service. You can repeat the above steps for each of the services you wish to call.

Using the newly generated proxy

In a method you need to create an instance of the service client. Here is an example calling the GetConnectionInfo method.

MythService.MythClient oMythClient = new MythService.MythClient();

ConnectionInfo oInfo = oMythClient.GetConnectionInfo("0000");

string sDatabaseName = oInfo.Database.Name;

It's that simple and all data is presented in native classes, arrays and dictionaries!

Non-working Methods

The only methods that don't work correctly using the proxy class are the ones returning binary files (movies, music, images, etc...).

Currently they are defined as returning a string. How these types of methods will be handled in the future is still being worked out.