PHP core technology and best practices PHP uses PHPRPC protocol to call JAVA class

Source: Internet
Author: User
PHP core technology and best practices PHP uses PHPRPC protocol to call JAVA class
  1. SOAP (Simple Object Access Protocol, Simple Object Access Protocol) with the continuous competition and design of manufacturers, and because the transfer of objects cannot achieve interoperability, SOAP gradually changes to the transfer of strings, and is finally designed as the XML-based WebService.
  2. PHPRPC protocol: it is a lightweight, secure, cross-Internet, cross-language, cross-platform, cross-environment, cross-domain protocol that supports transmission of complex objects and reference parameters, content output redirection, hierarchical error processing, and Sessions are service-oriented high-performance remote process calling protocols that are fast, mainly because of their data serialization and transmission.
  3. How to use PHP to call the JAVA class can be implemented through php-java-bridge, and WebService can also be used by middleware such as ICE, which is implemented through PHPRPC, download the corresponding software package from the PHPRPC website and copy the corresponding file to the lib directory of JAVA and the PHP Directory (see). The following describes the implementation process: output function: connect to the database to obtain all user functions: define the requested jsp page in JAVA:

Copy the corresponding package from the PHPRPC-JAVA to the lib Directory

Browser page request result (open the new tab to view the large image ):

  1. You can also use PHP as the server. the code is as follows:

    Server:

    Include 'phprpc/phprpc_server.php ';

    Class Hello {

    Static function HelloWorld (){

    Return 'Hello World! ';

    }

    }

    $ Server = new PHPRPC_Server ();

    $ Server-> add ('helloworld', 'Hello ');

    $ Server-> start ();

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.