Comparison between Nusoap and PHPRPC

Source: Internet
Author: User
Tags soap

Because see someone asked Nusoap and phprpc comparison, in order to let everyone more clearly understand nusoap and phprpc relationship, so here to do a brief description of the introduction, the content is not exhaustive, only write some major comparisons. More details of the comparison can be used in their own to compare.

Nusoap is a Web Service implementation for PHP. PHP version of the PHPRPC protocol implementation with NUSOAP is a level of things. But the PHPRPC protocol is a level thing with the Web service, so let's compare the Nusoap implementation with the PHP version of the PHPRPC protocol implementation and compare the Web service with the PHPRPC protocol.

First, the agreement comparison:

In the same place:
Both protocols are based on the HTTP protocol and can be used to submit requests using the POST method.
The main differences are:
(1) Request: WebService Although the GET method is also supported for submitting requests, it is generally not commonly used, and the usual way is to use the POST method to submit a SOAP format request. While PHPRPC supports GET and POST two ways to submit requests, the request format is the most common application/x-www-form-urlencoded format, which is easier to implement for a browser client.
(2) Response: The response returned by WebService is data in SOAP format, and for a browser client, it can only be processed with XMLHttpRequest because XMLHttpRequest receives a restriction on cross-domain calls, so WebService Browser client cannot invoke the service across domains. PHPRPC's response format is plain text in JavaScript format, so the returned response can be executed directly as a script, so the browser client can be completely independent of the XMLHttpRequest, using pure JavaScript to implement a browser client, Browsers allow cross-domain download and execution of scripts, so Phprpc browser clients can make cross-domain calls.
(3) Data Interchange Format: The SOAP format used in WebService is defined based on the XML language, and the XML language is plain text, because some of these locations can add or remove some whitespace (spaces, tabs, carriage returns, or line feeds) without affecting what they represent. As a result, the format can be organized into people to read, but also because of this flexibility, for machine processing is inefficient. While the PHPRPC Data Interchange Format is PHP serialization format, PHP serialization format can be considered semi-plain text, because its data representation format is also in human readable way, but no place can insert more than blank, it is good for the readability of the machine support, It not only provides a valid delimiter, but also provides information such as the length of the string, the number of elements in the array, and the number of objects, so it is more advantageous for machine processing. Because the protocol is essentially a machine language, not a computer programming language, computer programming language is human-machine language, it should be more emphasis on human readability, and the machine language should pay more attention to machine readability. So it can be said that the PHP serialization format has a very good balance between human readability and machine readability.
(4) Bandwidth consumption: WebService is a heavy-weight Web service, its data format is lengthy and protracted, occupying high network bandwidth. PHPRPC is a lightweight Web service with a simple and compact data format that consumes low network bandwidth. Note that the weight and light weights here refer to the network bandwidth footprint, not the ability to deliver the service, PHPRPC's ability to deliver is no less than WebService, even in many places better than WebService. For example: WebService is like the OSI 7-layer network model, seemingly perfect, but complex and difficult to use. The PHPRPC is like a simplified TCP/IP 5-layer network model, which is efficient and easy to use.

Second, then we'll compare the Nusoap and PHP versions of the PHPRPC protocol implementation:
The same is all used for PHP.
The difference is mainly in the ease of use, nusoap although the ease of doing is good, but with the PHP version of the PHPRPC protocol implementation to compare is too far. For example, a service function published with NUSOAP needs to be written separately, not written in the same way as local functions, and without the use of built-in extensions in PHP, and PHPRPC publishes functions exactly like local functions, even functions that include PHP built-in extensions can be published directly. To publish a WSDL with NUSOAP, you need to define the name, parameter name, parameter type, return value type, name space, action, style, document, and so on for each published procedure. To publish a PHPRPC service, you just have to tell the server the name of the function (or the object method or class method) that you want to publish (and you can also give an alias). You do not need to give information such as parameter names, parameter types, return value types, and so on. Therefore, the support for variable-type parameters is better for variable-length parameters. On the use of PHPRPC clients, it is also convenient to call remote functions directly with a local PHPRPC client named after the remote function name, and Nusoap is relatively cumbersome. A big advantage of PHPRPC is that it makes it easy to make remote calls in a secure, encrypted transmission, which is nusoap.

Comparison of Nusoap and Phprpc (RPM)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.