Posts

Showing posts with the label WCF Rest

A Generic Method for Consuming Data From RESTful WCF Service Methods

I recently added some new methods to an existing RESTful WCF service and needed to consume these methods from an application which had not previously made use of this service. To make this easier, I created the following generic method. It could probably use a little refinement (specifically some code to handle what happens if an attempt is made to cast the service method result to an incorrect type), but it does the trick. using  System.IO; using  System.Net; using  System.Runtime.Serialization; using  System.Text; namespace  RESTService.Helpers {      public   static   class   RESTServiceHelpers     {          public   static  T GetResultFromRESTServiceMethod<T>( string  url)         {             HttpWebRequest request = (...