Chapter 9. Exchanging Data via Web Services

Your game is currently equipped with a set of features, including the map, geolocation, and augmented reality support. However, to be able to share data (such as ranks and locations) between many players, an additional part should be prepared. It can be placed on the external server or in the cloud. To store the necessary information, the database will be used. In this chapter, you will implement web service as Windows Communication Foundation Service, deploy it on the development machine, and adjust the game to obtain data from it.

SOA and WCF

Service-oriented Architecture (SOA) is an approach by which the project is composed of a set of services. These services are loosely coupled, and each of them performs some specific operations. This approach supports interoperability, that is, these services can be consumed by various parts of the project, regardless of the programming language, technology, or even operating system of the device. The communication between services and clients takes place with the usage of standards and protocols, including the Simple Object Access Protocol (SOAP) and JavaScript Object Notation (JSON).

As shown in the following diagram, the WCF service can be consumed by the applications running on various devices (mobile phone, tablet, and laptop) or can be consumed by another web service:

SOA and WCF

Windows Communication Foundation (WCF) is a framework that makes it possible to create distributed applications that use the SOA approach. This framework is equipped with many features and configuration options, including security and message-sending properties. For instance, messages can be sent over HTTP, HTTPS, TCP, or MSMQ.

To consume the WCF service, the client should specify a correct endpoint that consists of an address and additional binding properties. However, the Microsoft Visual Studio IDE is equipped with a set of tools making the development of applications consuming the web services easier. In the case of this game, you will use the default options. Therefore, this chapter will not cover any WCF configuration scenarios. Before deployment in the production environment, the service should be adjusted correctly, for instance, by providing a suitable level of security.

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

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