Microsoft Dynamics AX 2012 R2 Services
上QQ阅读APP看书,第一时间看更新

Introducing services and SOA

So what is a service? The best way to understand what a service is, is understanding why you would need a service. Typically, there are a lot of different applications being used in an enterprise. Sometimes this is by design; for example, because a specialized functionality is needed that is not implemented in the ERP system. In other cases, legacy systems are not replaced when implementing an ERP system, simply because they do their jobs well. Whatever the reasons, these or others, the result is the same: a growing number of different applications.

One of the problems with these applications is that they are likely to have been built using different technologies. Because they speak a different language, it makes them unable to communicate with each other. This is a problem that services address by providing a means by which applications can communicate, independent of their technology. They achieve this by adhering to standards and protocols so that, in essence, they start speaking the same language.

A service should have many of the same qualities as modern applications. Applications should be modular, components should be reusable, and everything should be loosely coupled. These principles also apply when developing services. Your services should have a well-defined functionality and should be able to autonomously execute that functionality without interaction with other services.

Services should also be abstract. By this we mean that other applications should not have to know the inner workings of the provider in order to use the service. This can be attained by hiding details such as how data is stored, what technologies are used, and how the business logic is implemented. Abstraction is not an end goal, but a way to achieve loose coupling and reusability.

A service is also self-describing, meaning it can provide other applications with metadata about itself. This metadata describes what operations can be used and what the input and output is. In the case of Microsoft Dynamics AX, this information is published using the Web Service Description Language (WSDL).

All of these qualities make services usable in a Service-Oriented Architecture (SOA). In an SOA, services are published and made discoverable. Services are then composed to create loosely coupled applications.

Example implementations

To make the previous explanation about services more concrete, we will take a look at three very different scenarios in which services can be used.

Bing API

Microsoft provides an API for Bing Maps and Search that is available to developers in various ways, including a web service. Developers can use this service for things such as calculating a route between two addresses, locating an address on a map, getting search results for a certain query, and so on. It's not hard to imagine this service being used in a logistics application; for example, to calculate the most efficient route for delivering goods to customers.

Mobile application

Let's look at a scenario where a mobile application has to be developed for Microsoft Dynamics AX 2012. Even if your mobile application contains business logic to work offline, data will have to be sent back to the Application Object Server (AOS) at some point. The mobile application could use services to execute business logic and send data to the AOS when a network is available. A mobile application can also be built without containing business logic, in a way that it only renders a Graphical User Interface (GUI). In this scenario, the application will have to stay connected to the AOS over the network because the AOS will drive the application and tell it what to do using services.

Business Process Modeling (BPM)

You can use services in an SOA to model business processes. When all requirements for the business processes are available as services, it is possible to compose processes entirely using services. When done right, this is very powerful because of the great flexibility that the combination of BPM and SOA provides.