What does php webservice mean?

藏色散人
Release: 2023-03-04 15:00:02
Original
2334 people have browsed it

php webservice is a very heavy-duty specification. Its application protocol is SOAP. The underlying communication method it relies on is not only HTTP, but also SOAP over SMTP and SOAP over TCP. The HTTP protocol has a wide mass base and is easy to develop and debug. convenient.

What does php webservice mean?

Recommendation: "PHP Video Tutorial"

mentioned PHP webservice. It was relatively new to me before, because I had little contact with it, and I had never used it in almost any company. The only time I had used it seemed to be to access a third-party SMS channel, using SOAP|WSDL.

A very extreme statement that "webservice" is outdated is true:

1 WebService has many protocols, why is HTTP more popular?

WebService is a very heavy specification. Its application protocol is SOAP (Simple Object Access Protocol). The underlying communication method it relies on is not only HTTP, but also SOAP over SMTP, SOAP over TCP. Because the HTTP protocol has a broad mass base and is easy to develop and debug, it has become the most popular method in WebService.

Even many companies use HTTP for intranet communications. For example, applications call search engines. Solr is an example.

But HTTP is also a protocol with poor performance over TCP, because HTTP is based on TCP and has 3 handshakes. In addition, HTTP is a text transfer protocol (although binary attachments can also be transmitted, the business logic is still Text is used a lot), and there are many complex HEADERs. Therefore, people have invented some more efficient communication protocols for remote calls, such as ACE, ICE, Corba, and Taobao's HSF, but this is a topic for another time and I will not go into details. All you need to know is that the reason why HTTP is popular is that it is easy to use and has a broad mass base.

2 Why WebService is not as popular as RESTful API

WebService has been around for more than ten years. At first, IBM and Microsoft were more enthusiastic about promoting it, but it has always been tepid. On the contrary, XML-RPC, RESTful and remote calling methods that are simpler than RESTful have caught up from behind. Does it feel a bit like folk Spring killing official EJB?

The reason is that WebService is too bulky. The SOAP envelope is like a mother-in-law's foot wrap, smelly and long. Most developers can't bear it, so they have a simplified version called XML-RPC later became popular with Web2.0, and RESTful took the lead. I built a product 10 years ago, pure PHP JS, standard WebService. Even the WSDL I had to write a PHP program to generate. Fortunately, I was the only one to develop it. If it were a team collaboration, I would have been scolded a long time ago. Humanoid.

Later, even RESTful was despised, and everyone simply didn’t even bother to use PUT and DELETE, and used GET and POST directly.

At the same time, I have to say that this is only in the Internet field. The business logic of most companies is relatively simple, and the construction period is abnormally short (just like most Internet startups use rough and fast PHP instead of Relatively rigorous Java). In some areas where the business is complex and the stability and accuracy requirements are high (such as ERP, e-commerce, payment), WebService still has its place.

3 Why JSON is more popular than XML

It is also about ease of use. JSON is several Chang'an Streets more readable than XML, and the parsing rules are much simpler. There are too many rules when parsing XML, including illegal characters and exceptions. This is a fatal flaw for companies that pursue high development speed and low development thresholds.

The disadvantage of JSON is that it has less data type support and is imprecise. For example:

price:12580

In json, you cannot know whether the price is int, float or double.

So, as mentioned in the second article above, XML is more suitable in some areas with higher business requirements.

Finally, let’s talk about performance. The performance of JSON is higher than that of XML. In addition, there is no performance difference between WebService based on XML and HTTP, and RESTful API based on JSON.

XML performance is so bad, there is a special CPU called XML Accelerator, which provides hardware acceleration for XML parsing.

The above is the detailed content of What does php webservice mean?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!