Chapter 8. Working with Web Services in Groovy

In this chapter, we will cover:

  • Downloading content from the Internet
  • Executing an HTTP GET request
  • Executing an HTTP POST request
  • Constructing and modifying complex URLs
  • Issuing a REST request and parsing a response
  • Issuing a SOAP request and parsing a response
  • Consuming RSS and Atom feeds
  • Using basic authentication for web service security
  • Using OAuth for web service security

Introduction

The recipes collected in this chapter deal with the so called programmable web.

Today's applications consume data from a multitude of external sources. These sources are often accessed through HTTP and one of the two main methods for exchanging data over the web, SOAP and REST.

The first recipes describe how to execute simple calls to external web services through HTTP POST and GET request methods, as well as construct complex URLs. The next recipes of the chapter delve into SOAP and REST: how to make a request and parse the result using Groovy. We continue with the RSS and Atom formats and how to consume them. The last recipe covers the basic authentication mechanism and how to interact with the OAuth protocol - the dominant open authorization standard.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.232.239