`
yushine
  • 浏览: 200569 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Web Services and PHP – SOAP vs XML-RPC vs REST

    博客分类:
  • PHP
阅读更多
What is web services?

In a typical web surfing scenario, a visitor visits a website and use the functionality provided by that particular website.HTTP request is send to server from web browsers and server responses are translated by browser to display the desired result of the visitor. But, this scenario has been changed in the recent days. You don’t need to visit the particular website to use their service and functionality if they are providing web services. Web services are set of platform independent exposed APIs(functions) which can be used used from remote server over the Internet. There are basically two parties involved in this, one which provides a set of exposed APIs and the another one ,commonly know as web services consumers,is the party which uses the functionality and services provided by web services providing party.

There are different method for providing web services but the most common are SOAP, XML-RPC and REST .
SOAP

SOAP was the acronym of Simple Object Access Protocal but this acronym was dropped in the version of 1.2 of SOAP. It is method for exchanging XML based message over the Internet for providing and consuming web services. SOAP message are transferred forming the SOAP-Envelope.You can view the typical SOAP Message articture from here. SOAP is widely criticized for it’s design complexity.

In PHP 5, there is built-in extension for the providing and consuming web services. But, I personally prefer Nusoap toolkit of PHP for providing and consuming web services using SOAP in PHP.
XML-RPC

XML-RPC (remote procedure call) another way of providing and consuming web services. It uses XML to encode and decode the remote procedure call along with it’s parameter. Compared to the articture of SOAP, it has simpler architecture. You can even define data type of parameters of procedure in XML-RPC. You can visit the official website www.xmlrpc.com to know more about XML-RPC.

In PHP, there is extension which contain various functions for facilating XML-RPC request and response. But the functions xmlrpc_encode_request() and xmlrpc_decode_request() available in PHP is very useful for when it comes to encode and decode XML-RPC request and response.

I’ve built  Nepali Currency Converter using XML-RPC web services provided by foxrate.org.
REST

Representational State Trasfer(REST) is comparatively simpler method for providing and consuming web services. Nowadays, this method is becoming popular in the arena of web services. Unlike above two method, it is not necessary to use XML as a data interchange format in REST. REST architecture is basically focused on two things : Resources and Interface.RESTful  is another term to define REST web services .

Resources are application’s state and functionality which is represented by a unique URL. The resources share a uniform interface to transfer the state between the client and server.

For example the URL, http://example.com/product/11 can be a resource.Suppose, GET method is used to retrieve product detail from that URL, POST method is used to modify the production information and DELETE method can be used to delete the product from the same URL. Here, the HTTP methods works as a interface to access the resources.

Talking about PHP, the format of information(representation) returned can be in XML, JSON or even in HTML format. DOM functions, SimpleXML functions and JSON functions comes handy when you are handling RESTful interfaces in PHP.

I also want to know your view. Please participate in the poll below.
分享到:
评论

相关推荐

    programming web services with xml rpc

    - **超越XML-RPC**:探讨了除了XML-RPC之外的其他Web服务技术,如SOAP、REST等,并分析了它们与XML-RPC之间的差异。 - **协议设计选择**:讨论了在选择Web服务协议时需要考虑的因素,以及如何根据具体需求做出最佳...

    基于SOAP的Web-Services开发的关键技术_SOAP的Web-Services_Web-Services开发_

    为了优化性能,可以采用压缩、缓存、二进制XML或者SOAP over REST等技术。 10. **持续集成与测试**:在开发过程中,利用自动化工具进行持续集成和测试是非常重要的,例如JUnit、Maven、Selenium等,它们能确保Web...

    dubbo rest rpc相关jar包

    再来看`dubbo-rpc-webservice-2.8.4.jar`,这个组件是Dubbo对Web Services(通常基于SOAP协议)的支持。Web Services是一种标准的跨语言、跨平台的通信方式,通过XML格式传输数据。虽然REST在现代微服务中更受欢迎,...

    xmlrpc-am5-ws

    它特别适合于那些不希望或不能使用复杂的Web服务标准(如SOAP或REST)的项目。 2. **am5-xmlrpc-api.jar**: 这个文件是AM5 XML-RPC API的实现,它提供了用于创建XML-RPC服务器和客户端的接口和类。开发人员可以...

    PHP.Web.Services.APIs.for.the.Modern.Web.2nd.Edition

    RPC and SOAP Services Chapter 8. REST Chapter 9. Webhooks Chapter 10. HTTP Tools Chapter 11. Maintainable Web Services Chapter 12. Making Service Design Decisions Chapter 13. Building a Robust ...

    Web Services with SOAP.

    Web服务是一种基于网络的、平台无关的交互方式,它允许不同的系统...O'Reilly的"Programming Web Services with SOAP"可能涵盖了这些主题的深入讨论,包括实践示例和最佳实践,帮助读者掌握SOAP Web服务的开发和应用。

    Java.Web.Services:Up.and.Runnin

    - Web Services的历史经历了从DCE/RPC到XML-RPC的发展。 - 这个过程中,分布式对象架构(如 CORBA 和 DCOM)逐渐演变为以XML为基础的消息传递系统。 4. 分布式对象架构示例 - 书中提到了一个使用Java的分布式对象...

    Python Network Programming Cookbook, 2nd Edition - 2017

    Chapter 7, Working with Web Services – XML-RPC, SOAP, and REST, introduces you to various API protocols such as XML-RPC, SOAP, and REST. You can programmatically ask any website or web service for ...

    JAVA访问WebServices接口的简单实例,android可用

    它们通过标准协议(如SOAP、REST或XML-RPC)提供服务,并使用WSDL(Web服务描述语言)进行定义。 2. **SOAP协议**: 在这个实例中,我们可能涉及到SOAP(Simple Object Access Protocol),它是一种基于XML的消息...

    PHP Web 2.0 Mashup Projects.pdf

    we cover two basic web services to get our feet wet — XML-RPC and REST. The Internet UPC database is an XML-RPC-based service, while Amazon uses REST. Preface [ 2 ] We will create code to call XML-...

    Java Web Services Tutorial

    1. **JAX-WS (Java API for XML Web Services)**:是Java平台上的API,用于创建和访问Web服务。 2. **JAX-RPC (Java API for XML-based Remote Procedure Calls)**:虽然已经被JAX-WS取代,但在早期版本中仍然被广泛...

    Java Web Services Up and Running, 2nd Edition 2013最新版

    《Java Web Services Up and Running, 2nd Edition》是一本由Martin Kalin编写的关于Java网络服务的入门与进阶教材,2013年第二版更新,该书是Java开发者学习和实现网络服务的重要参考书籍。 Java网络服务,即Java ...

    Accessing Web Services from a Visual Web Application

    常见的Web服务标准包括SOAP(Simple Object Access Protocol)、REST(Representational State Transfer)和XML-RPC(XML Remote Procedure Call)。在本主题中,我们主要讨论SOAP和RESTful服务的使用。 **2. ...

    解决JBoos5.0运行EJB3.0_WebServices跟jdk1.6的兼容问题用到的jar包

    在Java中,JAX-WS(Java API for XML Web Services)和JAX-RPC(Java API for XML-Based Remote Procedure Calls)是用于创建和消费Web服务的主要API。 3. **JDK 1.6**:这是Oracle公司发布的Java开发工具包的一个...

    java调用webservices

    - **使用JAX-WS (Java API for XML Web Services)**:这是Sun Microsystems定义的一套标准API,用于处理Web服务。 #### 三、Apache Axis调用SOAP Web Service **1. 创建客户端调用Web服务** 根据给定的代码片段,...

    webservice(axis,xfire,cxf)

    CXF支持SOAP、REST、WS-*(如WS-Security、WS-Addressing等)以及各种绑定技术,包括JAX-WS(Java API for XML Web Services)和JAX-RS(Java API for RESTful Web Services)。CXF的强大之处在于它的易用性、性能和...

    soap-ws-cloud

    在IT行业中,SOAP(Simple Object Access Protocol)是一种基于XML的协议,用于在Web服务中交换结构化信息。它允许不同的应用程序通过HTTP等传输协议进行通信,实现数据交换和功能调用。SOAP通常与Web Services(WS...

    WebServices学习资料

    ### WebServices学习资料:REST与SOAP技术概览 在当今的软件开发领域,Web Services扮演着连接不同系统、实现跨平台通信的关键角色。本文将基于提供的文件信息,深入探讨REST和SOAP两种主流的Web Services风格,...

    webservice Soap和XFire2种方式代码列子

    在Java环境中,通常使用JAX-WS(Java API for XML Web Services)来处理SOAP通信。例如,Apache CXF是一个流行的开源框架,它提供了SOAP服务的创建、发布和调用功能。开发者可以使用CXF生成客户端和服务器端的Stubs...

    webservice应用

    - **REST vs XML-RPC vs SOAP**:REST(Representational State Transfer)强调资源和状态转换,通常用于简单、轻量级的交互;XML-RPC是另一种远程调用协议,使用XML作为数据交换格式;SOAP更为复杂,提供更全面的...

Global site tag (gtag.js) - Google Analytics