Web service concept, practical argument

zhaozj2021-02-11  235

Concept, practical relationship between Web Service in .NET project development

Web Service (WS) is a highlight in the VS.NET platform, making it the only one with "common language" in the J2EE architecture and .NET enterprise architecture.

In the development of the project, we did not use too much WS, and I don't have much practical experience for WS. From many website discussions, I think there are several important things. Below is a summary of my current understanding, everyone commented, which is wrong, which is right:

1. What is the relationship between WS related a bunch of nouns?

XML: Don't say

WSDL: Used to describe how the WS, XML format indicates how the client interacts with the WS.

UDDI: How does WS release, how do customers find WS, use UDDI

About the name of the genius! ! ? ? : O

(Hereinafter from MSDN)

UDDI (General Description, Discovery, and Integration) specification defines a standard way to publish and discover information about XML Web Services. The XML architecture associated with UDDI defines four information that enables developers to use the published XML Web Services. They are: business information, service information, binding information, and information about service specifications.

As the core component of the UDDI project, the UDDI service registry enables the service to be programmatically locked information about the XML Web Services disclosed in other units. Developers can use UDDI business registry to locate discovery documents and service instructions.

SOAP: A protocol, the content is XML format, and the lightweight protocol of data is exchanged on the web.

It works in WS is that the server uses the protocol used when switching data.

(Hereinafter from MSDN)

The SOAP protocol specification contains four main components. The first part defines the necessary scalable envelopes for packaging data. The SOAP envelope defines the SOAP message and is the basic exchange unit between the SOAP message processor. This is the only part of this specification.

The second part of the SOAP protocol specification defines the data type defined by the application and an optional data coding rule for graphics, and a unified model for serializing non-syntax data models.

The third part defines the message exchange mode of the RPC style (request / response). Each SOAP message is one-way transmission. Although the root of SOAP is in RPC, it is just just a request / response mechanism. XML Web Services often combines SOAP messages to implement such patterns, but SOAP does not force message exchange mode, which is also optional.

The fourth part of the specification defines the binding between SOAP and HTTP. However, this part is also optional. SOAP can be used with any transport protocol or mechanism (including SMTP, FTP or even floppy disk) capable of transmitting SOAP envelopes.

Second, please help me correct a few concepts

First need to correct some concepts.

The first one is going to correct the multi-layer structure:

We are taking a layered development, paying attention, usually just software code structure, is not deployed.

When we develop software, the data access layer, divide the business logic layer, the divided space layer, but it is actually completed, these layers are physically on the same machine when deploying, the database may put a machine, If this is a multi-layer application, it is obviously a misunderstanding.

The hierarchical development provides a good code organization management, easy to maintain, is just a code organization means, the larger the project, the more obvious this point; the smaller project, the more weaken, and even disadvantages.

It can be simply that the hierarchical development is nothing more than a application 1.exe or 1.ASPX, found 3.DLL by 2.DLL, 2.DLL Found 4.dll, 3.DLL to find 4.DLL 5.DLL, 4.DLL Found 6.dll by 5.dll ... Finally, n.dll goes to the stored procedure, stored procedures to find data in the database. When publishing, stored procedures and database tables can only be on one machine, and other code can be compiled. Two machines.

So the multi-layer structure is a software architecture, which is the structure of the code level, and there is no relationship with deployment.

Some people draw a picture, a server is called DB Server, a server is called Web Server, then draw a notebook, labeled IE, saying is the client, and solemnly point out that this is the multi-layer structure. ! ! ! Big wrong! ! !

The above is my understanding, marking as a problem 1. Everyone comments are right.

The second must correct the B / S structure and the C / S structure:

Many companies and programmers said that "we turned to B / S structure", so I don't understand what is the difference between the traditional B / S structure and the C / S structure software? ? ? ! ! !

I don't think there is no difference in development, all write a bunch of code, access the database server.

The only difference is only in terms of deployment. The so-called B / S structure is mounted on a machine, and the user will directly access the server from its own machine. The C / S structure puts the code on each user's machine, so. A bunch of people jumped out and said that this is convenient. I did a lot of big and small projects, I didn't think it was convenient. I prefer if I can copy a client software from the server. Safety? In the project I did, users don't want to use it well. I have to study hard. I can't think of it. I will be a hacker, do you get bad data? ? ?

So I think the so-called B / S structure is not different from the C / S structure in software development.

The above is my understanding, marking as a question 2, everyone comment is right.

The third thing to talk about "business logic layer"

The business logic layer is a very fucking noun, unknown.

If the data layer refers to the database, the interface layer refers to the application interface or something I see in IE. Then the two nouns say "hats", "shoes", very clear.

What is the business logic layer? ? I think it is as unclear like "clothes".

So you can say that you wear shoes and clothes, you can also say that you wear shoes, hats, socks, trousers and clothes.

Therefore, the practice that can be explained can only be referred to as a business logic layer outside the data layer and the interface layer.

The above is my understanding, marking as a problem 3. Everyone comments are right.

So far, I can't determine the authenticity of the following two propositions. Everyone wrote the answer:

1. The stored procedure can handle a large number of services, including access data, statistical calculations, find data, etc. However, the stored procedure can only be placed in the database, and I have almost no reason to put the stored procedure and database data separately Requirements in two database instances (only some so-called "far process calls", the full format call for servername.dbname.dbschema.tablename).

So, the stored procedure is a data layer or a business logic layer?

Still whether stored procedures are data layers, some stored procedures are business logic layers? - If it is, this is another answer. I look for the SP (stored procedure) of the user who is "gonglv" is the business logic layer, and the SP of all users is the data layer? ? ? The above is my understanding, marking as a question 4, everyone commented or give the answer.

2, what is the data layer? DBMS plus a bunch of piles Can't call the data layer? Still directly access the C # / C / VB / Java code of the database is called the data layer? Still two add together? ? Still? ? ?

This problem may answer, I have said that I have said I have confused myself in half a day, marked as a problem 5, everyone gave an answer, save me.

Third, what did WS do?

We start to say our WS.

If my understanding is good, in fact, the difference between the C / S structure and the B / S structure, multi-layer structure, etc., actually the logical concept of programmers when writing code, only for development process, essentially It is written a software to access the server.

Development and deployment are different. The only role of WS is the role of software deployment.

We can write a program as a server (a), access the database server (B), at 5678 port listen.

We write a program again as the client (c), access the server (A) through the TCP / IP protocol, to find something to 5678, whether you are asynchronous or synchronized.

In this way, when deploying, the first time there is a possibility of two or more servers, A, B, and C, of ​​course, if the client C is a web site, then there is a "notebook" IE (d) to access it, But this application should be three parts, and D should not be calculated.

So you can access our A1, A1 to find A3 through A2, then find A4, find A5, then find ... Hey, there are countless servers (if necessary).

I think this is another "multi-layer structure", which is completely different from the "multi-layer structure" before, so as long as there is multiple layers, it is reasonable, it is reasonable, and it is unable to divide it into businessfacade, businessrules, dataaccess what Yes, and each layer has a parameter and code close to the same function, and the layer call - this will only increase the complexity of software maintenance, and it is far from the basic idea of ​​software development.

Or right, "multi-server deploy multi-layer structure"

When it is no longer directly (Direct), it is no longer transmitted data, and it can have a new concept. The data format, protocol is cured, and it is recommended to use it, see, this is the new standard, Or let countless, big and small, new and old programmers have a "new technology".

For example, DCOM, such as CORBA.

For example, .............................................. Web Service.

No longer an agreement with a 5678 port, and use UDDI to discover.

No longer (direct) with TCP / IP protocol, use SOAP delivery.

No more, I will give you something, what you give me again, and use WDSL to tell you.

No longer transferred data, but XML format, must be binary (such as pictures) to convert to base64 format, and there is no relationship between 35%. The above is my understanding, marking as a question 6, everyone comment.

Fourth, the advantage analysis of WS

I have been confused in the night, I can't go to the night: What is the advantage of WS in our actual software products?

1. Simple to realize it

Simple, it will abuse, let alone our procedures are afraid of simple, the more complicated more and more.

2, can you provide a WS calculation A b =? Collect money

Buy a function library is the same, there is a beautiful disc, and it is not worried that the manufacturer sells WS will be closed, or the WS server will DOWN machine.

3, release it once, everyone can use

Complete this feature like writing a class library, and packaged, later updates easier.

4, XML is trend, it is standard, after data exchange rely on it

See how many people are concerned about XML safety transmission? ? ! !

5, WS SESSION problem:

I have a need to be a simple unified authentication server, I want to use WS, support the user's single login, all network traffic, find WS session, almost ecstorously - But the session must have a session One correspondence, the client can do the session that can meet the needs, I want WS for the SESSION? ? ? Self-seeking or sick?

What questions can be solved in the SESSION of WS.

(So ​​far, there is no problem, single as a problem, marked as problem 7, please help)

6, speed

Shit, increase the amount of transmission, multi-layer Web interaction, will only lower the speed.

7, safety

I don't say it, you say that XML transmission is safe.

8, easy to find a sense of accomplishment

This is exactly a misunderstanding of the task technology in software development.

9, reflecting concept

The concept is not worth money, deciding whether to make money is the market capacity, brand awareness, plus the quality of the product, does not include concepts, including the easy-to-use UI, function and performance.

10, don't I try it?

Try it.

The above view is marked as a question 8, please comment.

5. Give me a reason for using WS

In summary, I think the only reason for using WS in a real software product is:

Provides a new means for implementing the "multi-layer structure of multi-server deployment".

This application is not much in our actual needs. Multi-layer applications that can be deployed in multiple servers must have their own considerations at each layer. For functional considerations, or for performance considerations.

The following is some of the possible applications that I am thinking about my brains, and there is no necessary feasibility analysis:

1. Write a WS to complete a set of server load balancing

2, write a WS, for a special application, as the front-end cushion of the server

3. Write a WS to deal with collaboration of a cross-network segment application.

4. Write a WS to achieve a specific application performance linear extension (plus a server, the performance linearity is improved. And the role of the cluster does not linearly improve performance)

5, as a problem, labeling as a problem 9, please mention the possible new applications.

Sixth, the last sentence:

Please answer questions 1-Question 9, point out my mistakes, saying that there is a practical value of WS, convince me, save me in the heat of water.

My email: lichunlei@clever.com.cn

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

New Post(0)