views:

81

answers:

1

Hi,

I wanted to know, if say I had a MVC Application with some functionality and I want to provide this as a service to some of my clients. Do they need to go through coding and querying the XHTML data?(as it is represented in XHTML). I mean how do they generate proxy classes and use my methods? One of the ways is creating URI object but it seems there is still quite a bit of coding to be done in accessing that service(http://msdn.microsoft.com/en-us/magazine/dd943053.aspx). So , how do i consume the service on Client Side and can I provide a XML?...I have just a simple method that gets user ID and returns details in the controller and respective view. I want to provide this as a service to my client and avoid lot of code.

A: 

If you are just exposing a bunch of XML from your various MVC controllers, then the only information clients have to go on is whatever you're doing to document your XML payload format and the URI scheme of your application.

If you want clients to be able to generate client proxies so that they can automatically consume your services, then they'll need some kind of meta data, in which case you should consider using WCF to create RESTful services which would allow for metadata generation and client proxy generation as well as just being able to do just "POX" access.

As the previous commenter said, if all you want to do is expose XML data from your MVC controller, there are a variety of ways this can be done - the easiest of which is just to have your View template render XML tags instead of HTML based on data stored in the ViewData dictionary. You can also very easily expose the underlying data as Json by returning a JsonResult instance from your controller method instead of View().

Kevin Hoffman