Home > Backend Development > PHP Tutorial > PHPRPC for Java Spring的事例

PHPRPC for Java Spring的事例

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:55:22
Original
777 people have browsed it

PHPRPC for Java Spring的例子
1.需要在web.xml中配置

      web.xml文件:

     
        
              phprpc
             org.springframework.web.servlet.DispatcherServlet
            

                   
                   contextConfigLocation
                  WEB-INF/config/phprpc-servlet-front-action.xml
           

            2
      

      
           phprpc
           /phprpc/*
     


2. 配置spring

      我的是配置文件在WEB-INF/config/phprpc-servlet-front-action.xml:

     相关内容为:

     

    
    
          
    


   
   
        
        
         

        
    


第二步配置好后,在地址栏中键入"http://localhost:8080/项目名/phprpc/appservice.jspx"就得到类似下图的结果。如果现实,配置成功。

PHPRPC for Java Spring的事例
前两步成功后,我们看看该如何使用:

       // 调用时的写法

        PHPRPC_Client client = new PHPRPC_Client("http://localhost:8090/项目名称/phprpc/appservice.jspx");
        ApplicationServer appServer = (ApplicationServer) client.useService(ApplicationServer.class);
        appServer.register(username, password);   //要调用的方法

和不用spring的写法一摸一样,只是路径是配出来的。



  我亲自试了试,没有问题!!

  大家如有问题,可以一起讨论一下PHPRPC for Java Spring的事例

1 楼 chenxing1990 2011-12-06  
楼主能不能把配置文件的头什么的贴出来,appservice.jspx 这个是自己建的还是生成呢!
Related labels:
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