How PHP Programmers Simply Develop Service Governance Architecture (3)

  php, Service governance, soa

Services governed by service governance need reasonable deployment and management. In this chapter, we will talk about SOA (Service Oriented Architecture). My language and writing are not good, so this chapter uses question-and-answer mode and refers to [SOA interview questions ( …] by simply explaining the complex description of this station.


SOA represents a service-oriented architecture, which is only a concept. All kinds of service architectures evolved through this concept can be called SOA architecture. The core concept of SOA is “loose coupling”.

Non-SOA Architecture

Multilingual development


Same language development


Services and services may be developed in different development languages or in the same language. Their calling methods can still only be obtained through http, or the popular Restful Api is a stupid method in both performance and development.

What are SOA services


In the real world, service is an expected service that we spend money on.

(from the real world): when you go to a restaurant to order food, your order first enters the counter, then prepares food in the kitchen, and finally the food served by the waiter. Therefore, in order to order a restaurant service, you need three logical departments/services to work together (billing, kitchen and waiter). In the software world, the same method is called business service.

2. (Software World): You went to Amazon to order a book. There are different services, such as payment gateway, inventory system, freight system, etc. to jointly complete the order of a book.


All services are self-contained and logical. They are like black boxes. In short, we don’t need to know the internal working details of the business service. To the outside world, it is just a black box that can use message interaction. For example, after the “payment gateway” service obtains the message “check credit”, it will give an output: does this customer’s credit exist or not? For “order system”, the service of “payment gateway” is a black box.

What are the main features of the service

A) SOA components are loosely coupled. When we say loosely coupled, this means that each service is self-contained and has its own logic. For example, we have adopted the service of “payment gateway” and attached it to different systems.

B) SOA services are black boxes. In SOA, services are inherently complex. They only use interactive messages, and the service accepts and sends messages. By virtualizing a service into a black box, services become more loosely coupled.

C) SOA services should be customized: SOA services should be able to define themselves.

D) SOA services are maintained in a list: SOA services are maintained in a central repository. Applications can search for services in the central repository and invoke the corresponding services.

E) SOA services can be choreographed and linked to achieve a specific function: SOA services can use plug and play. For example, there are two services in Business Process, Security Service and Order Processing Service. Two types can be implemented from its business process: first, you can check users first and then process orders, or vice versa. Yes, you are right. SOA can be used to manage the workflow between services in a loosely coupled manner.

What is SOA

SOA represents a service-oriented architecture. SOA is an architecture that uses loosely coupled black box services to build business applications. These services can be connected together through orchestration to achieve specific functions.

What is a contract, address and binding?

This is the standard term for three SOA. The address of each service is open to the outside world, and the contract is made in the service development, and the client-side binding service is used for development and invocation.

  • A contract is an agreement between two or more parties. It defines a protocol for how clients communicate with services. Technically, it has methods to describe parameters and return values.
  • The address indicates where this service can be found. The address is a URL that points to the location of the service.
  • Binding determines how this endpoint can be accessed. It determines how to complete the communication. For example, if you expose your service, you can use SOAP over HTTP or TCP BINARY to access it. Therefore, two bindings will be created for these communication media.

What are reusable services?

The service is autonomous, reusable, discoverable, stateless, with certain granularity of functions, and is part of a composite application or a composite service.

Reusable services are identified by business activities that are described using service specifications (design-time contracts).

A service constraint, including security, QoS, SLA, and usage policy, can be defined by multiple runtime contracts, multiple interfaces (Web services in WSDL), and multiple implementations (codes).

Reusable services should be regulated throughout their enterprise life cycle from design to operation. Reuse should be promoted through standardized processes, and reuse should be measurable.

How to Realize Loose Coupling in an SOA?

One strategy to achieve loose coupling is to use service interfaces (SOAP Web services in WSDL) to limit dependencies between services and hide service implementations from consumers. Loose coupling can be solved by implementing functional encapsulation of services and limiting the impact of implementation changes of service interfaces. However, at some point, you need to change the interface without affecting the service consumers, besides managing multiple security constraints, multiple transmissions, and other considerations.

Are SOA services stateless or stateful?

Services should be stateless. It has a stateless execution context, but it does not have an intermediate state to wait for an event or a callback. The reservation of state-related data must not exceed the request/response of the service. This is because state management consumes a lot of resources, which may affect the reusability, scalability and availability of services.

After the RPC service is started, the service remains in a deep sleep state and will wake up only when requested. You can call it stateless or stateful.

Do we need to build systems from scratch in SOA?

No. If you need to integrate existing systems to serve your business, you just need to create loosely coupled packages, wrap your existing systems, and expose functionality to the outside world in a common way.

In fact, there is no need to rebuild it, only to continue to decompose each service and classify it into external and internal.


What is the difference between services and components?

A logical grouping of service components to implement business functions. Component is the way to realize the goal of service. Components can use Java, C #, C, but services will be exposed in a common format such as Web services.

What we are saying is that we call other services (thrift) through RPC


See here about SOA, this time I revealed a secret, SOA actually has another name is “Service governance“Yes, it is the service governance we have been talking about. The next chapter will return to the topic and talk about the implementation of service governance.

How PHP Programmers Simply Develop Service Governance Architecture (1) …

How PHP Programmers Simply Develop Service Governance Architecture (2) …

This ape-man wrote a framework for service governance. …