Application of XML-RPC structure WebService in PHP

Source: Internet
Author: User
[WebService prefix] WebService is generated for the communication of heterogeneous systems. its basic idea is to provide a scale mechanism for the application of XML-based HTTP remote calls, this saves the need to establish a new protocol. Currently, WebService communication is enabled.

[Web Service prefix]

Web Service is generated for the communication of heterogeneous systems. its basic idea is to provide a scale mechanism for the application of XML-based HTTP remote calls, this saves the need to establish a new protocol. Currently, there are two protocol standards for Web Service communication: XML-RPC and SOAP. XML-RPC is relatively simple, present time is relatively early, SOAP is more complex, important is some need to be stable, tough, secure and complex interaction application.

PHP integrated XML-RPC and SOAP two protocols to visit, are concentrated in the xmlrpc expansion. In addition, in php pear, whether PHP 4 or PHP 5, has been integrated with the XML-RPC expansion by default, and the expansion has nothing to do with xmlrpc expansion, can independently implement XML-RPC protocol interaction, if there is no xmlrpc expansion, it is recommended to apply PEAR: XML-RPC expansion.

Here we are an important XML-RPC to briefly describe the Web Service interaction process, part of the content from the PHP Manual, more specific content, it is recommended to refer to the manual.

[Install xmlrpc extension]

If your system does not have the php extension with xmlrpc installed, install it accurately.

On the Windows platform, first put the expanded php_xmlrpc.dll under the PHP installation directory to the C: \ Windows or C: \ Winnt directory: in the \ php \ extensions directory, PHP5 is expanded in the C: \ php \ ext directory), and C: \ Windows \ php. ini or C: \ Winnt \ php. ini put extension = php_xmlrpc.dll in front of the semicolon ';', and then restart the Web server to check whether phpinfo () has a XML-RPC project can determine whether the xmlrpc expansion has been accurately installed.

On Unix/Linux platforms, if xmlrpc expansion is not installed, re-compile PHP. when configure is installed, add the -- with-xmlrpc option and view phpinfo () check whether xmlrpc is installed properly.

(Note: The following controls are built on the xmlrpc expansion normal installation conditions, please be sure to install accurately .)

  [XML-RPC working principle]

XML-RPC is generally the whole process is the application of XML for communication. First, an RPC server is used to construct an application XML encapsulation request passed from the RPC client, and return the processing result to the RPC client through the XML format, the client obtains the data you need from the analysis XML.

The server end of the XML-RPC must have a ready-made function supply should be called by the client, and the client to submit the function and method in the request must be consistent with the server, otherwise it will not be able to obtain the expected results.

Below I will briefly describe the entire process.

  [XML-RPC practice]

The server uses the xmlrpc_server_create function to generate a server, and then registers the RPC calling interface that requires *** exposure to receive XML data from the POST of the RPC client, which is processed by lines, the processing result is displayed to the client in XML format.

The code is as follows: rpc_server.php

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.