Application Structure: Concept View-4 Agreement (Enterprise Structure)

xiaoxiao2021-03-06  69

The service communicates by sending and receiving a service interface. The communication of service to the service follows the agreement, by clarifying this agreement, the user may change the service implementation without affecting the interaction.

This page

Agreement Introduction Service Interface Design Time Agreement Service Interface Session Agreement Summary

Introduction to the agreement

When two services interact, the message is sent back and forth between them. Both ends need to be exactly what they send, how to send, what is expected, and how to expect. Not only is it necessary to define what message, what format should be used and how to send messages, but also, it is important to specify that these messages should be sent in order. The agreement is all content sent between two services and how to send the definition or binding protocol.

Back to top

Service interface

The service provides their features to other services through the service interface. The service interface is used to interface the service for the object. The object interface defines the feature of the method call, and the service interface defines the feature of the message. There are some formats to describe these two interfaces simultaneously, for example, you can define the service interface using the web service description language (WSDL http://www.w.w.w3.org/tr/wsdl), which is described in COM using an interface description Language (IDL) is almost the same.

If an object is to use another object, it needs to know the interface of that object. Similarly, use this interface in the program code of another service, you must know the features of the interface. You can use a tool to generate a code that can communicate with the service using a description of the service implementation or interface. For programmers to use services, these two routes don't have much difference.

Although the service interface is similar to the object interface, there is an important difference: the service interface does not support the instance model. An object is instantiated for another object, then calls its interface to use the object; then you can call the object several times. The service only sends a message to a service; when sending multiple messages, the basic system architecture may send these messages to different physical locations, but the client usually does not know any difference. When the object remotely calls other objects, it is often called remote procedure call (RPC).

The service interface description message requires the full information of the operation. These include functions provided by the service, as well as the parameters and return values ​​of these functions. The request or response can be regarded as the verb, while the parameters are regarded as the subject, and these subjects are often referred to as a business document or document.

Because users communicate with each other, both can send and receive messages. Thus, the user must also be a service, and the service interface must define incoming messages and outgoing messages. The service interface exists in the form of matching pair; the simplest match pair interface is provided by traditional agents that can send requests and reception responses.

We will use the service interface in the design, do not use the instance model, use interactions distributed in space and time, use sometimes unreliable asynchronous messages, use complex abnormal processing, but this does not make design services more easy. Design a reliable service take time, which makes the cost of service design are high.

Back to top

Design time agreement

When two services interact, the message is sent back and forth between them. Not only is it necessary to define what format that can be sent and what form should be used, but it is important to specify that these messages should be sent in order.

For example, the buyer may send a purchase order and expect the seller to send a confirmation message that has received the order. The buyer may then expect the seller to send a set of order confirmation within three days (for example, confirming the received order and being processed), before receiving this confirmation, the buyer can cancel the order. The buyer needs to understand and expect to receive these two messages. The seller may also need to send some confirmation messages. If the item is ordered, it may even send suggestions for replacement items.

The interaction between the buyer and the seller may be very complicated. If both parties do not use the same way to understand this interaction, there will be a problem.

Before the design of both ends, the two sides need to agree on many first decisions: • What is the purpose of interaction? • What are the participants or roles in interaction? • What message is used? • What form is used? • What possible messages are available? • What can you continue after each step? • What services may occur? • What measures taken after business abnormal or technical abnormality?

Agreements are used to define a sequence of occurrences (based on interactive roles) of messages, messages formats, and messages. It should be noted that the message sequence includes possible exceptions and reactions made to these exceptions; exceptions may be caused by participants, or may be caused by the basic system architecture. For example, if one of the participants do not respond in time, it can be considered to have an exception; however, if the message cannot be transferred in time, the technical exception is explained. The specific division often depends on the business involved; if the response is reserved in a few days, the possibility of blocking the technically abnormality occurs minimizes. If you are required to respond within a few seconds, the agreement should explicitly define the reaction to an exception.

Each participant must implement your own specific role in the agreement. In the previous example, the entire process implements the role of the buyer's role or the seller. Agreements are usually implemented by both ends. This processing defines the operation of sending messages and reception messages, and has determination points that determine which message or which message is expected. This process also defines an operation from the appearance of the appearance. For example, after receiving the order, the process may check if stocks and how much discounts are given to the buyer. Although the response may depend on the internal operation, the other end does not feel the existence of the determination process; the other end knows that it can expect any of the reactions, but the service interface hides the judgment algorithm.

Figure 1 illustrates an agreement between two communications services.

Figure 1. Agreement

The service interface not only defines messages and message formats, but also defines sorting constraints and any other constraints (eg, time-time period, exception, and requirements for, for example, queuing transmission). It is the definition of the role that serves in the agreement.

The service can use multiple interfaces (so) to communicate with multiple other services. For example, a service that receives a purchase order may need to communicate with a warehouse service, billing service.

Define design time agreement

When defining a service, you need to determine the message sent by the service, the message received by the service and the general sequence of these messages. It should also be determined to be abnormal, including how the timeout abnormality may occur, and how to handle these exceptions. These contents are determined, define the external behavior of the service (interface) and then determine the agreement. After this process is completed, you can actually write a real code.

It emphasizes it here again that the design phase of the application lifecycle is correctly identified and defined as an investment, which helps:

• Build a service with the correct behavioral behavior. If the interface and message sequence is defined for the service, the agreement can be implemented at any end of the session. • Build interchangeable services. Participants can be changed at any end of the agreement, as long as both parties follow the agreement, this approach does not cause any problems. • For example, the user may need to build a package for an original system and then build a service with the package. Because the service will communicate through the packaged service interface, if there is another service to provide the same interface, it can be used to replace the original system. Another example is that the operation of large enterprises involves many suppliers. Enterprises will define the service interface to use, and all suppliers need to use the service interface. However, companies can change their services without affecting the vendor. • Determine which services can work together. If you have a service with a known service interface set, you can quickly determine other services that can communicate with it. Figure 2 illustrates this.

Figure 2. Status between shared service pairs • Build tools that support design and management. If you build a Case tool, you can assume that if each service interface and role are designed, they will communicate properly after construction, which is like to see the agreement as different types of cables, you can determine which equipment can be connect them.

Back to top

Runtime agreement

So far, this article has discussed the design time of the agreement. The reliable behavior of message flow, message format, and transmission is part of the design. Many other aspects of the Agreement are only known to deploy services, and often the results of negotiation between organizations, even the comprehensive results of negotiation between different groups within the organization. Define how many requests should be processed daily, which transport protocols use, and which encoding types that must be supported are often affected by security restrictions such as authentication mechanism, encryption, and signing. However, all of this is still part of the runtime agreement, which can treat them as different paragraphs in the agreement. The agreement defines all aspects of communication between two services.

Back to top

Service interface

As mentioned earlier, the service interface achieves an agreement. A large part of the design time is part of the development phase in the code. Message sequences are almost always dominated by business logic and penetrate in business logic. However, a large part of the agreement can be provided by the infrastructure. The infrastructure can map logical addresses to physical addresses and provide authentication mechanism, load balancing, and failover. Of course, the infrastructure can also help implement restrictions applied by business logic.

The service interface usually provides an agreement to discovery mechanism; the Web Service Description Language (WSDL) standard details many discovery mechanisms, will also increase more. Therefore, the service interface not only enables and executes the agreement, but also provides information about the agreement, so that other services can comply with the agreement.

The infrastructure requires runtime information and design time information to implement the service interface.

A service can have multiple interfaces; the agreement defines interactions between one of those interfaces and one of the other services. More specifically, design time agreement defines interactions between two interfaces; uses design time agreements, designers and programmers can build the correct service. Runtime Agreements add constraints to a pair of ports or addresses; runtime agreement allows the information technology (IT) department to express and communicate the required runtime constraints. The rest of this article will use service interfaces and protocols when designing and runtime, unless they are distinguished.

Back to top

Session

When two services are sending and receiving messages, they are equivalent to joining a session. The session is an instance of the agreement and must follow the protocol defined in the agreement. The service can participate in the meeting without any additional verification; however, if the infrastructure is verified according to the agreement, the abnormality process will become more consistent, and the development is also easier.

This verification may occur in many places: verify any end or both ends of the agreement, or the main instance of the agreement shared by all participants can be created. If the agreement is violated, it is necessary to ensure that the definition is defined for the relevant participants.

In addition to contributing to the agreement verification session, the infrastructure can also provide information about the session state. This is useful for each participant holding synchronization, but if one of the participants is a general user interface application, it is more helpful. The application can ask the next possible step to the infrastructure to ask the next possible step and display the appropriate button to the user. Another example will be raised, and the spreadsheet application can use the fee report service interface, which requires what possible operations that the particular point of the service is in the session. Another case that may happen is that one of the participants is not processing, but a more general components that cannot be stored. For example, you can use a desktop to start a subscription process and then continue to issue a order on your personal digital assistant (PDA). There must be some way to connect the PDA to the session during the correct phase of the process.

The session between the services can be monitored and information about the session status. This is different from the query order status. When queries the order status, the service logic to the service logic is requested from the service request information; the situation mentioned here is information from the infrastructure software request such as the steps that may happen in the agreement. This information is closely related to business logic. Back to top

Agreement summary

The service interface defines the feature of the message sent to the service. They exist in the form of matching, that is, in any end of the session, there is a service interface.

Agreements are used to define all information about messages sent around the two services. This includes sending and receiving messages such as what should be sent and received, what format should be generated when an error occurs, and what formats use and how to ensure the security of the message.

Defining a clear agreement in the design phase will produce services that are easier to use and easier to manage.

Back to top

note

• In SOAP and all relevant standards, use both of the port and port types. The port is a named location, which is the endpoint of the message received, or is called a Uniform Resource Locator (URL). The port type is the so-called service interface discussed herein. Programming language typically references interfaces, and communication protocols (eg, Simple Object Access Protocol (SOAP) reference port types.

Go to the original English page

转载请注明原文地址:https://www.9cbs.com/read-92670.html

New Post(0)