O'Reilly logo

SOA Patterns with BizTalk Server 2013 and Microsoft Azure - Second Edition by Mahindra Morar, Colin Dijkgraaf, Johann Cooper, Mark Brimble, Richard Seroter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Consuming a web service

Now that you learned how to publish and receive XML and JSON formatted messages, it's time to explore how to consume a RESTful service.

For our REST service, we will use Visual Studio to create a Web API project using the ASP.Net MVC 4 web application template. This creates the following stub code for each HTTP verb:

// GET api/values
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}

// GET api/values/5
public string Get(int id)
{
return "value";
}

// POST api/values
public void Post([FromBody]string value)
{
}

// PUT api/values/5
public void Put(int id, [FromBody]string value)
{
}

// DELETE api/values/5
public void Delete(int id)
{
}

The preceding code creates the default API methods as shown ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required