Comparison between NuSOAP and PHPRPC. This is because we can see a comparison between Nusoap and PHPRPC. in order to give you a better understanding of the relationship between Nusoap and PHPRPC, we will give a brief description here
As we can see a comparison between Nusoap and PHPRPC, we will give a brief description here to help you better understand the relationship between Nusoap and PHPRPC, the written content is not comprehensive, and only some major comparisons are written. For more details, you can compare them in use.
Nusoap is a Web Service implementation for PHP. Php phprpc protocol implementation and Nusoap are similar. However, the PHPRPC protocol is similar to the Web Service protocol. Therefore, we will compare the Nusoap implementation with the PHPRPC protocol implementation in PHP to compare the Web Service and PHPRPC protocols.
1. protocol comparison:
Similarities:
Both protocols are based on the HTTP protocol and can use the POST method to submit requests.
Major differences:
(1) requests: Although WebService supports the GET method, it is not commonly used. the common method is to use the POST method to submit requests in the SOAP format. PHPRPC supports GET and POST requests. the request format is the most common application/x-www-form-urlencoded format, which is easier for implementing a browser client.
(2) response: the response returned by WebService is data in the SOAP format. for browser clients, only XMLHttpRequest can be used to process the response. because XMLHttpRequest has restrictions on cross-origin calls, therefore, the browser client of WebService cannot call the service across domains. The response format of PHPRPC is compatible with plain text in JavaScript format. Therefore, the returned response can be directly executed as a script. Therefore, the browser client can be completely independent of XMLHttpRequest, A browser client can be implemented using pure JavaScript, and the browser allows cross-origin download and script execution. Therefore, the browser client of PHPRPC can implement cross-origin calls.
(3) data exchange format: The SOAP format used in WebService is defined based on the XML language, and the XML language is plain text, some of the positions can be added or deleted with spaces (spaces, tabs, carriage returns, or line breaks) without affecting the content, therefore, the format can be organized to make it easier for people to read. However, due to this flexibility, it is inefficient for machine processing. The data exchange format of PHPRPC is PHP serialization format, and PHP serialization format can be semi-plain text, because the data format is also represented in human readable mode, however, no space can be inserted at any position, which provides good support for machine readability and not only provides valid separators, it also provides the string length, number of array elements, number of object members, and other information, so it is more conducive to machine high-speed processing. Because the protocol is essentially a machine language, rather than a computer programming language, the computer programming language is a human-machine language, which should be more focused on human readability, while the machine language should pay more attention to machine readability. Therefore, PHP Serialization formats are well balanced between human readability and machine readability.
(4) bandwidth usage: WebService is a heavyweight Web service. its data format is lengthy and the network bandwidth is high. PHPRPC is a lightweight Web service with simple and compact data format and low network bandwidth usage. Note: heavyweight and lightweight refer to network bandwidth usage, rather than the ability to provide services. PHPRPC's service capabilities are no inferior to WebService, even better than WebService in many places. For example, WebService is like OSI's 7-layer network model. it looks perfect, but its implementation is complicated and difficult to use. PHPRPC is like a simplified layer-5 network model of TCP/IP, which is efficient and easy to use.
Second, let's compare the PHPRPC protocol implementation of Nusoap and PHP:
In the same way, PHP is used.
The difference mainly lies in the ease of use. although Nusoap does not do well in terms of ease of use, it is too far from the PHP version's PHPRPC protocol implementation. For example, the service functions released using Nusoap need to be written separately, but cannot be written in the same way as the local functions, and cannot use the built-in extension functions in PHP, the functions released by PHPRPC are exactly the same as those of local functions, and even built-in extensions of PHP can be directly released. To publish a wsdl using Nusoap, you need to define the name, parameter name, parameter type, return value type, namespace, action, style, document, and other content of each release process. To publish a PHPRPC service, you only need to tell the server the name of the function to be published (or the object method or class method) (or give an alias. The parameter name, parameter type, and return value type are not required. Therefore, variable-length parameters provide better support for variable-type parameters. The use of the PHPRPC client is equally convenient. remote functions can be called directly using the method of the local PHPRPC client named after a remote function, while Nusoap is relatively more troublesome. PHPRPC also has a major advantage in that it allows you to easily perform remote calls through secure encrypted transmission, which Nusoap cannot do.
In order to give you a clearer understanding of the relationship between Nusoap and PHPRPC, we will give a brief descriptive introduction, written by Nusoap and PHPRPC...